diff --git a/flepimop/R_packages/flepicommon/R/config_test_new.R b/flepimop/R_packages/flepicommon/R/config_test_new.R index 26e55eeb1..bee5ea9dc 100644 --- a/flepimop/R_packages/flepicommon/R/config_test_new.R +++ b/flepimop/R_packages/flepicommon/R/config_test_new.R @@ -526,7 +526,7 @@ validation_list$outcomes$settings<-function(value, full_config,config_name){ if(is.null(value)){ print("No outcome settings mentioned default assigned") #Assign Default } - for (scenario in full_config$outcomes$scenarios){ + for (scenario in full_config$outcomes_modifiers$scenarios){ if(!(scenario %in% names(value))){ print(paste0("No details mentioned about scenario ",scenario," in outcomes")) return(FALSE) diff --git a/flepimop/main_scripts/inference_main.R b/flepimop/main_scripts/inference_main.R index b166e2418..aa081b2e5 100644 --- a/flepimop/main_scripts/inference_main.R +++ b/flepimop/main_scripts/inference_main.R @@ -43,9 +43,9 @@ config <- flepicommon::load_config(opt$config) ##If outcome scenarios are specified check their existence outcome_modifiers_scenarios <- opt$outcome_modifiers_scenarios if (all(outcome_modifiers_scenarios == "all")) { - outcome_modifiers_scenarios <- config$outcomes$scenarios -} else if (!(outcome_modifiers_scenarios %in% config$outcomes$scenarios)){ - message(paste("Invalid outcome scenario argument:[",paste(setdiff(outcome_modifiers_scenarios, config$outcome$scenarios)), "]did not match any of the named args in", paste(config$outcomes$scenarios, collapse = ", "), "\n")) + outcome_modifiers_scenarios <- config$outcomes_modifiers$scenarios +} else if (!(outcome_modifiers_scenarios %in% config$outcomes_modifiers$scenarios)){ + message(paste("Invalid outcome scenario argument:[",paste(setdiff(outcome_modifiers_scenarios, config$outcome$scenarios)), "] did not match any of the named args in", paste(config$outcomes_modifiers$scenarios, collapse = ", "), "\n")) quit("yes", status=1) } diff --git a/flepimop/main_scripts/inference_slot.R b/flepimop/main_scripts/inference_slot.R index c350f067a..3a99791b8 100644 --- a/flepimop/main_scripts/inference_slot.R +++ b/flepimop/main_scripts/inference_slot.R @@ -137,9 +137,9 @@ if (!dir.exists(data_dir)){ ##If outcome scenarios are specified check their existence outcome_modifiers_scenarios <- opt$outcome_modifiers_scenarios if(all(outcome_modifiers_scenarios == "all")) { - outcome_modifiers_scenarios <- config$outcomes$scenarios -} else if (!(outcome_modifiers_scenarios %in% config$outcomes$scenarios)){ - message(paste("Invalid outcome scenario argument:[",paste(setdiff(outcome_modifiers_scenarios, config$outcome$scenarios)), "]did not match any of the named args in", paste(config$outcomes$scenarios, collapse = ", "), "\n")) + outcome_modifiers_scenarios <- config$outcomes_modifiers$scenarios +} else if (!(outcome_modifiers_scenarios %in% config$outcomes_modifiers$scenarios)){ + message(paste("Invalid outcome scenario argument:[",paste(setdiff(outcome_modifiers_scenarios, config$outcome$scenarios)), "] did not match any of the named args in", paste(config$outcomes_modifiers$scenarios, collapse = ", "), "\n")) quit("yes", status=1) } @@ -148,20 +148,20 @@ seir_modifiers_scenarios <- opt$seir_modifiers_scenarios if (all(seir_modifiers_scenarios == "all")){ seir_modifiers_scenarios <- config$seir_modifiers$scenarios } else if (!all(seir_modifiers_scenarios %in% config$seir_modifiers$scenarios)) { - message(paste("Invalid intervention scenario arguments: [",paste(setdiff(seir_modifiers_scenarios, config$seir_modifiers$scenarios)), "] did not match any of the named args in ", paste(config$seir_modifiers$scenarios, collapse = ", "), "\n")) + message(paste("Invalid intervention scenario arguments: [", paste(setdiff(seir_modifiers_scenarios, config$seir_modifiers$scenarios)), "] did not match any of the named args in ", paste(config$seir_modifiers$scenarios, collapse = ", "), "\n")) quit("yes", status=1) } ##Creat heirarchical stats object if specified hierarchical_stats <- list() -if ("hierarchical_stats_geo"%in%names(config$inference)) { +if ("hierarchical_stats_geo" %in% names(config$inference)) { hierarchical_stats <- config$inference$hierarchical_stats_geo } ##Create priors if specified defined_priors <- list() -if ("priors"%in%names(config$inference)) { +if ("priors" %in% names(config$inference)) { defined_priors <- config$inference$priors } diff --git a/postprocessing/model_output_notebook.Rmd b/postprocessing/model_output_notebook.Rmd index f98ab307b..d6417b0ed 100644 --- a/postprocessing/model_output_notebook.Rmd +++ b/postprocessing/model_output_notebook.Rmd @@ -66,7 +66,7 @@ import_model_outputs <- "/", config$interventions$scenarios, "/", - config$outcomes$scenarios + config$outcomes_modifiers$scenarios ) subdir_ <- paste0(dir_, "/", list.files(dir_), "/", @@ -280,8 +280,7 @@ Here are the results from your outcomes model. If you ran more than one simulati ## add something so that if it doesn't exist, it prints some 'no output' message # get all outcome variables -scns <- config$outcomes$scenarios -list_of_vars_config <- paste0("config$outcomes$settings$", scns) +list_of_vars_config <- "config$outcomes$outcomes" outcomes <- eval(parse(text = list_of_vars_config)) outcome_vars <- names(outcomes) @@ -494,8 +493,7 @@ In your inference method you specified that your model be fit to `r names(config ```{r hosp_trajectories_inference_aggregate, fig.dim = c(10,10), results='asis'} if(inference){ # get all outcome variables - scns <- config$outcomes$scenarios - list_of_vars_config <- paste0("config$outcomes$settings$", scns) + list_of_vars_config <- "config$outcomes$outcomes" outcomes <- eval(parse(text = list_of_vars_config)) outcome_vars <- names(outcomes) fit_stats <- names(config$inference$statistics) diff --git a/postprocessing/postprocess_snapshot.R b/postprocessing/postprocess_snapshot.R index f60ee37df..f35595cae 100644 --- a/postprocessing/postprocess_snapshot.R +++ b/postprocessing/postprocess_snapshot.R @@ -82,7 +82,7 @@ import_model_outputs <- function(scn_dir, outcome, global_opt, final_opt, outcome, "/", config$name, "/", config$interventions$scenarios, "/", - config$outcomes$scenarios) + config$outcomes_modifiers$scenarios) subdir_ <- paste0(dir_, "/", list.files(dir_), "/", global_opt, diff --git a/postprocessing/processing_diagnostics.R b/postprocessing/processing_diagnostics.R index b18f8d651..c31669d12 100644 --- a/postprocessing/processing_diagnostics.R +++ b/postprocessing/processing_diagnostics.R @@ -77,7 +77,7 @@ import_s3_outcome <- function(scn_dir, outcome, global_opt, final_opt){ outcome, "/", config$name, "/", config$interventions$scenarios, "/", - config$outcomes$scenarios) + config$outcomes_modifiers$scenarios) subdir_ <- paste0(dir_, "/", list.files(dir_), "/", global_opt, diff --git a/postprocessing/processing_diagnostics_AWS.R b/postprocessing/processing_diagnostics_AWS.R index 3b60663fc..c1304fd30 100644 --- a/postprocessing/processing_diagnostics_AWS.R +++ b/postprocessing/processing_diagnostics_AWS.R @@ -77,7 +77,7 @@ import_s3_outcome <- function(scn_dir, outcome, global_opt, final_opt){ outcome, "/", config$name, "/", config$interventions$scenarios, "/", - config$outcomes$scenarios) + config$outcomes_modifiers$scenarios) subdir_ <- paste0(dir_, "/", list.files(dir_), "/", global_opt, diff --git a/postprocessing/processing_diagnostics_SLURM.R b/postprocessing/processing_diagnostics_SLURM.R index 4b27e704d..418cac24c 100644 --- a/postprocessing/processing_diagnostics_SLURM.R +++ b/postprocessing/processing_diagnostics_SLURM.R @@ -23,7 +23,7 @@ import_s3_outcome <- function(scn_dir, outcome, global_opt, final_opt){ outcome, "/", config$name, "/", config$interventions$scenarios, "/", - config$outcomes$scenarios) + config$outcomes_modifiers$scenarios) subdir_ <- paste0(dir_, "/", list.files(dir_), "/", global_opt, diff --git a/postprocessing/run_sim_processing_FluSightExample.R b/postprocessing/run_sim_processing_FluSightExample.R index b634f0c33..6d36f635d 100644 --- a/postprocessing/run_sim_processing_FluSightExample.R +++ b/postprocessing/run_sim_processing_FluSightExample.R @@ -368,7 +368,7 @@ peak_ram_ <- peakRAM::peakRAM({ plot_samp = plot_samp, gt_data = gt_data, geodata_file = geodata_file_path, - death_filter = config$outcomes$scenarios, + death_filter = config$outcomes_modifiers$scenarios, summarize_peaks = (smh_or_fch == "smh"), save_reps = save_reps) tmp_out <- list(tmp_out, tmp_out_) diff --git a/postprocessing/run_sim_processing_SLURM.R b/postprocessing/run_sim_processing_SLURM.R index 3d8396338..c6df2dba2 100644 --- a/postprocessing/run_sim_processing_SLURM.R +++ b/postprocessing/run_sim_processing_SLURM.R @@ -382,7 +382,7 @@ tmp_out <- process_sims(scenario_num = scenario_num, plot_samp = plot_samp, gt_data = gt_data, geodata_file = geodata_file_path, - death_filter = config$outcomes$scenarios, + death_filter = config$outcomes_modifiers$scenarios, summarize_peaks = (smh_or_fch == "smh"), save_reps = save_reps) diff --git a/postprocessing/run_sim_processing_TEMPLATE.R b/postprocessing/run_sim_processing_TEMPLATE.R index 166783a83..a7e229df6 100644 --- a/postprocessing/run_sim_processing_TEMPLATE.R +++ b/postprocessing/run_sim_processing_TEMPLATE.R @@ -368,7 +368,7 @@ peak_ram_ <- peakRAM::peakRAM({ plot_samp = plot_samp, gt_data = gt_data, geodata_file = geodata_file_path, - death_filter = config$outcomes$scenarios, + death_filter = config$outcomes_modifiers$scenarios, summarize_peaks = (smh_or_fch == "smh"), save_reps = save_reps) tmp_out <- list(tmp_out, tmp_out_)