CDC: COVID-19 and Influenza

Description

The CDC (US Centers for Disease Control and Prevention) provides numerous datasets concerning disease metrics and statistics.

epymorph has implemented ADRIOs for accessing a curated selection of these data. Each pulls from a specific data source, each of which has unique spatial and temporal bounds and frequency of data. Refer to ADRIO API documentation for full details. Even within a product, certain irregularities may exist in the data. Ultimately you may wish to refer to the source for more information.

Some ADRIOs seem to overlap in purpose, loading very similar data. In these cases, it was decided that there were sufficient differences in methodology or results as to warrant including multiple options.

ADRIO Dates Granularities Description
COVIDFacilityHospitalization 2019-12-19 to 2024-04-21 county, state Weekly number of total hospitalized patients with COVID, reported by healthcare facility.
InfluenzaFacilityHospitalization 2019-12-19 to 2024-04-21 county, state Weekly number of total hospitalized patients with influenza, reported by healthcare facility.
COVIDStateHospitalization 2020-08-08 to 2024-10-16 state Weekly number of new admissions with confirmed COVID.
InfluenzaStateHospitalization 2020-08-08 to 2024-10-16 state Weekly number of new admissions with confirmed influenza.
COVIDCountyCases 2022-02-24 to 2023-05-11 county, state Weekly number of confirmed COVID cases, reported by county.
COVIDVaccination 2020-12-13 to 2023-05-10 county, state Daily/weekly numbers of people who have received COVID vaccination, reported by county.
CountyDeaths 2020-01-04 to 2023-04-01 county, state Weekly deaths due due to a variety of causes reported by county.
StateDeaths 2020-01-04 to present state Weekly deaths due to a variety of causes reported by state.

Examples

COVID Facility Hospitalization

(API) From dataset COVID-19 Reported Patient Impact and Hospital Capacity by Facility (anag-cw7u).

import numpy as np
from epymorph.kit import *
from epymorph.adrio import cdc
from epymorph.adrio.processing import RandomFix

cdc.COVIDFacilityHospitalization(
    age_group="both",  # or "adult", or "pediatric"
    fix_redacted=RandomFix.from_range(1, 3),
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2021-01-01", "2021-02-01"),
    scope=CountyScope.in_counties(["04005", "04013"], year=2019),
    rng=np.random.default_rng(),
).evaluate()
array([[('2021-01-03',   478), ('2021-01-03', 20516)],
       [('2021-01-10',   445), ('2021-01-10', 21361)],
       [('2021-01-17',   464), ('2021-01-17', 19711)],
       [('2021-01-24',   394), ('2021-01-24', 17093)],
       [('2021-01-31',   305), ('2021-01-31', 13588)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

Influenza Facility Hospitalization

(API) From dataset COVID-19 Reported Patient Impact and Hospital Capacity by Facility (anag-cw7u).

import numpy as np
from epymorph.kit import *
from epymorph.adrio import cdc
from epymorph.adrio.processing import RandomFix

cdc.InfluenzaFacilityHospitalization(
    fix_redacted=RandomFix.from_range(1, 3),
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2021-01-01", "2021-02-01"),
    scope=CountyScope.in_counties(["04005", "04013"], year=2019),
    rng=np.random.default_rng(),
).evaluate()
array([[('2021-01-03',   0), ('2021-01-03', 298)],
       [('2021-01-10',   0), ('2021-01-10', 294)],
       [('2021-01-17',   0), ('2021-01-17', 250)],
       [('2021-01-24',   0), ('2021-01-24', 244)],
       [('2021-01-31',   0), ('2021-01-31', 325)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

COVID State Hospitalization

(API) From dataset Weekly United States Hospitalization Metrics by Jurisdiction, During Mandatory Reporting Period from August 1, 2020 to April 30, 2024, and for Data Reported Voluntarily Beginning May 1, 2024, National Healthcare Safety Network (NHSN) - ARCHIVED (amet-mg7g).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.COVIDStateHospitalization(
    fix_missing=0,
    allow_voluntary=True,
).with_context(
    time_frame=TimeFrame.rangex("2022-03-01", "2022-04-01"),
    scope=StateScope.in_states(["AZ", "NM"], year=2022),
).evaluate()
array([[('2022-03-05', 839), ('2022-03-05', 155)],
       [('2022-03-12', 664), ('2022-03-12', 114)],
       [('2022-03-19', 460), ('2022-03-19',  89)],
       [('2022-03-26', 407), ('2022-03-26',  70)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

Influenza State Hospitalization

(API) From dataset Weekly United States Hospitalization Metrics by Jurisdiction, During Mandatory Reporting Period from August 1, 2020 to April 30, 2024, and for Data Reported Voluntarily Beginning May 1, 2024, National Healthcare Safety Network (NHSN) - ARCHIVED (amet-mg7g).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.InfluenzaStateHospitalization(
    fix_missing=0,
    allow_voluntary=True,
).with_context(
    time_frame=TimeFrame.rangex("2022-03-01", "2022-04-01"),
    scope=StateScope.in_states(["AZ", "NM"], year=2022),
).evaluate()
array([[('2022-03-05',  77), ('2022-03-05',   4)],
       [('2022-03-12',  79), ('2022-03-12',   6)],
       [('2022-03-19', 104), ('2022-03-19',  15)],
       [('2022-03-26', 119), ('2022-03-26',  29)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

COVID County Cases

(API) From dataset United States COVID-19 Community Levels by County (3nnm-4jni).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.COVIDCountyCases(
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2022-03-01", "2022-04-01"),
    scope=CountyScope.in_counties(["04005", "04013"], year=2019),
).evaluate()
array([[('2022-03-03',  113), ('2022-03-03', 3475)],
       [('2022-03-10',  190), ('2022-03-10', 7107)],
       [('2022-03-17',   59), ('2022-03-17', 3368)],
       [('2022-03-24',   39), ('2022-03-24', 3359)],
       [('2022-03-31',   93), ('2022-03-31', 8281)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

COVID Vaccination

(API) From dataset COVID-19 Vaccinations in the United States,County (8xkx-amqh).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.COVIDVaccination(
    vaccine_status="full series and booster",  # or "at least one dose", or "full series"
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2022-01-01", "2022-01-10"),
    scope=CountyScope.in_counties(["04005", "04013"], year=2019),
).evaluate()
array([[('2022-01-01',  36601), ('2022-01-01', 707207)],
       [('2022-01-02',  36601), ('2022-01-02', 707207)],
       [('2022-01-03',  36602), ('2022-01-03', 707259)],
       [('2022-01-04',  37184), ('2022-01-04', 727083)],
       [('2022-01-05',  37617), ('2022-01-05', 732519)],
       [('2022-01-06',  38172), ('2022-01-06', 740882)],
       [('2022-01-07',  38527), ('2022-01-07', 749592)],
       [('2022-01-08',  38865), ('2022-01-08', 759045)],
       [('2022-01-09',  39308), ('2022-01-09', 768437)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

County Deaths

(API) From dataset AH COVID-19 Death Counts by County and Week, 2020-present (ite7-j2w7).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.CountyDeaths(
    cause_of_death="COVID-19",  # or "all"
    fix_redacted=0,
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2021-01-01", "2021-02-01"),
    scope=CountyScope.in_counties(["04005", "04013"], year=2019),
).evaluate()
array([[('2021-01-02',  10), ('2021-01-02', 540)],
       [('2021-01-09',  12), ('2021-01-09', 615)],
       [('2021-01-16',   0), ('2021-01-16', 629)],
       [('2021-01-23',   0), ('2021-01-23', 604)],
       [('2021-01-30',  12), ('2021-01-30', 514)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])

State Deaths

(API) From dataset Provisional COVID-19 Death Counts by Week Ending Date and State (r8kw-7aab).

from epymorph.kit import *
from epymorph.adrio import cdc

cdc.StateDeaths(
    cause_of_death="COVID-19",  # or "all", or "influenza", or "pneumonia"
    fix_redacted=0,
    fix_missing=0,
).with_context(
    time_frame=TimeFrame.rangex("2021-01-01", "2021-02-01"),
    scope=StateScope.in_states(["AZ", "NM"], year=2021),
).evaluate()
array([[('2021-01-02', 883), ('2021-01-02', 190)],
       [('2021-01-09', 942), ('2021-01-09', 192)],
       [('2021-01-16', 996), ('2021-01-16', 178)],
       [('2021-01-23', 959), ('2021-01-23', 152)],
       [('2021-01-30', 776), ('2021-01-30', 110)]],
      dtype=[('date', '<M8[D]'), ('value', '<i8')])