Skip to content

Commit c00036c

Browse files
committed
fix: covid prod good to go
1 parent 6de0f80 commit c00036c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scripts/covid_hosp_prod.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ truth_data_date <- "2023-09-01"
1212
# today, which is a Wednesday. Sometimes, if we're doing a delayed forecast,
1313
# it's a Thursday. It's used for stamping the data and for determining the
1414
# appropriate as_of when creating the forecast.
15-
forecast_generation_dates <- Sys.Date() - 6
15+
forecast_generation_dates <- Sys.Date()
1616
# Usually, the forecast_date is the same as the generation date, but you can
1717
# override this. It should be a Wednesday.
1818
forecast_dates <- round_date(forecast_generation_dates, "weeks", week_start = 3)
@@ -263,23 +263,24 @@ ensemble_targets <- tar_map(
263263
tar_target(
264264
name = make_submission_csv,
265265
command = {
266-
if (!backtest_mode) {
266+
if (!backtest_mode && submission_directory != "cache") {
267267
forecast_reference_date <- get_forecast_reference_date(forecast_date_int)
268268
ensemble_mixture_res %>%
269269
format_flusight(disease = "covid") %>%
270270
write_submission_file(forecast_reference_date, file.path(submission_directory, "model-output/CMU-TimeSeries"))
271+
} else {
272+
cli_alert_info("Not making submission csv because we're in backtest mode or submission directory is cache")
271273
}
272274
},
273275
),
274276
tar_target(
275277
name = make_climate_submission_csv,
276278
command = {
277-
if (!backtest_mode) {
278-
forecasts <- forecast_res
279-
forecasts %>%
279+
if (!backtest_mode && submission_directory != "cache") {
280+
forecast_full_filtered %>%
280281
filter(forecaster %in% c("climate_base", "climate_geo_agged")) %>%
281282
group_by(geo_value, target_end_date, quantile) %>%
282-
summarize(forecast_date = first(forecast_dates), value = mean(value, na.rm = TRUE), .groups = "drop") %>%
283+
summarize(value = mean(value, na.rm = TRUE), .groups = "drop") %>%
283284
ungroup() %>%
284285
format_flusight(disease = "covid") %>%
285286
filter(location %nin% c("60", "66", "78")) %>%
@@ -288,6 +289,8 @@ ensemble_targets <- tar_map(
288289
submission_directory = file.path(submission_directory, "model-output/CMU-climate_baseline"),
289290
file_name = "CMU-climate_baseline"
290291
)
292+
} else {
293+
cli_alert_info("Not making climate submission csv because we're in backtest mode or submission directory is cache")
291294
}
292295
},
293296
),

0 commit comments

Comments
 (0)