Skip to content

Commit f55cb00

Browse files
authored
Merge pull request #201 from cmu-delphi/seasonSummaryPresentation
season summary presentation
2 parents 742c31a + d677aeb commit f55cb00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+43858
-686
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: System dependencies
4040
run: |
41-
sudo apt-get update && sudo apt-get -y install libglpk-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
41+
sudo apt-get update && sudo apt-get -y install libglpk-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev libharfbuzz-dev libfribidi-dev
4242
4343
- uses: r-lib/actions/setup-renv@v2
4444

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ data/
2323
.nhsn_flu_cache.parquet
2424
meta/
2525
**/unnamed-chunk*
26-
decreasing_forecasters_cache/
26+
decreasing_forecasters_cache/
27+
reports/tachyons-minimal.css
28+
reports/season_summary_2025_presentation_files/
29+
reports/gfx/
30+
scripts/reports/season_2025_talk/season_summary_2025_presentation_files/
31+
scripts/reports/season_2025_talk/season_summary_2025_presentation.html
32+
scripts/reports/season_2025_talk/season_summary_2025_presentation_cache/
33+
test_proj

.renvignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ local_logs/
44
.github
55
.exploration_cache
66
.netlify
7+
.git
78
aux_data
89
cache/
910
covid_hosp_explore

Makefile

Lines changed: 77 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1+
.PHONY: all test test-forecasters run sync download upload dashboard
2+
13
current_date:=$(shell date +%F)
24

35
install:
46
Rscript -e "install.packages(c('renv', 'pak', 'rspm')); renv::restore()"
57

6-
.PHONY: all test test-forecasters run run-nohup sync download upload dashboard
7-
88
test:
99
Rscript -e "testthat::test_dir('tests/testthat')"
1010

1111
run:
1212
Rscript scripts/run.R
1313

14-
run-nohup:
15-
nohup Rscript scripts/run.R &
16-
17-
run-nohup-restarting:
18-
scripts/hardRestarting.sh &
19-
2014
prod-covid:
2115
export TAR_RUN_PROJECT=covid_hosp_prod; Rscript scripts/run.R
2216

@@ -25,6 +19,14 @@ prod-flu:
2519

2620
prod: prod-covid prod-flu update-site netlify
2721

22+
prod-covid-backtest:
23+
export BACKTEST_MODE=TRUE; export TAR_RUN_PROJECT=covid_hosp_prod; Rscript scripts/run.R
24+
25+
prod-flu-backtest:
26+
export BACKTEST_MODE=TRUE; export TAR_RUN_PROJECT=flu_hosp_prod; Rscript scripts/run.R
27+
28+
prod-backtest: prod-covid-backtest prod-flu-backtest
29+
2830
explore-covid:
2931
export TAR_RUN_PROJECT=covid_hosp_explore; Rscript scripts/run.R
3032

@@ -33,6 +35,20 @@ explore-flu:
3335

3436
explore: explore-covid explore-flu update-site netlify
3537

38+
prune: prune-covid-prod prune-flu-prod prune-covid-explore prune-flu-explore
39+
40+
prune-covid-prod:
41+
export TAR_PROJECT=covid_hosp_prod; export BACKTEST_MODE=TRUE; Rscript -e "targets::tar_prune()"
42+
43+
prune-flu-prod:
44+
export TAR_PROJECT=flu_hosp_prod; export BACKTEST_MODE=TRUE; Rscript -e "targets::tar_prune()"
45+
46+
prune-covid-explore:
47+
export TAR_PROJECT=covid_hosp_explore; Rscript -e "targets::tar_prune()"
48+
49+
prune-flu-explore:
50+
export TAR_PROJECT=flu_hosp_explore; Rscript -e "targets::tar_prune()"
51+
3652
commit-covid:
3753
cd ../covid19-forecast-hub; \
3854
git pull --rebase --autostash origin main; \
@@ -50,15 +66,19 @@ commit-flu:
5066
git push --force delphi main
5167

5268
submit-covid: commit-covid
53-
gh pr create --title "CMU-TimeSeries $(current_date)" --repo cdcgov/covid19-forecast-hub
69+
cd ../covid19-forecast-hub; \
70+
gh pr create --title "CMU-TimeSeries $(current_date)" --repo CDCgov/covid19-forecast-hub
5471

5572
submit-flu: commit-flu
73+
cd ../FluSight-forecast-hub; \
5674
gh pr create --title "CMU-TimeSeries $(current_date)" --repo cdcepi/FluSight-forecast-hub
5775

5876
submit-covid-dry: commit-covid
59-
gh pr create --title "CMU-TimeSeries $(current_date)" --repo cdcgov/covid19-forecast-hub --dry-run
77+
cd ../covid19-forecast-hub; \
78+
gh pr create --title "CMU-TimeSeries $(current_date)" --repo CDCgov/covid19-forecast-hub --dry-run
6079

6180
submit-flu-dry: commit-flu
81+
cd ../FluSight-forecast-hub; \
6282
gh pr create --title "CMU-TimeSeries $(current_date)" --repo cdcepi/FluSight-forecast-hub --dry-run
6383

6484
submit: submit-covid submit-flu
@@ -71,23 +91,49 @@ get-nwss:
7191
python nwss_covid_export.py; \
7292
python nwss_influenza_export.py
7393

74-
sync:
75-
Rscript -e "source('R/sync_aws.R'); sync_aws()"
94+
pull-aux-data:
95+
aws s3 sync s3://forecasting-team-data/2024/aux_data/ aux_data/ --delete
96+
97+
pull-covid-prod:
98+
aws s3 sync s3://forecasting-team-data/2024/covid_hosp_prod/ covid_hosp_prod/ --delete
99+
100+
pull-flu-prod:
101+
aws s3 sync s3://forecasting-team-data/2024/flu_hosp_prod/ flu_hosp_prod/ --delete
102+
103+
pull-covid-explore:
104+
aws s3 sync s3://forecasting-team-data/2024/covid_hosp_explore/ covid_hosp_explore/ --delete
105+
106+
pull-flu-explore:
107+
aws s3 sync s3://forecasting-team-data/2024/flu_hosp_explore/ flu_hosp_explore/ --delete
108+
109+
pull: pull-aux-data pull-covid-prod pull-flu-prod pull-covid-explore pull-flu-explore
76110

77-
pull:
78-
Rscript -e "source('R/sync_aws.R'); sync_aws(direction = 'download')"
111+
download: pull
79112

80-
download:pull
113+
push-covid-prod:
114+
aws s3 sync covid_hosp_prod/ s3://forecasting-team-data/2024/covid_hosp_prod/ --delete
81115

82-
push:
83-
Rscript -e "source('R/sync_aws.R'); sync_aws(direction = 'upload')"
116+
push-flu-prod:
117+
aws s3 sync flu_hosp_prod/ s3://forecasting-team-data/2024/flu_hosp_prod/ --delete
118+
119+
push-covid-explore:
120+
aws s3 sync covid_hosp_explore/ s3://forecasting-team-data/2024/covid_hosp_explore/ --delete
121+
122+
push-flu-explore:
123+
aws s3 sync flu_hosp_explore/ s3://forecasting-team-data/2024/flu_hosp_explore/ --delete
124+
125+
push: push-covid-prod push-flu-prod push-covid-explore push-flu-explore
84126

85127
upload: push
86128

87129
dashboard:
88130
Rscript scripts/dashboard.R
89131

90-
update-site:
132+
sync-reports:
133+
aws s3 sync s3://forecasting-team-data/2024/reports/ reports/; \
134+
aws s3 sync reports/ s3://forecasting-team-data/2024/reports/
135+
136+
update-site: sync-reports
91137
Rscript -e "suppressPackageStartupMessages(source(here::here('R', 'load_all.R'))); update_site()" > cache/update_site_log.txt
92138

93139
netlify:
@@ -99,5 +145,16 @@ get-flu-prod-errors:
99145
get-covid-prod-errors:
100146
Rscript -e "suppressPackageStartupMessages(source(here::here('R', 'load_all.R'))); get_targets_errors(project = 'covid_hosp_prod')"
101147

102-
summary_reports:
103-
Rscript scripts/summary_reports.R
148+
summary-reports:
149+
Rscript -e "rmarkdown::render('scripts/reports/revision_summary_report_2025.Rmd', output_file = here::here('reports', 'revision_summary_2025.html'))"; \
150+
Rscript -e "rmarkdown::render('scripts/reports/decreasing_forecasters.Rmd', output_file = here::here('reports', 'decreasing_forecasters.html'))"; \
151+
Rscript -e "rmarkdown::render('scripts/reports/season_summary_2025.Rmd', output_file = here::here('reports', 'season_summary_2025.html'))"; \
152+
Rscript -e "rmarkdown::render('scripts/reports/first_day_wrong.Rmd', output_file = here::here('reports', 'first_day_wrong.html'))";
153+
154+
season-summary-2025-talk:
155+
quarto render scripts/reports/season_2025_talk/season_summary_2025_presentation.qmd --to revealjs --output-dir "../../../reports"; \
156+
cp scripts/reports/season_2025_talk/tachyons-minimal.css reports/; \
157+
cp -r scripts/reports/season_2025_talk/gfx reports/
158+
159+
season-summary-2025-talk-preview:
160+
quarto preview scripts/reports/season_2025_talk/season_summary_2025_presentation.qmd

NAMESPACE

Lines changed: 0 additions & 118 deletions
This file was deleted.

R/aux_data_utils.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ drop_non_seasons <- function(epi_data, min_window = 12) {
280280

281281
get_nwss_coarse_data <- function(disease = c("covid", "flu")) {
282282
disease <- arg_match(disease)
283-
aws.s3::get_bucket_df(prefix = glue::glue("exploration/aux_data/nwss_{disease}_data"), bucket = "forecasting-team-data") %>%
283+
aws.s3::get_bucket_df(prefix = glue::glue("2024/aux_data/nwss_{disease}_data"), bucket = "forecasting-team-data") %>%
284284
slice_max(LastModified) %>%
285285
pull(Key) %>%
286286
aws.s3::s3read_using(FUN = readr::read_csv, object = ., bucket = "forecasting-team-data")
@@ -312,13 +312,14 @@ add_hhs_region_sum <- function(archive_data_raw, hhs_region_table) {
312312
archive_data_raw
313313
}
314314

315-
#' hhs data in covidcast currently
315+
#' Get versioned NHSN data from healthdata.gov because covidcast API has
316+
#' incorrect historical data for 2023-2024 season.
316317
get_health_data <- function(as_of, disease = c("covid", "flu")) {
317318
as_of <- as.Date(as_of)
318319
disease <- arg_match(disease)
319320
checkmate::assert_date(as_of, min.len = 1, max.len = 1)
320321

321-
cache_path <- here::here("aux_data", "healthdata")
322+
cache_path <- here::here("cache", "healthdata")
322323
if (!dir.exists(cache_path)) {
323324
dir.create(cache_path, recursive = TRUE)
324325
}

R/forecasters/data_transforms.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,15 @@ compute_pca <- function(epi_data, disease = "flu", ahead = 0, scale_method = "qu
353353
used_data <- epi_data %>%
354354
filter(time_value < filter_time) %>%
355355
select(geo_value, season, source, season_week, hhs)
356-
cache_file_path <- paste0(
357-
"aux_data/seasonal_features/",
358-
disease[grepl("flu|covid", disease)],
359-
rlang::hash(used_data),
360-
".parquet",
361-
sep = "_"
356+
cache_file_path <- here::here(
357+
"cache",
358+
"seasonal_features",
359+
paste0(
360+
disease[grepl("flu|covid", disease)],
361+
rlang::hash(used_data),
362+
".parquet",
363+
sep = "_"
364+
)
362365
)
363366
if (file.exists(cache_file_path)) {
364367
seasonal_features <- qs::qread(cache_file_path)

R/looping.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ slide_forecaster <- function(epi_archive,
8888
epix_slide_simple <- function(epi_archive, forecaster, ref_time_values, before = Inf, cache_key = NULL) {
8989
# this is so that changing the object without changing the name doesn't result in pulling the wrong cache
9090
cache_hash <- rlang::hash(epi_archive)
91-
dir.create(".exploration_cache/slide_cache", showWarnings = FALSE, recursive = TRUE)
91+
dir.create("cache/slide_cache", showWarnings = FALSE, recursive = TRUE)
9292
out <- purrr::map(ref_time_values, function(tv) {
9393
if (is.null(cache_key)) {
9494
epi_df <- epi_archive %>%
9595
epix_as_of(min(tv, .$versions_end), min_time_value = tv - before)
9696
} else {
97-
file_path <- glue::glue(".exploration_cache/slide_cache/{cache_key}_{cache_hash}_{before}_{tv}.parquet")
97+
file_path <- glue::glue("cache/slide_cache/{cache_key}_{cache_hash}_{before}_{tv}.parquet")
9898
if (file.exists(file_path)) {
9999
epi_df <- qs::qread(file_path)
100100
} else {

0 commit comments

Comments
 (0)