Skip to content

Commit 31e9222

Browse files
committed
fix: a few bugs and update exclusions
1 parent 3f88516 commit 31e9222

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

R/utils.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ get_exclusions <- function(
156156

157157
data_substitutions <- function(dataset, disease, forecast_generation_date) {
158158
disease <- "flu"
159-
forecast_generation_date <- as.Date("2025-01-08")
160159
substitutions <- readr::read_csv(
161160
glue::glue("{disease}_data_substitutions.csv"),
162161
comment = "#",

covid_geo_exclusions.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ forecast_date,forecaster,geo_value,weight
88
"2024-10-01", "climate_base", "all", 2
99
"2024-10-01", "climate_geo_agged", "all", 0.5
1010
"2024-10-01", "climate_quantile_extrapolated", "all", 0
11+
# feb 12
12+
2025-02-05, all, mp, 0
13+
2025-02-05, windowed_seasonal, all, 3
14+
2025-02-05, windowed_seasonal_extra_sources, all, 0.0
15+
2025-02-05, linear, all, 0.5
16+
2025-02-05, linearlog, all, 0
17+
2025-02-05, climate_base, all, 0
18+
2025-02-05, climate_geo_agged, all, 0.0
1119
# feb 5
1220
2025-02-05, all, mp, 0
1321
2025-02-05, windowed_seasonal, all, 3

flu_data_substitutions.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
geo_value, forecast_date, time_value, value
22
sd, 2025-01-08, 2025-01-01, 33
33
id, 2025-01-08, 2025-01-01, 323
4+
az, 2025-02-12, 2025-02-12, 850
5+
de, 2025-02-12, 2025-02-12, 120
6+
id, 2025-02-12, 2025-02-12, 150
7+
nm, 2025-02-12, 2025-02-12, 200

scripts/covid_hosp_prod.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ forecast_targets <- tar_map(
157157
} else {
158158
train_data <-
159159
nhsn_latest_data %>%
160-
data_substitutions(disease = "covid") %>%
160+
data_substitutions(disease = "covid", last(forecast_generation_dates)) %>%
161161
as_epi_df(as_of = as.Date(forecast_date_int)) %>%
162162
mutate(time_value = time_value - 3)
163163
}
@@ -280,7 +280,7 @@ ensemble_targets <- tar_map(
280280
forecast_full_filtered %>%
281281
filter(forecaster %in% c("climate_base", "climate_geo_agged")) %>%
282282
group_by(geo_value, target_end_date, quantile) %>%
283-
summarize(value = mean(value, na.rm = TRUE), .groups = "drop") %>%
283+
summarize(forecast_date = as.Date(forecast_date_int), value = mean(value, na.rm = TRUE), .groups = "drop") %>%
284284
ungroup() %>%
285285
format_flusight(disease = "covid") %>%
286286
filter(location %nin% c("60", "66", "78")) %>%
@@ -299,7 +299,7 @@ ensemble_targets <- tar_map(
299299
command = {
300300
make_submission_csv
301301
# only validate if we're saving the result to a hub
302-
if (submission_directory != "cache") {
302+
if (!backtest_mode && submission_directory != "cache") {
303303
validation <- validate_submission(
304304
submission_directory,
305305
file_path = sprintf("CMU-TimeSeries/%s-CMU-TimeSeries.csv", get_forecast_reference_date(forecast_date_int))
@@ -315,7 +315,7 @@ ensemble_targets <- tar_map(
315315
command = {
316316
make_climate_submission_csv
317317
# only validate if we're saving the result to a hub
318-
if (submission_directory != "cache" && submit_climatological) {
318+
if (!backtest_mode && submission_directory != "cache") {
319319
validation <- validate_submission(
320320
submission_directory,
321321
file_path = sprintf("CMU-climate_baseline/%s-CMU-climate_baseline.csv", get_forecast_reference_date(forecast_date_int))

scripts/flu_hosp_prod.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ rlang::list2(
156156
) %>%
157157
filter(version == max(version)) %>%
158158
select(-version) %>%
159-
data_substitutions(disease = "flu") %>%
159+
data_substitutions(disease = "flu", last(forecast_generation_dates)) %>%
160160
as_epi_df(other_keys = "source", as_of = Sys.Date())
161161
most_recent_result
162162
},
@@ -383,7 +383,7 @@ rlang::list2(
383383
command = {
384384
make_submission_csv
385385
# only validate if we're saving the result to a hub
386-
if (submission_directory != "cache") {
386+
if (!backtest_mode && submission_directory != "cache") {
387387
validation <- validate_submission(
388388
submission_directory,
389389
file_path = sprintf("CMU-TimeSeries/%s-CMU-TimeSeries.csv", get_forecast_reference_date(forecast_date_int))
@@ -399,7 +399,7 @@ rlang::list2(
399399
command = {
400400
make_climate_submission_csv
401401
# only validate if we're saving the result to a hub
402-
if (submission_directory != "cache" && submit_climatological) {
402+
if (!backtest_mode && submission_directory != "cache") {
403403
validation <- validate_submission(
404404
submission_directory,
405405
file_path = sprintf("CMU-climate_baseline/%s-CMU-climate_baseline.csv", get_forecast_reference_date(forecast_date_int))

0 commit comments

Comments
 (0)