Skip to contents

This function prepares hospitalization data retrieved using get_hdgov_hosp for downstream forecasting. The function optionally limits to states only, trims to a given date, removes incomplete weeks, and removes locations with little reporting over the last month.

Usage

prep_hdgov_hosp(
  hdgov_hosp,
  statesonly = TRUE,
  trim = list(epiyear = 2020, epiweek = 43),
  remove_incomplete = TRUE,
  min_per_week = 1
)

Arguments

hdgov_hosp

Daily hospital utilization data from get_hdgov_hosp

statesonly

Logical as to whether or not to limit to US+DC+States only (i.e., drop territories); default is TRUE

trim

Named list with elements for epiyear and epiweek corresponding to the minimum epidemiological week to retain; defaults to list(epiyear=2020, epiweek=43), which is the first date of report in the healthdata.gov hospitalization data; if set to NULL the data will not be trimmed

remove_incomplete

Logical as to whether or not to remove the last week if incomplete; defaults is TRUE.

min_per_week

The minimum number of flu.admits per week needed to retain that state. Default removes states with less than 1 flu admission per week over the last 30 days.

Value

A tibble with hospitalization data summarized to epiyear/epiweek with the following columns:

  • abbreviation: Abbreviation for the location

  • location: FIPS code for the location

  • week_start: Date of beginning (Sunday) of the given epidemiological week

  • monday: Date of Monday of the given epidemiological week

  • week_end: Date of end (Saturday) of the given epidemiological week

  • epiyear: Year of reporting (in epidemiological week calendar)

  • epiweek: Week of reporting (in epidemiological week calendar)

  • flu.admits: Count of flu cases among admitted patients on previous day

  • flu.admits.cov: Coverage (number of hospitals reporting) for incident flu cases

  • ili_mean: Estimate of historical ILI activity for the given epidemiological week

  • ili_rank: Rank of the given epidemiological week in terms of ILI activity across season (1 being highest average activity)

  • hosp_mean: Estimate of historical flu hospitalization rate for the given epidemiological week

  • hosp_rank: Rank of the given epidemiological week in terms of flu hospitalizations across season (1 being highest average activity)

Examples

if (FALSE) { # \dontrun{
# Retrieve hospitalization data
hdgov_hosp <- get_hdgov_hosp(limitcols=TRUE)
# Prepare and summarize to weekly resolution
h <- prep_hdgov_hosp(hdgov_hosp)
h
} # }