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"),
  included_locations = hubhelpr::included_locations,
  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".

included_locations

Vector of location codes to include in the output. Default value hubhelpr::included_locations.

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 (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.