|
| 1 | +--- |
| 2 | +title: COVID-19 Reported Patient Impact and Hospital Capacity by State Timeseries |
| 3 | +parent: Epidata API (Other Epidemics) |
| 4 | +--- |
| 5 | + |
| 6 | +# COVID-19 Hospitalization |
| 7 | + |
| 8 | +This data source is a mirror of the "COVID-19 Reported Patient Impact and |
| 9 | +Hospital Capacity by State Timeseries" dataset provided by the US Department of |
| 10 | +Health & Human Services via healthdata.gov. |
| 11 | + |
| 12 | +See the |
| 13 | +[official description at healthdata.gov](https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries) |
| 14 | +for more information, including a |
| 15 | +[data dictionary](https://healthdata.gov/covid-19-reported-patient-impact-and-hospital-capacity-state-data-dictionary). |
| 16 | + |
| 17 | +General topics not specific to any particular data source are discussed in the |
| 18 | +[API overview](README.md). Such topics include: |
| 19 | +[contributing](README.md#contributing) and [citing](README.md#citing). |
| 20 | + |
| 21 | +## Metadata |
| 22 | + |
| 23 | +This data source provides various measures of COVID-19 burden on patients and healthcare in the US. |
| 24 | +- Data source: [US Department of Health & Human Services](https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries) (HHS) |
| 25 | +- Temporal Resolution: Daily, starting 2020-01-01 |
| 26 | +- Spatial Resolution: US States plus DC, PR, and VI |
| 27 | +- Open access via [Open Data Commons Open Database License (ODbL)](https://opendatacommons.org/licenses/odbl/1.0/) |
| 28 | +- Versioned by Delphi according to "issue" date. New issues are expected to be released roughly weekly. |
| 29 | + |
| 30 | +# The API |
| 31 | + |
| 32 | +The base URL is: https://delphi.cmu.edu/epidata/api.php |
| 33 | + |
| 34 | +See [this documentation](README.md) for details on specifying locations and dates. |
| 35 | + |
| 36 | +## Parameters |
| 37 | + |
| 38 | +### Required |
| 39 | + |
| 40 | +| Parameter | Description | Type | |
| 41 | +| --- | --- | --- | |
| 42 | +| `states` | two-letter state abbreviations | `list` of states | |
| 43 | +| `dates` | dates | `list` of dates or date ranges | |
| 44 | + |
| 45 | +### Optional |
| 46 | + |
| 47 | +| Parameter | Description | Type | |
| 48 | +| --- | --- | --- | |
| 49 | +| `issues` | issues | `list` of "issue" dates or date ranges | |
| 50 | + |
| 51 | +If `issues` is not specified, then the most recent issue is used by default. |
| 52 | + |
| 53 | +## Response |
| 54 | + |
| 55 | +| Field | Description | Type | |
| 56 | +| --- | --- | --- | |
| 57 | +| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer | |
| 58 | +| `epidata` | list of results | array of objects | |
| 59 | +| `epidata[].state` | state pertaining to this row | string | |
| 60 | +| `epidata[].date` | date pertaining to this row | integer | |
| 61 | +| `epidata[].issue` | the date on which the dataset containing this row was published | integer | |
| 62 | +| `epidata[].*` | see the [data dictionary](https://healthdata.gov/covid-19-reported-patient-impact-and-hospital-capacity-state-data-dictionary) | | |
| 63 | +| `message` | `success` or error message | string | |
| 64 | + |
| 65 | +# Example URLs |
| 66 | + |
| 67 | +### MA on 2020-05-10 (per most recent issue) |
| 68 | +https://delphi.cmu.edu/epidata/api.php?source=covid_hosp&states=MA&dates=20200510 |
| 69 | + |
| 70 | +```json |
| 71 | +{ |
| 72 | + "result": 1, |
| 73 | + "epidata": [ |
| 74 | + { |
| 75 | + "state": "MA", |
| 76 | + "issue": 20201116, |
| 77 | + "date": 20200510, |
| 78 | + "hospital_onset_covid": 53, |
| 79 | + "hospital_onset_covid_coverage": 84, |
| 80 | + "inpatient_beds": 15691, |
| 81 | + "inpatient_beds_coverage": 73, |
| 82 | + "inpatient_beds_used": 12427, |
| 83 | + "inpatient_beds_used_coverage": 83, |
| 84 | + "inpatient_beds_used_covid": 3625, |
| 85 | + "inpatient_beds_used_covid_coverage": 84, |
| 86 | + "previous_day_admission_adult_covid_confirmed": null, |
| 87 | + "previous_day_admission_adult_covid_confirmed_coverage": 0, |
| 88 | + "previous_day_admission_adult_covid_suspected": null, |
| 89 | + "previous_day_admission_adult_covid_suspected_coverage": 0, |
| 90 | + "previous_day_admission_pediatric_covid_confirmed": null, |
| 91 | + "previous_day_admission_pediatric_covid_confirmed_coverage": 0, |
| 92 | + "previous_day_admission_pediatric_covid_suspected": null, |
| 93 | + "previous_day_admission_pediatric_covid_suspected_coverage": 0, |
| 94 | + "staffed_adult_icu_bed_occupancy": null, |
| 95 | + "staffed_adult_icu_bed_occupancy_coverage": 0, |
| 96 | + "staffed_icu_adult_patients_confirmed_suspected_covid": null, |
| 97 | + "staffed_icu_adult_patients_confirmed_suspected_covid_coverage": 0, |
| 98 | + "staffed_icu_adult_patients_confirmed_covid": null, |
| 99 | + "staffed_icu_adult_patients_confirmed_covid_coverage": 0, |
| 100 | + "total_adult_patients_hosp_confirmed_suspected_covid": null, |
| 101 | + "total_adult_patients_hosp_confirmed_suspected_covid_coverage": 0, |
| 102 | + "total_adult_patients_hosp_confirmed_covid": null, |
| 103 | + "total_adult_patients_hosp_confirmed_covid_coverage": 0, |
| 104 | + "total_pediatric_patients_hosp_confirmed_suspected_covid": null, |
| 105 | + "total_pediatric_patients_hosp_confirmed_suspected_covid_coverage": 0, |
| 106 | + "total_pediatric_patients_hosp_confirmed_covid": null, |
| 107 | + "total_pediatric_patients_hosp_confirmed_covid_coverage": 0, |
| 108 | + "total_staffed_adult_icu_beds": null, |
| 109 | + "total_staffed_adult_icu_beds_coverage": 0, |
| 110 | + "inpatient_beds_utilization_coverage": 72, |
| 111 | + "inpatient_beds_utilization_numerator": 10876, |
| 112 | + "inpatient_beds_utilization_denominator": 15585, |
| 113 | + "percent_of_inpatients_with_covid_coverage": 83, |
| 114 | + "percent_of_inpatients_with_covid_numerator": 3607, |
| 115 | + "percent_of_inpatients_with_covid_denominator": 12427, |
| 116 | + "inpatient_bed_covid_utilization_coverage": 73, |
| 117 | + "inpatient_bed_covid_utilization_numerator": 3304, |
| 118 | + "inpatient_bed_covid_utilization_denominator": 15691, |
| 119 | + "adult_icu_bed_covid_utilization_coverage": null, |
| 120 | + "adult_icu_bed_covid_utilization_numerator": null, |
| 121 | + "adult_icu_bed_covid_utilization_denominator": null, |
| 122 | + "adult_icu_bed_utilization_coverage": null, |
| 123 | + "adult_icu_bed_utilization_numerator": null, |
| 124 | + "adult_icu_bed_utilization_denominator": null, |
| 125 | + "inpatient_beds_utilization": 0.6978504972730191, |
| 126 | + "percent_of_inpatients_with_covid": 0.2902550897239881, |
| 127 | + "inpatient_bed_covid_utilization": 0.21056656682174496, |
| 128 | + "adult_icu_bed_covid_utilization": null, |
| 129 | + "adult_icu_bed_utilization": null |
| 130 | + } |
| 131 | + ], |
| 132 | + "message": "success" |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | + |
| 137 | +# Code Samples |
| 138 | + |
| 139 | +Libraries are available for [CoffeeScript](../../src/client/delphi_epidata.coffee), [JavaScript](../../src/client/delphi_epidata.js), [Python](../../src/client/delphi_epidata.py), and [R](../../src/client/delphi_epidata.R). |
| 140 | +The following sample shows how to import the library and fetch MA on 2020-05-10 |
| 141 | +(per most recent issue). |
| 142 | + |
| 143 | +### Python |
| 144 | + |
| 145 | +Optionally install the package using pip(env): |
| 146 | +````bash |
| 147 | +pip install delphi-epidata |
| 148 | +```` |
| 149 | + |
| 150 | +Otherwise, place `delphi_epidata.py` from this repo next to your python script. |
| 151 | + |
| 152 | +````python |
| 153 | +# Import |
| 154 | +from delphi_epidata import Epidata |
| 155 | +# Fetch data |
| 156 | +res = Epidata.covid_hosp('MA', 20200510) |
| 157 | +print(res['result'], res['message'], len(res['epidata'])) |
| 158 | +```` |
0 commit comments