Skip to contents

Fetches target NHSN (National Healthcare Safety Network) hospital respiratory admissions data using the epidatr R client for the Delphi Epidata API. This is just a closure around epidatr::pub_covidcast() with validation for the target signals and parameters used in this nowcasting and checking that the output is non-empty. NB:

  • For time_values and issues, you can pass an epidatr::timeset object however this source only supports epiweeks (not dates).

  • Output dates are Saturday week-endings, matching both MMWR epiweeks and forecast hub conventions.

Usage

fetch_nhsn_data(
  signal = "confirmed_admissions_covid_ew_prelim",
  geo_type = "state",
  geo_values = "*",
  time_values = "*",
  issues = "*",
  fetch_args = epidatr::fetch_args_list(reference_week_day = 7),
  ...
)

Arguments

signal

Character string specifying the NHSN signal to fetch. Default is "confirmed_admissions_covid_ew_prelim".

geo_type

Character string specifying geographic resolution. Options: "state", "hhs", "nation". Default is "state".

geo_values

Character vector of geography codes or "*" for all. Default is "*".

time_values

A timeset object (e.g., epirange(202401, 202404)) or "*" for all available dates. Default is "*".

issues

A timeset object for specific issue dates, or "*" for most recent. Default is "*".

fetch_args

List of fetch arguments passed to epidatr::pub_covidcast(). Defaults to fetch_args_list(reference_week_day = 7) to return Saturday dates matching MMWR epiweek and forecast hub conventions.

...

Additional arguments passed to epidatr::pub_covidcast().

Value

A tibble with columns including:

  • geo_value: Geographic identifier

  • time_value: Reference date (week-ending Saturday)

  • value: Number of confirmed admissions

  • issue: Issue date (week-ending Saturday of the epiweek when data was published)

  • lag: Days between reference date and issue date

  • signal: Signal name

  • Additional metadata columns from epidatr::pub_covidcast()