COVID-19 Hospitalization: Facility Lookup

This endpoint is a companion to the covid_hosp_facility endpoint. It provides a way to find unique identifiers and other metadata for facilities of interest.

Metadata is derived from the “COVID-19 Reported Patient Impact and Hospital Capacity by Facility” dataset provided by the US Department of Health & Human Services via healthdata.gov.

See the official description and data dictionary at healthdata.gov for more information.

General topics not specific to any particular data source are discussed in the API overview. Such topics include: contributing and citing.

Metadata

This data source provides metadata about healthcare facilities in the US.

The API

The base URL is: https://api.delphi.cmu.edu/epidata/covid_hosp_facility_lookup/

See this documentation for details on specifying locations and dates.

Parameters

Parameter Description Type
state two-letter state abbreviation string
ccn facility CMS Certification Number string
city city name string
zip 5-digit ZIP code string
fips_code 5-digit FIPS county code string

NOTE: Exactly one of the above parameters must be present in requests. Combinations of parameters (e.g. specifying both city and state) are not supported.

Response

Field Description Type
result result code: 1 = success, 2 = too many results, -2 = no results integer
epidata list of results array of objects
epidata[].hospital_pk unique identifier for this facility (will match CCN if CCN exists) string
epidata[].state two-letter state code string
epidata[].ccn CMS Certification Number for this facility string
epidata[].hospital_name facility name string
epidata[].address facility address string
epidata[].city facility city string
epidata[].zip 5-digit ZIP code string
epidata[].hospital_subtype one of: Childrens Hospitals, Critical Access Hospitals, Long Term, Psychiatric, Rehabilitation, Short Term string
epidata[].fips_code 5-digit FIPS county code string
epidata[].is_metro_micro 1 if this facility serves a metropolitan or micropolitan area, 0 otherwise integer
message success or error message string

Use the hospital_pk value when querying the COVID-19 Reported Patient Impact and Hospital Capacity by Facility endpoint.

Example URLs

Lookup facilities in the city of Southlake (TX)

https://api.delphi.cmu.edu/epidata/covid_hosp_facility_lookup/?city=southlake

{
    "result": 1,
    "epidata": [
        {
            "hospital_pk": "450888",
            "state": "TX",
            "ccn": "450888",
            "hospital_name": "TEXAS HEALTH HARRIS METHODIST HOSPITAL SOUTHLAKE",
            "address": "1545 E SOUTHLAKE BLVD",
            "city": "SOUTHLAKE",
            "zip": "76092",
            "hospital_subtype": "Short Term",
            "fips_code": "48439",
            "is_metro_micro": 1
        },
        {
            "hospital_pk": "670132",
            "state": "TX",
            "ccn": "670132",
            "hospital_name": "METHODIST SOUTHLAKE HOSPITAL",
            "address": "421 E STATE HIGHWAY 114",
            "city": "SOUTHLAKE",
            "zip": "76092",
            "hospital_subtype": "Short Term",
            "fips_code": "48439",
            "is_metro_micro": 1
        }
    ],
    "message": "success"
}

Code Samples

Libraries are available for JavaScript, Python, and R. The following sample shows how to import the library and fetch facilities in the city of Southlake (TX).

Python

Optionally install the package using pip(env):

pip install delphi-epidata

Otherwise, place delphi_epidata.py from this repo next to your python script.

# Import
from delphi_epidata import Epidata
# Fetch data
res = Epidata.covid_hosp_facility_lookup(city='southlake')
print(res['result'], res['message'], len(res['epidata']))