from epymorph.adrio.respiratory_cdc import (DiseaseHospitalizations,
DiseaseAdmissions, HospitalizationsICU,
AdmissionsPer100k)from epymorph.geography.us_census import StateScope
from epymorph.time import TimeFrame
= StateScope.in_states(["AZ", "CO"], year=2022)
state_scope
= TimeFrame.range("2024-12-20", "2025-02-15")
time = {"scope": state_scope, "time_frame": time} context
Weekly Respiratory Hospital Data
Description
The Respiratory CDC ADRIO uses the Weekly Hospital Respiratory Metrics by Jurisdiction dataset from the CDC website, creating matrices of statistics reported by hospitals at the state level.
Data Collection
The dataset provides weekly updates on Wednesdays with initial data for the previous reporting week, covering Sunday through the following Saturday. The data is provided by the CDC Division of Healthcare Quality Promotion (DHQP) Surveillance branch and the National Healthcare Safety Network (NHSN) from reporting hospitals across the United States.
Attributes
This CDC data source consists of 188 columns of hospital respiratory data, with a central focus on hospital bed occupancy and capacity along with the number of beds occupied by patients with a specified disease (COVID-19, Influenza, RSV). In addition to the bed occupancy and disease metrics, the dataset provides percentages and totals of how many hospitals are reporting information.
For the purposes of this ADRIO, the attributes that are in use are:
- Number of Patients Hospitalized
- Number of New Hospital Admissions
- Number of ICU Patients Hospitalized
- Number of New Hospital Admissions per 100,000 Population
Each of these attributes include COVID-19, Influenza, and RSV specifications, as well as age categorizations.
Additional Resources
Learn more about the dataset from the CDC: Weekly Hospital Respiratory Data (HRD) Metrics by Jurisdiction, National Healthcare Safety Network (NHSN) (Preliminary)
To take a closer look of the data itself and all of the columns within the data source, check out the table of data: Weekly Hospital Respiratory Data (HRD) Metrics by Jurisdiction, National Healthcare Safety Network (NHSN) (Preliminary) Data
Respiratory CDC ADRIO
- Set up the scope, time frame, and context for the ADRIOs
Hospitalizations
Displays the number of patients hospitalized, confirmed to have a specified disease.
"Covid").with_context(**context).evaluate() DiseaseHospitalizations(
array([[('2024-12-21', 229.), ('2024-12-21', 111.)],
[('2024-12-28', 247.), ('2024-12-28', 126.)],
[('2025-01-04', 285.), ('2025-01-04', 149.)],
[('2025-01-11', 271.), ('2025-01-11', 174.)],
[('2025-01-18', 238.), ('2025-01-18', 122.)],
[('2025-01-25', 212.), ('2025-01-25', 123.)],
[('2025-02-01', 212.), ('2025-02-01', 106.)],
[('2025-02-08', 192.), ('2025-02-08', 77.)],
[('2025-02-15', 187.), ('2025-02-15', 73.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Admissions
Displays the number of new hospital admissions, confirmed to have a specified disease.
"Covid").with_context(**context).evaluate() DiseaseAdmissions(
array([[('2024-12-21', 763.), ('2024-12-21', 228.)],
[('2024-12-28', 776.), ('2024-12-28', 289.)],
[('2025-01-04', 719.), ('2025-01-04', 335.)],
[('2025-01-11', 462.), ('2025-01-11', 236.)],
[('2025-01-18', 449.), ('2025-01-18', 172.)],
[('2025-01-25', 312.), ('2025-01-25', 166.)],
[('2025-02-01', 403.), ('2025-02-01', 153.)],
[('2025-02-08', 291.), ('2025-02-08', 135.)],
[('2025-02-15', 298.), ('2025-02-15', 131.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Hospitalizations of ICU Patients
Displays the number of patients hospitalized, confirmed to have a specific disease, in the ICU.
"Covid").with_context(**context).evaluate() HospitalizationsICU(
array([[('2024-12-21', 34.), ('2024-12-21', 19.)],
[('2024-12-28', 37.), ('2024-12-28', 24.)],
[('2025-01-04', 31.), ('2025-01-04', 23.)],
[('2025-01-11', 34.), ('2025-01-11', 30.)],
[('2025-01-18', 34.), ('2025-01-18', 29.)],
[('2025-01-25', 26.), ('2025-01-25', 25.)],
[('2025-02-01', 27.), ('2025-02-01', 18.)],
[('2025-02-08', 23.), ('2025-02-08', 19.)],
[('2025-02-15', 33.), ('2025-02-15', 14.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Admissions per 100k Population
Displays the number of new hospital admissions, confirmed to have a specific disease, during the reporting week per 100,000 population.
"Covid").with_context(**context).evaluate() AdmissionsPer100k(
array([[('2024-12-21', 10.29), ('2024-12-21', 3.9 )],
[('2024-12-28', 10.47), ('2024-12-28', 4.95)],
[('2025-01-04', 9.7 ), ('2025-01-04', 5.73)],
[('2025-01-11', 6.23), ('2025-01-11', 4.04)],
[('2025-01-18', 6.06), ('2025-01-18', 2.94)],
[('2025-01-25', 4.21), ('2025-01-25', 2.84)],
[('2025-02-01', 5.44), ('2025-02-01', 2.62)],
[('2025-02-08', 3.92), ('2025-02-08', 2.31)],
[('2025-02-15', 4.02), ('2025-02-15', 2.24)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Parameters
Disease Type
The above example calls were all used to extract COVID-19 data, which was established in the parameter with the argument “Covid”. However, all of these ADRIOs support calling for COVID-19, Influenza, and RSV (Respiratory Syncytial Virus) metrics. You can replace the “Covid” parameter with either of these diseases to retrieve data concerning them.
Influenza Hospitalizations
"Influenza").with_context(**context).evaluate() DiseaseHospitalizations(
array([[('2024-12-21', 312.), ('2024-12-21', 75.)],
[('2024-12-28', 474.), ('2024-12-28', 166.)],
[('2025-01-04', 610.), ('2025-01-04', 264.)],
[('2025-01-11', 591.), ('2025-01-11', 238.)],
[('2025-01-18', 497.), ('2025-01-18', 239.)],
[('2025-01-25', 417.), ('2025-01-25', 245.)],
[('2025-02-01', 420.), ('2025-02-01', 252.)],
[('2025-02-08', 415.), ('2025-02-08', 282.)],
[('2025-02-15', 352.), ('2025-02-15', 288.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
RSV Hospitalizations
"RSV").with_context(**context).evaluate() DiseaseHospitalizations(
array([[('2024-12-21', 41.), ('2024-12-21', 48.)],
[('2024-12-28', 41.), ('2024-12-28', 59.)],
[('2025-01-04', 69.), ('2025-01-04', 85.)],
[('2025-01-11', 92.), ('2025-01-11', 78.)],
[('2025-01-18', 94.), ('2025-01-18', 103.)],
[('2025-01-25', 106.), ('2025-01-25', 115.)],
[('2025-02-01', 132.), ('2025-02-01', 124.)],
[('2025-02-08', 158.), ('2025-02-08', 128.)],
[('2025-02-15', 146.), ('2025-02-15', 132.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Age Categories
In addition to the disease type, the dataset provides this data separated by age ranges. By default, these calls have been displaying the Total
number of patients, which includes all ages reported.
Hospitalizations
Both of the hospitalizations calls include the following calls to separate the patient data by age:
Pediatric
: Patients from ages 0 to 17 years old.
Adult
: Patients from age 18 up to any age above 75 years old.
Total
: The total number of patients, both pediatric and adult.
"Covid", "Pediatric").with_context(**context).evaluate() DiseaseHospitalizations(
array([[('2024-12-21', 3.), ('2024-12-21', 3.)],
[('2024-12-28', 5.), ('2024-12-28', 8.)],
[('2025-01-04', 6.), ('2025-01-04', 10.)],
[('2025-01-11', 5.), ('2025-01-11', 18.)],
[('2025-01-18', 3.), ('2025-01-18', 11.)],
[('2025-01-25', 4.), ('2025-01-25', 10.)],
[('2025-02-01', 4.), ('2025-02-01', 9.)],
[('2025-02-08', 4.), ('2025-02-08', 9.)],
[('2025-02-15', 3.), ('2025-02-15', 4.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Admissions
Admissions calls include the same Pediatric
, Adult
, and Total
arguments that the hospitalizations ADRIOs include. However, admissions ADRIOs have more detailed arguments for their age ranges, specifying smaller age ranges within Pediatric
and Adult
.
0 to 4
: Patients from ages 0 to 4 years old.
5 to 17
: Patients from ages 5 to 17 years old.
18 to 49
: Patients from ages 18 to 49 years old.
50 to 64
: Patients from ages 50 to 64 years old.
65 to 74
: Patients from ages 65 to 74 years old.
75 and above
: Patients from age 75 to anything above.
Unknown
: Patients of unknown age. (Unknown
is only callable for DiseaseAdmissions. Not available for AdmissionsPer100k.)
"RSV", "18 to 49").with_context(**context).evaluate() DiseaseAdmissions(
array([[('2024-12-21', 21.), ('2024-12-21', 5.)],
[('2024-12-28', 7.), ('2024-12-28', 5.)],
[('2025-01-04', 13.), ('2025-01-04', 9.)],
[('2025-01-11', 26.), ('2025-01-11', 6.)],
[('2025-01-18', 11.), ('2025-01-18', 10.)],
[('2025-01-25', 24.), ('2025-01-25', 13.)],
[('2025-02-01', 33.), ('2025-02-01', 18.)],
[('2025-02-08', 34.), ('2025-02-08', 18.)],
[('2025-02-15', 36.), ('2025-02-15', 15.)]],
dtype=[('date', '<M8[D]'), ('data', '<f8')])
Mandatory and Voluntary Reporting Periods
In this dataset, there are periods of time where hospitals are not required to report metrics on specified diseases. As a default, there will be a warning displayed when the given time frame takes place during a non-mandated reporting phase, letting you know when those mandatory periods are.
COVID-19 and Influenza
Mandatory Reporting:
- August 8th, 2020 - April 30th, 2024
- November 1st, 2024 - Present
RSV
Mandatory Reporting:
- November 1st, 2024 - Present
Flag for Erroring Non-mandated Data
If it is desired to only capture metrics that were reported in a mandated reporting period, you have the option to add the False
flag as a third argument. This flag will let the system error if the given time frame takes place during a voluntary reporting phase, rather than only give a warning.
from epymorph.error import DataResourceError
= StateScope.in_states(["AZ", "CO"], year=2020)
state_scope
= TimeFrame.range("2021-05-10", "2022-01-01")
time = {"scope": state_scope, "time_frame": time}
context
try:
= (
rsv_hosp "RSV", "Total", False)
DiseaseHospitalizations(**context).evaluate()
.with_context(
)except DataResourceError as e:
print(f"{e}")
All data and metrics reported before November 1st, 2024 for RSV were reported voluntarily.
Enter a date on or after 11/01/2024 for data captured during a mandatory reporting period.