@@ -13,6 +13,7 @@ nssp_col_names <- list(
1313# '
1414# ' @param base_hub_path Path to the base hub directory.
1515# ' @param disease Disease name ("covid" or "rsv").
16+ # ' @param as_of Date of the data pull. Default is today's date.
1617# ' @param excluded_locations Vector of location codes to exclude from the output.
1718# ' Default value is c("78", "69", "66", "60"), corresponding to "US Virgin Islands",
1819# ' "Guam", "American Samoa", and "Northern Mariana Islands".
@@ -26,14 +27,14 @@ nssp_col_names <- list(
2627update_hub_target_data <- function (
2728 base_hub_path ,
2829 disease ,
30+ as_of = lubridate :: today(),
2931 nhsn_first_weekending_date = lubridate :: as_date(" 2024-11-09" ),
3032 excluded_locations = c(" 78" , " 69" , " 66" , " 60" ),
3133 legacy_file = FALSE
3234) {
3335 if (! disease %in% c(" covid" , " rsv" )) {
3436 stop(" 'disease' must be either 'covid' or 'rsv'" )
3537 }
36- today <- lubridate :: today()
3738 output_dirpath <- fs :: path(base_hub_path , " target-data" )
3839 fs :: dir_create(output_dirpath )
3940
@@ -54,7 +55,7 @@ update_hub_target_data <- function(
5455 " abbr" ,
5556 " code"
5657 ),
57- as_of = !! today ,
58+ as_of = !! as_of ,
5859 target = glue :: glue(" wk inc {disease} hosp" )
5960 ) | >
6061 dplyr :: filter(! (.data $ location %in% !! excluded_locations ))
@@ -90,7 +91,7 @@ update_hub_target_data <- function(
9091 " name" ,
9192 " code"
9293 ),
93- as_of = !! today ,
94+ as_of = !! as_of ,
9495 target = glue :: glue(" wk inc {disease} prop ed visits" )
9596 ) | >
9697 dplyr :: select(
@@ -113,6 +114,5 @@ update_hub_target_data <- function(
113114 hubverse_format_nhsn_data ,
114115 hubverse_format_nssp_data
115116 ) | >
116- dplyr :: distinct() | >
117117 forecasttools :: write_tabular_file(output_file )
118118}
0 commit comments