@@ -17,9 +17,9 @@ forecast_generation_date <- Sys.Date()
1717forecast_date <- round_date(forecast_generation_date , " weeks" , week_start = 3 )
1818# forecast_generation_date needs to follow suit, but it's more complicated
1919# because sometimes we forecast on Thursday.
20- # forecast_generation_date <- c(as.Date(c("2024-11-20", "2024-11-27", "2024-12-04", "2024-12-11", "2024-12-18", "2024-12-26", "2025-01-02")), seq.Date(as.Date("2025-01-08"), Sys.Date(), by = 7L))
20+ # forecast_generation_date <- c(as.Date(c("2024-11-20", "2024-11-27", "2024-12-04", "2024-12-11", "2024-12-18", "2024-12-26", "2025-01-02")), seq.Date(as.Date("2025-01-08"), Sys.Date(), by = 7L))
2121# If doing backfill, you can set the forecast_date to a sequence of dates.
22- # forecast_date <- seq.Date(as.Date("2024-11-20"), Sys.Date(), by = 7L)
22+ # forecast_date <- seq.Date(as.Date("2024-11-20"), Sys.Date(), by = 7L)
2323
2424forecaster_fns <- list2(
2525 linear = function (epi_data , ahead , extra_data , ... ) {
@@ -82,24 +82,24 @@ rlang::list2(
8282 if (file.exists(here :: here(" .nhsn_covid_cache.parquet" ))) {
8383 previous_result <- qs :: qread(here :: here(" .nhsn_covid_cache.parquet" ))
8484 } else
85- # if something is different, update the file
86- if (! isTRUE(all.equal(previous_result , most_recent_result ))) {
87- qs :: qsave(most_recent_result , here :: here(" .nhsn_covid_cache.parquet" ))
88- } else {
89- qs :: qsave(most_recent_result , here :: here(" .nhsn_covid_cache.parquet" ))
90- }
85+ # if something is different, update the file
86+ if (! isTRUE(all.equal(previous_result , most_recent_result ))) {
87+ qs :: qsave(most_recent_result , here :: here(" .nhsn_covid_cache.parquet" ))
88+ } else {
89+ qs :: qsave(most_recent_result , here :: here(" .nhsn_covid_cache.parquet" ))
90+ }
9191 NULL
9292 },
9393 description = " Download the result, and update the file only if it's actually different" ,
9494 priority = 1 ,
9595 cue = tar_cue(mode = " always" )
96- ),
96+ ),
9797 tar_change(
9898 name = nhsn_latest_data ,
9999 command = {
100- qs :: qread(here :: here(" .nhsn_flu_cache .parquet" ))
100+ qs :: qread(here :: here(" .nhsn_covid_cache .parquet" ))
101101 },
102- change = tools :: md5sum(here :: here(" .nhsn_flu_cache .parquet" ))
102+ change = tools :: md5sum(here :: here(" .nhsn_covid_cache .parquet" ))
103103 ),
104104 tar_target(
105105 name = nhsn_archive_data ,
@@ -116,10 +116,10 @@ rlang::list2(
116116 ),
117117 tar_map(
118118 values = tibble(
119- forecast_date_int = forecast_date ,
120- forecast_generation_date_int = forecast_generation_date ,
121- forecast_date_chr = as.character(forecast_date_int )
122- ),
119+ forecast_date_int = forecast_date ,
120+ forecast_generation_date_int = forecast_generation_date ,
121+ forecast_date_chr = as.character(forecast_date_int )
122+ ),
123123 names = " forecast_date_chr" ,
124124 tar_target(
125125 name = geo_forecasters_weights ,
@@ -196,8 +196,8 @@ rlang::list2(
196196 filter(geo_value %nin % geo_exclusions ) %> %
197197 ungroup() %> %
198198 bind_rows(forecast_res %> %
199- filter(forecaster == " windowed_seasonal_extra_sources" ) %> %
200- filter(forecast_date < target_end_date )) %> % # don't use for neg aheads
199+ filter(forecaster == " windowed_seasonal_extra_sources" ) %> %
200+ filter(forecast_date < target_end_date )) %> % # don't use for neg aheads
201201 group_by(geo_value , forecast_date , target_end_date , quantile ) %> %
202202 summarize(value = mean(value , na.rm = TRUE ), .groups = " drop" ) %> %
203203 sort_by_quantile()
0 commit comments