Skip to contents

This function pulls, formats and saves NHSN and NSSP data for use in the Hub. It combines both data sources with any existing data and writes to the target-data directory.

Usage

update_hub_target_data(
  base_hub_path,
  disease,
  as_of = lubridate::today(),
  start_date = lubridate::as_date("2024-11-09"),
  excluded_locations = NULL,
  legacy_file = FALSE,
  nssp_update_local = FALSE,
  overwrite_existing = FALSE
)

Arguments

base_hub_path

Path to the base hub directory.

disease

Disease name ("covid" or "rsv").

as_of

As-of date of the data pull. Default is the system date as determined by lubridate::today().

start_date

First week-ending date to include for the NHSN dataset. Default value is "2024-11-09".

excluded_locations

NULL, character vector, or named list of US state/territory abbreviations to exclude. If a character vector, locations are excluded across all targets. If a named list, names should be target names (or "all" for global exclusions) mapping to character vectors of abbreviations. Default: NULL (no exclusions).

legacy_file

Logical. Whether to write legacy CSV output (default: FALSE).

nssp_update_local

Logical. Whether to update NSSP data from local hub file auxiliary-data/latest.parquet (default: FALSE).

overwrite_existing

Logical. If TRUE, overwrite existing rows that share key columns (target_end_date, location, as_of, target) with the new data. If FALSE (default), error if any conflicts are found.

Value

Writes time-series.parquet and optionally legacy CSV target data files to the target-data directory in the hub.