Skip to content

Commit 959e5e7

Browse files
committed
adapting nssp to halfway forecaster
1 parent 2f0dfa8 commit 959e5e7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

scripts/covid_hosp_prod.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ rlang::list2(
245245
summarize(forecast_date = first(forecast_date), value = mean(value, na.rm = TRUE), .groups = "drop") %>%
246246
ungroup() %>%
247247
format_flusight(disease = "covid") %>%
248+
filter(location %nin% c("60", "66", "78")) %>%
248249
write_submission_file(
249250
get_forecast_reference_date(forecast_date_int),
250251
submission_directory = file.path(submission_directory, "model-output/CMU-climate_baseline"),

scripts/flu_hosp_prod.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ rlang::list2(
212212
} else {
213213
train_data <- nhsn_latest_data
214214
}
215-
nssp <- current_nssp_archive %>% epix_as_of(min(forecast_date, current_nssp_archive$versions_end))
216215
full_data <- train_data %>%
217216
bind_rows(joined_latest_extra_data)
218217
attributes(full_data)$metadata$other_keys <- "source"
@@ -223,6 +222,8 @@ rlang::list2(
223222
tar_target(
224223
forecast_res,
225224
command = {
225+
forecast_date <- as.Date(forecast_date_int)
226+
nssp <- current_nssp_archive %>% epix_as_of(min(forecast_date, current_nssp_archive$versions_end))
226227
full_data %>%
227228
forecaster_fns[[forecasters]](ahead = aheads, extra_data = nssp) %>%
228229
mutate(
@@ -239,6 +240,8 @@ rlang::list2(
239240
command = {
240241
as_of <- attributes(full_data)$metadata$as_of
241242
other_keys <- attributes(full_data)$metadata$other_keys
243+
forecast_date <- as.Date(forecast_date_int)
244+
nssp <- current_nssp_archive %>% epix_as_of(min(forecast_date, current_nssp_archive$versions_end))
242245

243246
# Smooth last few points for every geo.
244247
# TODO: This is a hack, we can try some more sophisticated
@@ -256,7 +259,7 @@ rlang::list2(
256259
attributes(modified_full_data)$metadata$as_of <- as_of
257260
attributes(modified_full_data)$metadata$other_keys <- other_keys
258261
modified_full_data %>%
259-
forecaster_fns[[forecasters]](ahead = aheads) %>%
262+
forecaster_fns[[forecasters]](ahead = aheads, extra_data = nssp) %>%
260263
mutate(
261264
forecaster = names(forecaster_fns[forecasters]),
262265
geo_value = as.factor(geo_value)

0 commit comments

Comments
 (0)