cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3
Icon for Socrata external plugin

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 respiratory_virus_response_rvr_united_states table in this repository, by referencing it like:

"cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3:latest"."respiratory_virus_response_rvr_united_states"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "average_admissions_12_17_covid_confirmed_per_100k", -- Numeric value of new hospital admissions of patients ages 12 to 17 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "admissions_00_04_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 0 to 4 years with confirmed COVID-19 
    "admissions_12_17_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 12 to 17 years with confirmed COVID-19 
    "average_admissions_05_11_covid_confirmed_per_100k", -- Numeric value of new hospital admissions of patients ages 5 to 11 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_12_17_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 12 to 17 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_00_04_covid_confirmed_per_100k", -- Numeric value of new hospital admissions of patients ages 0 to 4 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "admissions_05_11_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 5 to 11 years with confirmed COVID-19 
    "average_admissions_00_04_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 0 to 4 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_05_11_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 5 to 11 years with confirmed COVID-19 (7-Day Average) 
    "absolute_change_average_9", -- Absolute change in percent of staffed pediatric ICU beds occupied by patients with any condition (7-day average) from prior week 
    "absolute_change_average_8", -- Absolute change in percent of staffed adult ICU beds occupied by patients with any condition (7-day average) from prior week 
    "absolute_change_average_7", -- Absolute change in percent of pediatric inpatient beds occupied by patients with any condition (7-day average) from prior week 
    "absolute_change_average_6", -- Absolute change in percent of adult inpatient beds occupied by patients with any condition (7-day average) from prior week 
    "absolute_change_average_5", -- Absolute change in percent of staffed ICU beds occupied by patients with confirmed influenza (7-day average) from prior week 
    "average_percent_staff_icu_2", -- Numeric value of percent of staffed ICU beds occupied by patients with confirmed influenza (7-day average) 
    "percent_staff_icu_beds_1", -- Numeric value of percent of staffed ICU beds occupied by patients with confirmed influenza 
    "icu_patients_influenza", -- Numeric value of prevalent hospitalizations of ICU patients with confirmed influenza  
    "absolute_change_average_4", -- Absolute change in percent of inpatient beds occupied by patients with confirmed influenza (7-day average) from prior week 
    "average_percent_inpatient_2", -- Numeric value of percent of inpatient beds occupied by patients with confirmed influenza (7-day average) 
    "percent_inpatient_beds_1", -- Numeric value of percent of inpatient beds occupied by patients with confirmed influenza  
    "total_patients_hospitalized_1", -- Numeric value of prevalent hospitalizations of patients with confirmed influenza  
    "percent_change_total_3", -- Percent change in the total number of new hospital admissions of patients with confirmed influenza in the last 7 days per 100,000 population from prior week 7-day total 
    "total_admissions_all_influenza_1", -- Numeric value of new hospital admissions of patients with confirmed influenza (7-day total) per 100,000 population  
    "percent_change_total_2", -- Percent change in the total number of new hospital admissions of patients with confirmed influenza in the last 7 days from prior week 7-day total 
    "total_admissions_all_influenza", -- Numeric value of new hospital admissions of patients with confirmed influenza (7-day total) 
    "absolute_change_average_3", -- Absolute change in percent of staffed ICU beds occupied by patients with confirmed COVID-19 (7-day average) from prior week 
    "absolute_change_average_2", -- Absolute change in percent of inpatient beds occupied by patients with confirmed COVID-19 (7-day average) from prior week 
    "percent_change_total_1", -- Percent change in the total number of new hospital admissions of patients with confirmed COVID-19 in the last 7 days from prior week 7-day total 
    "total_admissions_all_covid_1", -- Numeric value of new hospital admissions of patients with confirmed COVID-19 (7-day total) 
    "average_percent_staff_1", -- Numeric value of percent of staffed pediatric ICU beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_staff_adult_1", -- Numeric value of percent of staffed adult ICU beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_staff_icu_1", -- Numeric value of percent of staffed ICU beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_staff", -- Numeric value of percent of staffed pediatric ICU beds occupied by patients with any condition (7-day average) 
    "average_percent_staff_adult", -- Numeric value of percent of staffed adult ICU beds occupied by patients with any condition (7-day average) 
    "absolute_change_average_1", -- Absolute change in percent of staffed ICU beds occupied by patients with any condition (7-day average) from prior week 
    "average_percent_staff_icu", -- Numeric value of percent of staffed ICU beds occupied by patients with any condition (7-day average) 
    "average_percent_pediatric_1", -- Numeric value of percent of pediatric inpatient beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_adult_1", -- Numeric value of percent of adult inpatient beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_inpatient_1", -- Numeric value of percent of inpatient beds occupied by patients with confirmed COVID-19 (7-day average) 
    "average_percent_pediatric", -- Numeric value of percent of pediatric inpatient beds occupied by patients with any condition (7-day average) 
    "average_percent_adult", -- Numeric value of percent of adult inpatient beds occupied by patients with any condition (7-day average) 
    "absolute_change_average", -- Absolute change in percent of inpatient beds occupied by patients with any condition (7-day average) from prior week 
    "average_percent_inpatient", -- Numeric value of percent of inpatient beds occupied by patients with any condition (7-day average) 
    "percent_staff_pediatric_icu_1", -- Numeric value of percent of staffed pediatric ICU beds occupied by patients with confirmed COVID-19 
    "percent_staff_adult_icu_beds_1", -- Numeric value of percent of staffed adult ICU beds occupied by patients with confirmed COVID-19 
    "percent_staff_icu_beds_covid", -- Numeric value of percent of staffed ICU beds occupied by patients with confirmed COVID-19 
    "percent_staff_pediatric_icu", -- Numeric value of percent of staffed pediatric ICU beds occupied by patients with any condition 
    "percent_staff_adult_icu_beds", -- Numeric value of percent of staffed adult ICU beds occupied by patients with any condition 
    "percent_staff_icu_beds", -- Numeric value of percent of staffed ICU beds occupied by patients with any condition 
    "percent_pediatric_inpatient_1", -- Numeric value of percent of pediatric inpatient beds occupied by patients with confirmed COVID-19  
    "percent_adult_inpatient_beds_1", -- Numeric value of percent of adult inpatient beds occupied by patients with confirmed COVID-19  
    "percent_inpatient_beds_covid", -- Numeric value of percent of inpatient beds occupied by patients with confirmed COVID-19 
    "percent_pediatric_inpatient", -- Numeric value of percent of pediatric inpatient beds occupied by patients with any condition 
    "percent_adult_inpatient_beds", -- Numeric value of percent of adult inpatient beds occupied by patients with any condition 
    "percent_inpatient_beds", -- Numeric value of percent of inpatient beds occupied by patients with any condition 
    "staff_icu_patients_covid", -- Numeric value of prevalent hospitalizations of patients in the ICU with confirmed COVID-19 
    "staff_pediatric_icu_beds", -- Numeric value of total staffed pediatric ICU beds occupied by patients with any condition 
    "staff_adult_icu_beds_occupied", -- Numeric value of total staffed adult ICU beds occupied by patients with any condition 
    "icu_beds_used", -- Numeric value of total staffed ICU beds occupied by patients with any condition 
    "staff_icu_pediatric_patients", -- Numeric value of prevalent hospitalizations of pediatric patients in the ICU with confirmed COVID-19 
    "staff_icu_adult_patients", -- Numeric value of prevalent hospitalizations of adult patients in the ICU with confirmed COVID-19 
    "total_staffed_pediatric_icu", -- Numeric value of total staffed pediatric ICU beds 
    "total_staffed_adult_icu_beds", -- Numeric value of total staffed adult ICU beds 
    "total_icu_beds", -- Numeric value of total staffed ICU beds 
    "inpatient_pediatric_beds_1", -- Numeric value of total staffed pediatric inpatient beds occupied by patients with any condition 
    "inpatient_adult_beds_used", -- Numeric value of total staffed adult inpatient beds occupied by patients with any condition 
    "average_inpatient_beds_1", -- Numeric value of total staffed inpatient beds occupied by patients with any condition (7-day average) 
    "inpatient_beds_used", -- Numeric value of total staffed inpatient beds occupied by patients with any condition 
    "inpatient_pediatric_beds", -- Numeric value of total staffed pediatric inpatient beds  
    "inpatient_adult_beds", -- Numeric value of total staffed adult inpatient beds 
    "average_inpatient_beds", -- Numeric value of total staffed inpatient beds (7-day average) 
    "inpatient_beds", -- Numeric value of total staffed inpatient beds 
    "total_pediatric_patients", -- Numeric value of prevalent hospitalizations of pediatric patients with confirmed COVID-19 
    "total_adult_patients", -- Numeric value of prevalent hospitalizations of adult patients with confirmed COVID-19 
    "average_total_patients", -- Numeric value of prevalent hospitalizations of patients with confirmed COVID-19 (7-day average) 
    "total_patients_hospitalized", -- Numeric value of prevalent hospitalizations of patients with confirmed COVID-19 
    "percent_change_total", -- Percent change in the 7-day total number of new hospital admissions of patients with confirmed COVID-19 per 100,000 population from prior week 7-day total 
    "total_admissions_all_covid", -- Numeric value of new hospital admissions of patients with confirmed COVID-19 (7-day total) per 100,000 population 
    "average_admissions_18_29_1", -- Numeric value of new hospital admissions of patients ages 18 to 29 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_30_49_1", -- Numeric value of new hospital admissions of patients ages 30 to 49 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_20_29_1", -- Numeric value of new hospital admissions of patients ages 20 to 29 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_50_69_1", -- Numeric value of new hospital admissions of patients ages 50 to 69 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_70_covid_1", -- Numeric value of new hospital admissions of patients ages 70+ years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_40_49_1", -- Numeric value of new hospital admissions of patients ages 40 to 49 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_30_39_1", -- Numeric value of new hospital admissions of patients ages 30 to 39 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_all_covid_1", -- Numeric value of new hospital admissions of patients with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_50_59_1", -- Numeric value of new hospital admissions of patients ages 50 to 59 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_0_17_covid_1", -- Numeric value of new hospital admissions of patients ages 0 to 17 years with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "average_admissions_60_69_1", -- Numeric value of new hospital admissions of patients ages 60 to 69 with confirmed COVID-19 (7-Day Average) per 100,000 population 
    "admissions_60_69_covid", -- Numeric value of new hospital admissions of patients ages 60 to 69 years with confirmed COVID-19  
    "average_admissions_50_59", -- Numeric value of new hospital admissions of patients ages 50 to 59 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_70_covid", -- Numeric value of new hospital admissions of patients ages 70+ years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_0_17_covid", -- Numeric value of new hospital admissions of patients ages 0 to 17 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_20_29", -- Numeric value of new hospital admissions of patients ages 20 to 29 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_50_69", -- Numeric value of new hospital admissions of patients ages 50 to 69 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_30_49", -- Numeric value of new hospital admissions of patients ages 30 to 49 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_30_39", -- Numeric value of new hospital admissions of patients ages 30 to 39 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_60_69", -- Numeric value of new hospital admissions of patients ages 60 to 69 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_40_49", -- Numeric value of new hospital admissions of patients ages 40 to 49 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_18_29", -- Numeric value of new hospital admissions of patients ages 18 to 29 years with confirmed COVID-19 (7-Day Average) 
    "average_admissions_all_covid", -- Numeric value of new hospital admissions of patients with confirmed COVID-19 (7-Day Average)  
    "admissions_0_17_covid", -- Numeric value of new hospital admissions of patients ages 0 to 17 years with confirmed COVID-19 
    "admissions_20_29_covid", -- Numeric value of new hospital admissions of patients ages 20 to 29 years with confirmed COVID-19 
    "admissions_18_29_covid", -- Numeric value of new hospital admissions of patients ages 18 to 29 years with confirmed COVID-19 
    "admissions_40_49_covid", -- Numeric value of new hospital admissions of patients ages 40 to 49 years with confirmed COVID-19 
    "admissions_30_39_covid", -- Numeric value of new hospital admissions of patients ages 30 to 39 years with confirmed COVID-19 
    "admissions_50_59_covid", -- Numeric value of new hospital admissions of patients ages 50 to 59 years with confirmed COVID-19 
    "admissions_50_69_covid", -- Numeric value of new hospital admissions of patients ages 50 to 69 years with confirmed COVID-19 
    "admissions_30_49_covid", -- Numeric value of new hospital admissions of patients ages 30 to 49 years with confirmed COVID-19 
    "admissions_70_covid_confirmed", -- Numeric value of new hospital admissions of patients ages 70+ years with confirmed COVID-19 
    "admissions_all_covid_confirmed", -- Numeric value of new hospital admissions of patients with confirmed COVID-19 
    "total_hospitals", -- Total number of hospitals reporting any data for entire time period of dataset 
    "number_hospitals_reporting", -- Total number of hospitals reporting any data for the specified collection date 
    "collection_date", -- Collection Date 
    "jurisdiction" -- Name of Country, State, Territory, or HHS Region  
FROM
    "cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3:latest"."respiratory_virus_response_rvr_united_states"
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 cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3 with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.cdc.gov. When you querycdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

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 (like this repository), 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, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.cdc.gov, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3" \
  --handler-options '{
    "domain": "data.cdc.gov",
    "tables": {
        "respiratory_virus_response_rvr_united_states": "9t9r-e5a3"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

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, cdc-gov/respiratory-virus-response-rvr-united-states-9t9r-e5a3 is just another Postgres schema.