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_nhsn = NULL,
  start_date_nssp = NULL,
  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_nhsn

Earliest week-ending date to include in the NHSN (admissions) target dataset. Default NULL (include all available data).

start_date_nssp

Earliest week-ending date to include in the NSSP (ED visit) target dataset. Default NULL (include all available data).

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.