Skip to content

Commit dedf8d6

Browse files
authored
Add As-Of Argument To Generate Hub Baseline Function (#68)
1 parent b637363 commit dedf8d6

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repos:
5454
args: ['--baseline', '.secrets.baseline']
5555
exclude: package.lock.json
5656
- repo: https://github.com/crate-ci/typos
57-
rev: v1
57+
rev: v1.39.1
5858
hooks:
5959
- id: typos
6060
args: ["--force-exclude"]

R/generate_hub_baselines.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,16 @@ make_baseline_forecast <- function(
181181
#' @param base_hub_path Path to the base hub directory.
182182
#' @param reference_date Reference date (should be a Saturday).
183183
#' @param disease Disease name ("covid" or "rsv").
184+
#' @param as_of As of date to filter to, as an object
185+
#' coercible by as.Date(), or "latest" to filter to the
186+
#' most recent available vintage. Default "latest".
184187
#' @return NULL. Writes baseline forecast file to hub's model-output directory.
185188
#' @export
186189
generate_hub_baseline <- function(
187190
base_hub_path,
188191
reference_date,
189-
disease
192+
disease,
193+
as_of = "latest"
190194
) {
191195
checkmate::assert_scalar(disease)
192196
checkmate::assert_names(disease, subset.of = c("covid", "rsv"))
@@ -213,7 +217,7 @@ generate_hub_baseline <- function(
213217

214218
hub_target_data <- hubData::connect_target_timeseries(base_hub_path) |>
215219
dplyr::collect() |>
216-
forecasttools::hub_target_data_as_of()
220+
forecasttools::hub_target_data_as_of(as_of)
217221

218222
preds_hosp <- make_baseline_forecast(
219223
target_data = hub_target_data,

man/generate_hub_baseline.Rd

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)