Skip to content

Commit 7cd135f

Browse files
committed
hotfix: few bugs caught in mentat testing
1 parent 8196dda commit 7cd135f

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ run:
1313
Rscript scripts/run.R
1414

1515
prod-covid:
16-
export TAR_PROJECT=covid_hosp_prod; \
16+
export TAR_RUN_PROJECT=covid_hosp_prod; \
1717
Rscript scripts/run.R
1818

1919
prod-flu:
20-
export TAR_PROJECT=flu_hosp_prod; \
20+
export TAR_RUN_PROJECT=flu_hosp_prod; \
2121
Rscript scripts/run.R
2222

2323
prod: prod-covid prod-flu update_site netlify

scripts/covid_hosp_prod.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ ensemble_targets <- tar_map(
365365
mutate(source = "nhsn as_of forecast") %>%
366366
bind_rows(nhsn_latest_data %>% mutate(source = "nhsn")) %>%
367367
select(geo_value, target_end_date = time_value, value) %>%
368-
filter(target_end_date > truth_data_date, geo_value %nin% insufficient_data_geos)
368+
filter(target_end_date > g_truth_data_date, geo_value %nin% g_insufficient_data_geos)
369369
nssp_data <- nssp_latest_data %>%
370370
select(geo_value, target_end_date = time_value, value = nssp) %>%
371371
filter(target_end_date > g_truth_data_date, geo_value %nin% g_insufficient_data_geos) %>%

scripts/flu_hosp_prod.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ g_windowed_seasonal_extra_sources = function(epi_data, ahead, extra_data, ...) {
9595
drop_non_seasons = TRUE,
9696
pop_scaling = FALSE,
9797
lags = list(c(0, 7), c(0, 7)),
98-
keys_to_ignore = very_latent_locations
98+
keys_to_ignore = g_very_latent_locations
9999
) %>%
100100
select(-source) %>%
101101
mutate(target_end_date = target_end_date + 3) %>%

scripts/get_forecast_data.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ fetch_forecast_files <- function(sync_to_s3 = TRUE, disease) {
129129
for (filename in filenames) {
130130
pb_files$tick(tokens = list(filename = filename))
131131

132-
if (check_github_file(forecaster, filename)) {
133-
forecast_data <- download_forecast_file(forecaster, filename)
132+
if (check_github_file(forecaster, filename, disease)) {
133+
forecast_data <- download_forecast_file(forecaster, filename, disease)
134134
if (!is.null(forecast_data)) {
135135
all_forecasts[[length(all_forecasts) + 1]] <- forecast_data
136136
}

scripts/run.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ suppressPackageStartupMessages(source(here::here("R", "load_all.R")))
2626
# )
2727
# # Save to disk
2828
# saveRDS(scorecards, "exploration-scorecards-2023-10-04.RDS")
29-
tar_project <- Sys.getenv("TAR_PROJECT", "flu_hosp_prod")
29+
30+
# This is TAR_RUN_PROJECT and not TAR_PROJECT, because the latter gets
31+
# overwritten by the environment variable of the same name in the shell that
32+
# runs this script.
33+
tar_project <- Sys.getenv("TAR_RUN_PROJECT", "flu_hosp_prod")
34+
# Where to place files in S3 (mostly unused)
3035
aws_s3_prefix <- Sys.getenv("AWS_S3_PREFIX", "exploration") %>% paste0("/", tar_project)
36+
# Where to place flu forecasts
3137
flu_submission_directory <- Sys.getenv("FLU_SUBMISSION_DIRECTORY", "cache")
38+
# Where to place covid forecasts
3239
covid_submission_directory <- Sys.getenv("COVID_SUBMISSION_DIRECTORY", "cache")
3340
cli::cli_inform(
3441
c(
@@ -41,7 +48,7 @@ cli::cli_inform(
4148
)
4249

4350

44-
# targets needs the output dir to already exist.
51+
# Targets needs the output dir to already exist.
4552
store_dir <- tar_path_store()
4653
if (!dir.exists(store_dir)) dir.create(store_dir)
4754

@@ -70,6 +77,5 @@ restart_loop <- function() {
7077

7178
tar_make(
7279
store = tar_config_get("store", project = tar_project),
73-
script = tar_config_get("script", project = tar_project),
74-
use_crew = TRUE
80+
script = tar_config_get("script", project = tar_project)
7581
)

0 commit comments

Comments
 (0)