Skip to content

Commit

Permalink
changed config$outcomes$scenarios to config$outcomes_modifiers$scenar…
Browse files Browse the repository at this point in the history
…ios to match new simplified config format
  • Loading branch information
shauntruelove committed Oct 11, 2023
1 parent c051cc0 commit 10d118b
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion flepimop/R_packages/flepicommon/R/config_test_new.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions flepimop/main_scripts/inference_main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
12 changes: 6 additions & 6 deletions flepimop/main_scripts/inference_slot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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
}

Expand Down
8 changes: 3 additions & 5 deletions postprocessing/model_output_notebook.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import_model_outputs <-
"/",
config$interventions$scenarios,
"/",
config$outcomes$scenarios
config$outcomes_modifiers$scenarios
)
subdir_ <- paste0(dir_, "/", list.files(dir_),
"/",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/postprocess_snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/processing_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/processing_diagnostics_AWS.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/processing_diagnostics_SLURM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/run_sim_processing_FluSightExample.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
2 changes: 1 addition & 1 deletion postprocessing/run_sim_processing_SLURM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion postprocessing/run_sim_processing_TEMPLATE.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down

0 comments on commit 10d118b

Please sign in to comment.