Skip to content

Commit

Permalink
V1.7 2024 03 18 run (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitejohnson authored Mar 18, 2024
1 parent f3e26b0 commit 0942fad
Show file tree
Hide file tree
Showing 28 changed files with 35,002 additions and 340 deletions.
105 changes: 60 additions & 45 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ list(
),


## Fit the model ------------------------------------------------------------
# # Fit the model ------------------------------------------------------------
# # get a stacked long dataframe containing the quantiles(estimated
# # from all draws) and 100 samples of the draws from the posterior for the
# # generated quantities and the parameters
Expand Down Expand Up @@ -285,7 +285,7 @@ list(
name = plot_single_location_hosp_draws_id,
command = get_plot_draws(grouped_df_id,
"pred_hosp",
figure_file_path,
figure_output_subdirectory,
show_calibration_data = FALSE
),
pattern = map(grouped_df_id),
Expand All @@ -296,7 +296,7 @@ list(
name = plot_single_location_comb_quantiles_id,
command = get_combo_quantile_plot(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -306,7 +306,7 @@ list(
name = plot_ww_site_level_quantiles_id,
command = get_ww_site_plots(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -316,7 +316,7 @@ list(
name = plot_single_location_ww_draws_id,
command = get_plot_labsite_ww_draws(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -326,7 +326,7 @@ list(
name = plot_rt_id,
command = get_rt_from_draws(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -336,7 +336,7 @@ list(
name = plot_rt_site_level,
command = get_rt_site_level(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -346,7 +346,7 @@ list(
name = plot_params_id,
command = get_plot_param_distribs(
grouped_df_id,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_id),
iteration = "list",
Expand All @@ -365,8 +365,8 @@ list(
deployment = "main"
),
tar_target(
name = figure_file_path,
command = get_figure_file_path(
name = figure_output_subdirectory,
command = get_figure_output_subdirectory(
output_dir_ho
),
deployment = "main"
Expand Down Expand Up @@ -463,7 +463,7 @@ list(
name = plot_single_location_hosp_draws_ho,
command = get_plot_draws(grouped_df,
"pred_hosp",
figure_file_path,
figure_output_subdirectory,
show_calibration_data = FALSE
),
pattern = map(grouped_df),
Expand All @@ -474,7 +474,7 @@ list(
name = plot_rt_ho,
command = get_rt_from_draws(
grouped_df,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df),
iteration = "list",
Expand All @@ -484,7 +484,7 @@ list(
name = plot_params_ho,
command = get_plot_param_distribs(
grouped_df,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df),
iteration = "list",
Expand Down Expand Up @@ -553,7 +553,10 @@ list(
),
tar_target(
name = single_plot_data_sa,
command = plot_combined_data(grouped_data_sa, figure_file_path),
command = plot_combined_data(
grouped_data_sa,
figure_output_subdirectory
),
pattern = map(grouped_data_sa),
iteration = "list",
deployment = "main"
Expand Down Expand Up @@ -607,7 +610,7 @@ list(
name = plot_single_location_hosp_draws_sa,
command = get_plot_draws(grouped_df_sa,
"pred_hosp",
figure_file_path,
figure_output_subdirectory,
show_calibration_data = FALSE
),
pattern = map(grouped_df_sa),
Expand All @@ -618,7 +621,7 @@ list(
name = plot_single_location_ww_draws_sa,
command = get_plot_draws(df_of_filepaths_us,
"pred_ww",
figure_file_path,
figure_output_subdirectory,
show_calibration_data = FALSE
),
deployment = "main"
Expand All @@ -627,7 +630,7 @@ list(
name = plot_rt_sa,
command = get_rt_from_draws(
grouped_df_sa,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_sa),
iteration = "list",
Expand All @@ -637,7 +640,7 @@ list(
name = plot_params_sa,
command = get_plot_param_distribs(
grouped_df_sa,
figure_file_path
figure_output_subdirectory
),
pattern = map(grouped_df_sa),
iteration = "list",
Expand All @@ -647,7 +650,7 @@ list(
name = plot_single_location_comb_quantiles_sa,
command = get_combo_quantile_plot(
df_of_filepaths_us,
figure_file_path
figure_output_subdirectory
),
deployment = "main"
),
Expand Down Expand Up @@ -677,7 +680,7 @@ list(
grouped_df_comb,
"pred_hosp",
grouping_var = "model_type",
figure_file_path,
figure_output_subdirectory,
show_calibration_data = FALSE
),
pattern = map(grouped_df_comb),
Expand All @@ -690,7 +693,10 @@ list(
comb_df_filepaths %>%
ungroup() %>%
filter(model_type == "site-level infection dynamics"),
figure_file_path = file.path(figure_file_path, "combined_outputs")
figure_file_path = file.path(
figure_output_subdirectory,
"combined_outputs"
)
),
deployment = "main"
),
Expand All @@ -700,13 +706,16 @@ list(
comb_df_filepaths %>%
ungroup() %>%
filter(model_type == "hospital admissions only"),
figure_file_path = file.path(figure_file_path, "combined_outputs")
figure_file_path = file.path(
figure_output_subdirectory,
"combined_outputs"
)
),
deployment = "main"
),
tar_target(
name = pdf_file_path,
command = get_pdf_file_path(
name = pdf_output_subdirectory,
command = get_pdf_output_subdirectory(
output_dir_id
),
deployment = "main"
Expand All @@ -721,7 +730,10 @@ list(
plot_ww_site_level_quantiles_id
),
type_of_output = "site_level_inf_dynamics",
pdf_file_path = file.path(pdf_file_path, "internal"),
pdf_file_path = file.path(
pdf_output_subdirectory,
"internal"
),
model_name = config_vars_id$submitting_model_name,
n_row = 1,
n_col = 1,
Expand All @@ -740,7 +752,10 @@ list(
plot_single_location_comb_quantiles_id
),
type_of_output = "hosp_and_ww_forecasts_site_level_inf_dyn",
pdf_file_path = file.path(pdf_file_path, "internal"),
pdf_file_path = file.path(
pdf_output_subdirectory,
"internal"
),
model_name = config_vars_id$submitting_model_name,
n_row = 3,
n_col = 1,
Expand All @@ -755,7 +770,10 @@ list(
save_to_pdf,
c(list(list_of_plots = plot_mult_models),
type_of_output = "forecasts_from_mult_model_types",
pdf_file_path = file.path(pdf_file_path, "internal"),
pdf_file_path = file.path(
pdf_output_subdirectory,
"internal"
),
model_name = config_vars_id$submitting_model_name,
n_row = 3,
n_col = 1,
Expand Down Expand Up @@ -823,34 +841,31 @@ list(
),
tar_target(
name = table_of_state_model_designations,
command = do.call(
get_summarized_table,
c(
list(
hub_submission_df = hub_submission_df,
full_diagnostics_df = full_diagnostics_df,
hosp_only_states = hosp_only_states,
repo_file_path = repo_file_path
),
config_vars_id
)
command = get_location_notes_table(
full_diagnostics_df,
hosp_only_states,
output_dir = repo_file_path,
prod_run = config_vars_id$prod_run
),
deployment = "main"
),
tar_target(
name = pipeline_ww_metadata,
command = do.call(get_metadata_yaml, c(
list(full_diagnostics_df = full_diagnostics_df),
repo_file_path = repo_file_path,
list(hosp_only_states = hosp_only_states),
config_vars_id
))
command = get_metadata_yaml(
data_diagnostics_df = full_diagnostics_df,
hosp_only_states = hosp_only_states,
output_dir = repo_file_path,
prod_run = config_vars_id$prod_run
)
),
tar_target(
name = rt_box_plot_hub,
command = get_rt_boxplot_across_states(
df_of_filepaths,
figure_file_path = file.path(pdf_file_path, "internal")
figure_file_path = file.path(
pdf_output_subdirectory,
"internal"
)
),
deployment = "main"
),
Expand Down
9 changes: 6 additions & 3 deletions cfaforecastrenewalww/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export(get_config_vals)
export(get_df_for_hub_submission)
export(get_df_of_filepaths)
export(get_diagnostics)
export(get_figure_file_path)
export(get_figure_output_subdirectory)
export(get_full_param_distrib)
export(get_gen_quants_draws)
export(get_generated_quantities_draws)
Expand All @@ -35,6 +35,7 @@ export(get_ind_m)
export(get_ind_m_cum_sum)
export(get_init_fun)
export(get_loc_model_map)
export(get_location_notes_table)
export(get_low_case_count_diagnostic)
export(get_metadata)
export(get_metadata_yaml)
Expand All @@ -47,14 +48,16 @@ export(get_param_samples_long_df)
export(get_parameter_draws)
export(get_params)
export(get_pars)
export(get_pdf_file_path)
export(get_pdf_output_subdirectory)
export(get_pipeline_metadata)
export(get_plot_covidhub_submission)
export(get_plot_draws)
export(get_plot_labsite_ww_draws)
export(get_plot_metadata)
export(get_plot_param_distribs)
export(get_ppa_long)
export(get_prior_pred_hosps_df)
export(get_prior_pred_ww_df)
export(get_quantiles)
export(get_quantiles_on_site_level_ww)
export(get_random_string)
Expand All @@ -73,7 +76,6 @@ export(get_state_level_hosp_data)
export(get_state_level_summary)
export(get_submission_file_path)
export(get_submission_filepath_df)
export(get_summarized_table)
export(get_summary_stats)
export(get_testing_data)
export(get_training_data)
Expand All @@ -95,6 +97,7 @@ export(pivot_data_for_plotting)
export(plot_combined_data)
export(plot_quantiles)
export(posterior_predictive_analysis)
export(prior_predictive_check)
export(pull_nhsn)
export(read_diagnostics_df)
export(save_timestamped_nwss_data)
Expand Down
Loading

0 comments on commit 0942fad

Please sign in to comment.