Skip to content

Commit ddfcbc4

Browse files
authored
Merge pull request #198 from cmu-delphi/release_v4.2.0
Release v4.2.0
2 parents 534dab3 + ef03c26 commit ddfcbc4

File tree

5 files changed

+33
-20
lines changed

5 files changed

+33
-20
lines changed

.github/workflows/s3_upload_ec2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ env:
66
# Controls when the action will run.
77
on:
88
schedule:
9-
- cron: '0 14 * * MON-TUE' # every Monday and Tuesday at 9amET
9+
- cron: '0 14 * * SUN,MON,TUE' # every Monday and Tuesday at 10amET
1010

1111
# Allows you to run this workflow manually from the Actions tab
1212
workflow_dispatch:

DESCRIPTION

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
Package: forecast-eval
22
Title: Forecast Evaluation Dashboard
3-
Version: 4.1
4-
Authors@R: person("Kate", "Harwood",
5-
role = c("cre")),
6-
person("Chris", "Scott",
7-
role = c("cre")),
8-
person("Jed", "Grabman",
9-
role = c("cre"))
3+
Version: 4.2.0
4+
Authors@R: c(person("Kate", "Harwood", email = "[email protected]", role = "cre"),
5+
person("Chris", "Scott", role = "ctb"),
6+
person("Jed", "Grabman", role = "ctb"))
107
Description: This app collects and scores COVID-19 forecasts submitted to the CDC and displays the results in an RShiny dashboard.
118
License: MIT License, Copyright (c) 2021 Delphi contributors

dashboard/app.R

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,22 @@ library(tsibble)
1010
library(aws.s3)
1111
library(covidcast)
1212
library(stringr)
13+
library(memoise)
1314

1415
source('./common.R')
1516

17+
# Set application-level caching location. Stores up to 1GB of caches. Removes
18+
# least recently used objects first.
19+
shinyOptions(cache = cachem::cache_mem(max_size = 1000 * 1024^2, evict="lru"))
20+
cache <- getShinyOption("cache")
21+
22+
# Since covidcast data updates about once a day. Add date arg to
23+
# covidcast_signal so caches aren't used after that.
24+
covidcast_signal_mem <- function(..., date=Sys.Date()) {
25+
return(covidcast_signal(...))
26+
}
27+
covidcast_signal_mem <- memoise(covidcast_signal_mem, cache = cache)
28+
1629
# All data is fully loaded from AWS
1730
DATA_LOADED = FALSE
1831

@@ -88,7 +101,7 @@ ui <- fluidPage(padding=0, title="Forecast Eval Dashboard",
88101
"Log Scale",
89102
value = FALSE,
90103
)),
91-
conditionalPanel(condition = "input.scoreType != 'coverage' && input.targetVariable != 'Hospitalizations'",
104+
conditionalPanel(condition = "input.scoreType != 'coverage'",
92105
checkboxInput(
93106
"scaleByBaseline",
94107
"Scale by Baseline Forecaster",
@@ -321,16 +334,15 @@ server <- function(input, output, session) {
321334

322335
# Get most recent target end date
323336
# Prev Saturday for Cases and Deaths, prev Wednesday for Hospitalizations
324-
# Since we don't upload new observed data until Monday:
325-
# Use 8 and 2 for Cases and Deaths so that Sundays will not use the Saturday directly beforehand
326-
# since we don't have data for it yet.
327-
# Use 5 and 11 for Hospitalizations since Thurs-Sun should also not use the Wednesday directly beforehand.
328-
# (This means that on Mondays until the afternoon when pipeline completes, the "as of" will show
329-
# most recent Saturday / Wednesday date even though the actual updated data won't be there yet)
330-
prevWeek <- seq(Sys.Date()-8,Sys.Date()-2,by='day')
337+
# Since we don't upload new observed data until Sunday:
338+
# Use 7 and 1 for Cases and Deaths so that Sundays will use the Saturday directly beforehand.
339+
# Use 4 and 10 for Hospitalizations since Thurs-Sat should not use the Wednesday directly beforehand.
340+
# (This means that on Sundays until the afternoon when the pipeline completes, the "as of" will show
341+
# the most recent Saturday / Wednesday date even though the actual updated data won't be there yet)
342+
prevWeek <- seq(Sys.Date()-7,Sys.Date()-1,by='day')
331343
CASES_DEATHS_CURRENT = prevWeek[weekdays(prevWeek)=='Saturday']
332344
CURRENT_WEEK_END_DATE = reactiveVal(CASES_DEATHS_CURRENT)
333-
prevHospWeek <- seq(Sys.Date()-11,Sys.Date()-5,by='day')
345+
prevHospWeek <- seq(Sys.Date()-10,Sys.Date()-4,by='day')
334346
HOSP_CURRENT = prevHospWeek[weekdays(prevHospWeek)=='Wednesday']
335347

336348
# Get scores
@@ -469,7 +481,7 @@ server <- function(input, output, session) {
469481
filteredScoreDf = filteredScoreDf[c("Forecaster", "Forecast_Date", "Week_End_Date", "Score", "ahead")]
470482
filteredScoreDf = filteredScoreDf %>% mutate(across(where(is.numeric), ~ round(., 2)))
471483
if (input$scoreType != 'coverage') {
472-
if (input$scaleByBaseline && input$targetVariable != "Hospitalizations") {
484+
if (input$scaleByBaseline) {
473485
baselineDf = filteredScoreDf %>% filter(Forecaster %in% 'COVIDhub-baseline')
474486
filteredScoreDfMerged = merge(filteredScoreDf, baselineDf, by=c("Week_End_Date","ahead"))
475487
# Scaling score by baseline forecaster
@@ -915,7 +927,7 @@ server <- function(input, output, session) {
915927
fetchDate = as.Date(input$asOf) + 1
916928

917929
# Covidcast API call
918-
asOfTruthData = covidcast_signal(data_source = dataSource, signal = targetSignal,
930+
asOfTruthData = covidcast_signal_mem(data_source = dataSource, signal = targetSignal,
919931
start_day = "2020-02-15", end_day = fetchDate,
920932
as_of = fetchDate,
921933
geo_type = location)

docker_dashboard/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ RUN install2.r --error \
1414
aws.s3 \
1515
covidcast \
1616
stringr \
17-
markdown
17+
markdown \
18+
memoise
1819

1920
COPY dist/*rds /srv/shiny-server/
2021
COPY dashboard/* /srv/shiny-server/

docker_dashboard/shiny_server.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ server {
1919
# Disable some network protocols that are causing issues
2020
disable_protocols websocket xdr-streaming xhr-streaming iframe-eventsource iframe-htmlfile;
2121

22+
# Set app timeout threshold to 4 hours
23+
app_idle_timeout 14400;
24+
2225
}
2326
}

0 commit comments

Comments
 (0)