Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions app/R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,13 @@ getAllData <- function(loadFile) {
covCols
)

dfStateCases <- dfStateCases %>% select(all_of(expectedCols))
dfStateDeaths <- dfStateDeaths %>% select(all_of(expectedCols))
dfStateHospitalizations <- dfStateHospitalizations %>% select(all_of(expectedCols))
dfNationCases <- dfNationCases %>% select(all_of(expectedCols))
dfNationDeaths <- dfNationDeaths %>% select(all_of(expectedCols))
dfNationHospitalizations <- dfNationHospitalizations %>% select(all_of(expectedCols))

df <- rbind(
dfStateCases, dfStateDeaths, dfStateHospitalizations,
dfNationCases, dfNationDeaths, dfNationHospitalizations
df <- bind_rows(
dfStateCases %>% select(all_of(expectedCols)),
dfStateDeaths %>% select(all_of(expectedCols)),
dfStateHospitalizations %>% select(all_of(expectedCols)),
dfNationCases %>% select(all_of(expectedCols)),
dfNationDeaths %>% select(all_of(expectedCols)),
dfNationHospitalizations %>% select(all_of(expectedCols))
)
df <- df %>% rename(
"10" = cov_10, "20" = cov_20, "30" = cov_30,
Expand Down
45 changes: 26 additions & 19 deletions app/R/data_manipulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,31 @@ filterHospitalizationsAheads <- function(scoreDf) {
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[1])
twoAheadDf <- scoreDf %>%
filter(ahead >= 7 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 14 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[2])
threeAheadDf <- scoreDf %>%
filter(ahead >= 14 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 21 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[3])
fourAheadDf <- scoreDf %>%
filter(ahead >= 21 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 28 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[4])

return(rbind(oneAheadDf, twoAheadDf, threeAheadDf, fourAheadDf))
return(bind_rows(
scoreDf %>%
filter(ahead >= HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 7 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[1]),
scoreDf %>%
filter(ahead >= 7 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 14 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[2]),
scoreDf %>%
filter(ahead >= 14 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 21 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[3]),
scoreDf %>%
filter(ahead >= 21 + HOSPITALIZATIONS_OFFSET) %>%
filter(ahead < 28 + HOSPITALIZATIONS_OFFSET) %>%
group_by(target_end_date, forecaster) %>%
filter(ahead == min(ahead)) %>%
mutate(ahead = HOSPITALIZATIONS_AHEAD_OPTIONS[4])
))
}
12 changes: 11 additions & 1 deletion app/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library(viridis)
library(tsibble)
library(covidcast)

appVersion <- "5.0.0"
appVersion <- "5.1.0"

COVERAGE_INTERVALS <- c("10", "20", "30", "40", "50", "60", "70", "80", "90", "95", "98")
DEATH_FILTER <- "deaths_incidence_num"
Expand All @@ -29,6 +29,16 @@ HOSPITALIZATIONS_AHEAD_OPTIONS <- c(
HOSPITALIZATIONS_OFFSET + 14, HOSPITALIZATIONS_OFFSET + 21
)

# Sets the previous target to be the same as the first one, Deaths
PREV_TARGET <- "Deaths"

# When RE_RENDER_TRUTH = TRUE
# summaryPlot will be called only to update TruthPlot
RE_RENDER_TRUTH <- FALSE

# USE_CURR_TRUTH indicates when we can use the previous TruthPlot
USE_CURR_TRUTH <- FALSE

# Earliest 'as of' date available from covidcast API
MIN_AVAIL_NATION_AS_OF_DATE <- as.Date("2020-04-02")
MIN_AVAIL_HOSP_AS_OF_DATE <- as.Date("2020-11-16")
Expand Down
Loading