Skip to content

Commit

Permalink
Make data prep and post-processing more generic (#66)
Browse files Browse the repository at this point in the history
* Split prep_data.py into functions and make it a bit more configurable

* use parser output as dictionary

* Fix misnamed variable

* Working prep_data script

* Fix output path bug

* Add right_truncation_offset calculation to python prep_data.py

* Make post_process.R more generic

* Quiet read_csv, progress messages

* Format files

* only run main if we're running in main

* clear up temporary code info for post_process

* remove duckdb

* actually remove duckdb import

* make param_estimates lazy

* use Path for argument typs where appropriate

---------

Co-authored-by: Damon Bayer <[email protected]>
Co-authored-by: Damon Bayer <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent cc7f156 commit 7253f9b
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 147 deletions.
11 changes: 7 additions & 4 deletions nssp_demo/post_process.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ library(scales)
library(here)
library(argparser)

theme_set(theme_minimal_grid())

disease_name_formatter <- c("covid-19" = "COVID-19", "influenza" = "Flu")

# Create a parser
p <- arg_parser("Generate forecast figures") %>%
add_argument(p, "--model_dir",
Expand All @@ -29,9 +33,7 @@ good_chain_tol <- argv$good_chain_tol

base_dir <- path_dir(model_dir)

theme_set(theme_minimal_grid())

disease_name_formatter <- c("covid-19" = "COVID-19", "influenza" = "Flu")

read_pyrenew_samples <- function(inference_data_path,
filter_bad_chains = TRUE,
Expand Down Expand Up @@ -178,8 +180,9 @@ save_plot(
device = cairo_pdf, base_height = 6
)


# Temp code while command line version doesn't work
# File will end here once command line version is working
# Temp code to run for all states while command line version doesn't work
# Command line version is dependent on https://github.com/rstudio/renv/pull/2018
base_dir <- path(
"nssp_demo",
"private_data",
Expand Down
Loading

0 comments on commit 7253f9b

Please sign in to comment.