Skip to content

Commit 87fd65c

Browse files
authored
Merge pull request #57 from cmu-delphi/ds/epidatr-cache
refactor: don't hide caching in package .onLoad
2 parents 67fb0b4 + 681fae6 commit 87fd65c

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

R/epieval-package.R

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,4 @@
44
#' @importFrom purrr transpose map map2_vec
55
#' @keywords internal
66
"_PACKAGE"
7-
globalVariables(c("ahead", "id", "parent_id", "all_of", "last_col", "time_value", "geo_value", "target_end_date", "forecast_date", "quantile", ".pred_distn", "quantiles", "quantile_levels", "signal", ".dstn", "values", ".", "forecasters","forecaster", "trainer", "forecast_date", ".pred", "n_distinct", "target_date", "value"))
8-
.onLoad <- function(libname, pkgname) {
9-
epidatr::set_cache(
10-
cache_dir = ".exploration_cache",
11-
days = 14,
12-
max_size = 4,
13-
confirm = FALSE
14-
)
15-
}
7+
globalVariables(c("ahead", "id", "parent_id", "all_of", "last_col", "time_value", "geo_value", "target_end_date", "forecast_date", "quantile", ".pred_distn", "quantiles", "quantile_levels", "signal", ".dstn", "values", ".", "forecasters", "forecaster", "trainer", "forecast_date", ".pred", "n_distinct", "target_date", "value"))

covid_hosp_explore.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ suppressPackageStartupMessages({
1212
library(tibble)
1313
library(tidyr)
1414
library(rlang)
15+
library(epidatr)
1516
})
1617

1718
# The external scores processing causes the pipeline to exit with an error,
@@ -167,7 +168,7 @@ if (LOAD_EXTERNAL_SCORES) {
167168
command = {
168169
readRDS(external_scores_path) %>%
169170
group_by(forecaster) %>%
170-
targets::tar_group()
171+
tar_group()
171172
},
172173
iteration = "group",
173174
garbage_collection = TRUE

covid_hosp_explore/data_targets.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ data_targets <- local({
22
geo_type <- "state"
33
time_type <- "day"
44
geo_values <- "*"
5-
time_values <- epidatr::epirange(from = "2020-01-01", to = "2024-01-01")
5+
time_values <- epirange(from = "2020-01-01", to = "2024-01-01")
66
fetch_args <- fetch_args_list(return_empty = TRUE, timeout_seconds = 200)
77
issues <- "*"
88

99
list(
1010
tar_target(
1111
name = hhs_latest_data,
1212
command = {
13-
epidatr::pub_covidcast(
13+
pub_covidcast(
1414
source = "hhs",
1515
signals = "confirmed_admissions_covid_1d",
1616
geo_type = geo_type,
@@ -24,7 +24,7 @@ data_targets <- local({
2424
tar_target(
2525
name = chng_latest_data,
2626
command = {
27-
epidatr::pub_covidcast(
27+
pub_covidcast(
2828
source = "chng",
2929
signals = "smoothed_adj_outpatient_covid",
3030
geo_type = geo_type,
@@ -62,7 +62,7 @@ data_targets <- local({
6262
tar_target(
6363
name = hhs_archive_data_2022,
6464
command = {
65-
epidatr::pub_covidcast(
65+
pub_covidcast(
6666
source = "hhs",
6767
signals = "confirmed_admissions_covid_1d",
6868
geo_type = geo_type,
@@ -77,7 +77,7 @@ data_targets <- local({
7777
tar_target(
7878
name = chng_archive_data_2022,
7979
command = {
80-
epidatr::pub_covidcast(
80+
pub_covidcast(
8181
source = "chng",
8282
signals = "smoothed_adj_outpatient_covid",
8383
geo_type = geo_type,

flu_hosp_explore.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tar_option_set(
3131
imports = c("epieval", "parsnip"),
3232
format = "qs", # Optionally set the default storage format. qs is fast.
3333
controller = crew::crew_controller_local(workers = parallel::detectCores() - 5),
34-
)
34+
)
3535
# Run the R scripts in the R/ folder with your custom functions:
3636
# tar_source()
3737
linreg <- parsnip::linear_reg()

0 commit comments

Comments
 (0)