ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5
Loading...

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the cms_covid19_nursing_home_dataset table in this repository, by referencing it like:

"ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest"."cms_covid19_nursing_home_dataset"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "week_ending", -- Last day (MM/DD/YYYY) of reporting week (a reporting week is from Monday through Sunday).
    "federal_provider_number", -- The CMS Certification Number (CCN) for the provider.
    "provider_name", -- The provider's name.
    "provider_address", -- The provider's address.
    "provider_city", -- The provider's city.
    "provider_state", -- The provider's state.
    "provider_zip_code", -- The provider's zip code.
    "provider_phone_number", -- Provider Phone Number
    "submitted_data", -- Indicates (Y/N) if any data was submitted for the reporting week.
    "passed_quality_assurance", -- Indicates (Y/N) if the data passed the quality assurance check.
    "residents_weekly_admissions", -- Number of residents admitted or readmitted who were previously hospitalized and treated for COVID-19 (ADMISSIONS) as reported by the provider for this collection date. Note: Numbers for Week Ending 05/24/2020 may include reporting for any time between 01/01/2020 through 05/24/2020. Reporting for subsequent weeks is on a weekly basis.
    "residents_total_admissions", -- Number of residents admitted or readmitted who were previously hospitalized and treated for COVID-19 (ADMISSIONS) since 01/01/2020 as reported by the provider.
    "residents_weekly_confirmed", -- Number of residents with new laboratory positive COVID-19 (CONFIRMED) as reported by the provider for this collection date. Note: Numbers for Week Ending 05/24/2020 may include reporting for any time between 01/01/2020 through 05/24/2020. Reporting for subsequent weeks is on a weekly basis.
    "residents_total_confirmed", -- Number of residents with laboratory positive COVID-19 (CONFIRMED) since 01/01/2020 as reported by the provider.
    "residents_weekly_all_deaths", -- Number of residents who have died in the facility or another location (TOTAL DEATHS) as reported by the provider for this collection date. Note: Numbers for Week Ending 05/24/2020 may include reporting for any time between 01/01/2020 through 05/24/2020. Reporting for subsequent weeks is on a weekly basis.
    "residents_total_all_deaths", -- Number of residents who have died in the facility or another location (TOTAL DEATHS) since 01/01/2020 as reported by the provider for this collection date.
    "residents_weekly_covid_19", -- Number of residents with new suspected or laboratory positive COVID-19 who died in the facility or another location (COVID-19 DEATHS) as reported by the provider for this collection date. Note: Numbers for Week Ending 05/24/2020 may include reporting for any time between 01/01/2020 through 05/24/2020. Reporting for subsequent weeks is on a weekly basis.
    "residents_total_covid_19", -- Number of residents with suspected or laboratory positive COVID-19 who died in the facility or another location (COVID-19 DEATHS) since 1/1/20 as reported by the provider for this collection date.
    "number_of_all_beds", -- Total number of resident beds in the facility as reported by the provider.
    "total_number_of_occupied", -- Total number of resident beds that are currently occupied as reported by the provider.
    "staff_weekly_confirmed_covid", -- Number of staff and facility personnel with new laboratory positive COVID-19 (CONFIRMED) as reported by the provider for this collection date. Note: Numbers for Week Ending 05/24/2020 may include reporting for any time between 01/01/2020 through 05/24/2020. Reporting for subsequent weeks is on a weekly basis.
    "staff_total_confirmed_covid", -- Number of staff and facility personnel with laboratory positive COVID-19 (CONFIRMED) since 01/01/2020 as reported by the provider.
    "total_resident_confirmed", -- Number of residents with laboratory positive COVID-19 (CONFIRMED) since 01/01/2020 per 1,000 residents as reported by the provider.
    "total_resident_covid_19_deaths", -- Number of residents with suspected or laboratory positive COVID-19 who died in the facility or another location (COVID-19 DEATHS) since 1/1/20 per 1,000 residents as reported by the provider.
    "county", -- The provider's county.
    "initial_confirmed_covid_19_case_this_week", -- Indicates (Y/N) if a facility has residents with new laboratory positive COVID-19 (CONFIRMED) that is greater than or equal to 1 this week after having zero residents with laboratory positive COVID-19 (CONFIRMED) since 01/01/2020, as reported by the provider.
    "residents_hospitalizations_with_confirmed_covid_19", -- Residents Hospitalizations with Confirmed Covid-19
    "weekly_resident_confirmed_covid_19_cases_per_1_000_residents", -- Number of residents with laboratory positive COVID-19 (CONFIRMED) for this collection date per 1,000 residents (Total Number of Occupied Beds) as reported by the provider.
    "weekly_resident_covid_19_deaths_per_1_000_residents", -- Number of residents with suspected or laboratory positive COVID-19 who died in the facility or another location (COVID-19 DEATHS) for this collection date per 1,000 residents as reported by the provider.
    "number_of_residents_who_received_covid_19_vaccine_booster_14_da", -- Number of Residents who Received COVID-19 Vaccine Booster, 14 Days or More Before Positive Test
    "number_of_residents_staying_in_this_facility_for_at_least_1_000", -- Number of Residents Staying in this Facility for At Least 1 Day This Week
    "number_of_all_healthcare_personnel_eligible_to_work_in_this_fac", -- Number of All Healthcare Personnel Eligible to Work in this Facility for At Least 1 Day This Week
    "number_of_healthcare_personnel_with_a_completed_vaccination_sta", -- Number of Healthcare Personnel with a Completed Vaccination Staying in this Facility for At Least 1 Day This Week who Received a COVID-19 Vaccine Booster at Any Time
    "number_of_residents_who_received_two_or_more_covid_19_vaccine_b", -- Applies to additional dose or booster shot.
    "number_of_residents_who_are_up_to_date_on_covid_19_vaccinations", -- Number of Residents who are Up to Date on COVID -19 Vaccinations, 14 Days or More Before Positive Test
    "number_of_residents_staying_in_this_facility_for_at_least_1_001", -- Applies to additional dose or booster shot. 
    "number_of_residents_staying_in_this_facility_for_at_least_1_002", -- https://www.cdc.gov/nhsn/pdfs/hps/covidvax/UpToDateGuidanceMay2022-508.pdf
    "recent_percentage_of_current_residents_up_to_date_with_covid_19", -- The value of "Percentage of Residents who are Up to Date with COVID-19 Vaccines" for the current week, or if blank, for the prior week.
    "percentage_of_current_residents_up_to_date_with_covid_19_vaccin", -- Calculated as follows: (Number of Residents Staying in this Facility for At Least 1 Day This Week Up to Date with COVID-19 Vaccines / Number of Residents Staying in this Facility for At Least 1 Day This Week) * 100
    "recent_percentage_of_current_healthcare_personnel_up_to_date_wi", -- The value of "Percentage of Current Healthcare Personnel who are Up to Date with COVID-19 Vaccines" for the current week, or if blank, for the prior week. 
    "percentage_of_current_healthcare_personnel_up_to_date_with_covi", -- Calculated as follows: (Number of Healthcare Personnel Eligible to Work in this Facility for At Least 1 Day This Week Up to Date with COVID-19 Vaccines / Number of All Healthcare Personnel Eligible to Work in this Facility for At Least 1 Day This Week) * 100
    "residents_hospitalizations_with_confirmed_covid_19_and_up_to_da" -- Number of residents who have been hospitalized with a positive COVID-19 test and also up to date with COVID-19 vaccines at the time of the positive COVID-19 test.
FROM
    "ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest"."cms_covid19_nursing_home_dataset"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5 with SQL in under 60 seconds.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories, the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets (like this repository), where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Cloning Data

Because ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest is a Splitgraph Image, you can clone the data from Spltgraph Cloud to your local engine, where you can query it like any other Postgres database, using any of your existing tools.

First, install Splitgraph if you haven't already.

Clone the metadata with sgr clone

This will be quick, and does not download the actual data.

sgr clone ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5

Checkout the data

Once you've cloned the data, you need to "checkout" the tag that you want. For example, to checkout the latest tag:

sgr checkout ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest

This will download all the objects for the latest tag of ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5 and load them into the Splitgraph Engine. Depending on your connection speed and the size of the data, you will need to wait for the checkout to complete. Once it's complete, you will be able to query the data like you would any other Postgres database.

Alternatively, use "layered checkout" to avoid downloading all the data

The data in ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest is 0 bytes. If this is too big to download all at once, or perhaps you only need to query a subset of it, you can use a layered checkout.:

sgr checkout --layered ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5:latest

This will not download all the data, but it will create a schema comprised of foreign tables, that you can query as you would any other data. Splitgraph will lazily download the required objects as you query the data. In some cases, this might be faster or more efficient than a regular checkout.

Read the layered querying documentation to learn about when and why you might want to use layered queries.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph Engine, you can query it with any of your existing tools. As far as they're concerned, ct-gov/cms-covid19-nursing-home-dataset-w8wc-65i5 is just another Postgres schema.

Related Documentation:

Loading...