Skip to content

Commit 2f0dfa8

Browse files
committed
actually used [2025-01-16]
1 parent 2a3a60a commit 2f0dfa8

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

covid_data_substitutions.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
geo_value, forecast_date, time_value, value
2+
nh, 2025-01-15, 2025-01-11, 150

covid_geo_exclusions.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
forecast_date,forecaster,geo_value,weight
22
# defaults
33
"2024-10-01", "all", "mp", 0
4+
"2024-10-01", "windowed_seasonal", "all", 3
5+
"2024-10-01", "windowed_seasonal_extra_sources", "all", 3
46
"2024-10-01", "linear", "all", 3
57
"2024-10-01", "linearlog", "all", 0
68
"2024-10-01", "climate_base", "all", 2

scripts/covid_hosp_prod.R

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ forecaster_fns <- list2(
5858
fcst
5959
}
6060
)
61+
indices <- seq_along(forecaster_fns)
6162

6263
rlang::list2(
6364
tar_target(aheads, command = -1:3),
64-
tar_target(forecasters, command = seq_along(forecaster_fns)),
65+
tar_target(forecasters, command = indices),
6566
tar_target(
6667
download_latest,
6768
command = {
@@ -121,13 +122,12 @@ rlang::list2(
121122
}
122123
),
123124
tar_map(
124-
values = tidyr::expand_grid(
125-
tibble(
125+
values = tibble(
126126
forecast_date_int = forecast_date,
127-
forecast_generation_date_int = forecast_generation_date
128-
)
129-
),
130-
names = "forecast_date",
127+
forecast_generation_date_int = forecast_generation_date,
128+
forecast_date_chr = as.character(forecast_date_int)
129+
),
130+
names = "forecast_date_chr",
131131
tar_target(
132132
name = geo_forecasters_weights,
133133
command = {
@@ -158,11 +158,16 @@ rlang::list2(
158158
} else {
159159
train_data <-
160160
nhsn_latest_data %>%
161+
select(-version) %>%
161162
data_substitutions(disease = "covid") %>%
162-
as_epi_df(as_of = as.Date(forecast_date_int))
163+
as_epi_df(as_of = as.Date(forecast_date_int)) %>%
164+
mutate(time_value = time_value - 3)
163165
}
164-
nssp <- current_nssp_archive %>% epix_as_of(min(forecast_date, current_nssp_archive$versions_end))
166+
nssp <- current_nssp_archive %>%
167+
epix_as_of(min(forecast_date, current_nssp_archive$versions_end)) %>%
168+
mutate(time_value = time_value)
165169
attributes(train_data)$metadata$as_of <- as.Date(forecast_date_int)
170+
print(names(forecaster_fns[forecasters]))
166171
train_data %>%
167172
forecaster_fns[[forecasters]](ahead = aheads, extra_data = nssp) %>%
168173
mutate(
@@ -199,7 +204,9 @@ rlang::list2(
199204
) %>%
200205
filter(geo_value %nin% geo_exclusions) %>%
201206
ungroup() %>%
202-
bind_rows(forecast_res %>% filter(forecaster == "windowed_seasonal_extra_sources")) %>%
207+
bind_rows(forecast_res %>%
208+
filter(forecaster == "windowed_seasonal_extra_sources") %>%
209+
filter(forecast_date < target_end_date)) %>% # don't use for neg aheads
203210
group_by(geo_value, forecast_date, target_end_date, quantile) %>%
204211
summarize(value = mean(value, na.rm = TRUE), .groups = "drop") %>%
205212
sort_by_quantile()

scripts/flu_hosp_prod.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ rlang::list2(
340340
tar_target(
341341
name = make_submission_csv,
342342
command = {
343-
ensemble_mixture_res %>%
343+
ensemble_res %>%
344344
format_flusight(disease = "flu") %>%
345345
write_submission_file(
346346
get_forecast_reference_date(forecast_date_int),
@@ -360,7 +360,7 @@ rlang::list2(
360360
ungroup() %>%
361361
filter(!(geo_value %in% excluded_geos)) %>%
362362
format_flusight(disease = "flu") %>%
363-
filter(location %nin% c("60", "66", "68")) %>%
363+
filter(location %nin% c("60", "66", "78")) %>%
364364
write_submission_file(
365365
get_forecast_reference_date(forecast_date_int),
366366
submission_directory = file.path(submission_directory, "model-output/CMU-climate_baseline"),

0 commit comments

Comments
 (0)