datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x
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 procotol. 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 public_health_suburban_cook_county_selected_causes table in this repository, by referencing it like:

"datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x:latest"."public_health_suburban_cook_county_selected_causes"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "sep_aar", -- Septicemia age-adjusted death rate per 100,000 population, ICD 10 code(s): A40-A41
    "sep_cr", -- Septicemia crude death rate per 100,000 population, ICD 10 code(s): A40-A41
    "sep_n", -- Septicemia number of deaths, ICD 10 code(s): A40-A41
    "pneum_aar", -- Pneumonia and Influenza age-adjusted death rate per 100,000 population, ICD 10 code(s): J10-J18
    "pneum_cr", -- Pneumonia and Influenza crude death rate per 100,000 population, ICD 10 code(s): J10-J18
    "pneum_n", -- Pneumonia and Influenza number of deaths, ICD 10 code(s): J10-J18
    "hiv_aar", -- HIV Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): B20-B24
    "hiv_cr", -- HIV Disease crude death rate per 100,000 population, ICD 10 code(s): B20-B24
    "perinatal_aar", -- Perinatal Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): P00-P96
    "perinatal_cr", -- Perinatal Disease crude death rate per 100,000 population, ICD 10 code(s): P00-P96
    "perinatal_n", -- Perinatal Disease number of deaths, ICD 10 code(s): P00-P96
    "conganom_aar", -- Congenital Anomalies age-adjusted death rate per 100,000 population, ICD 10 code(s): Q00-Q99
    "conganom_n", -- Congenital Anomalies number of deaths, ICD 10 code(s): Q00-Q99
    "suicide_aar", -- Suicide age-adjusted death rate per 100,000 population, ICD 10 code(s): X60-X84, U03, Y87.0
    "suicide_cr", -- Suicide crude death rate per 100,000 population, ICD 10 code(s): X60-X84, U03, Y87.0
    "suicide_n", -- Suicide number of deaths, ICD 10 code(s): X60-X84, U03, Y87.0
    "motveh_aar", -- Motor Vehicle Accident age-adjusted death rate per 100,000 population, ICD 10 code(s): V02-V04, V09.0, V09.2, V12-V14, V19.0-V19.2, V19.4-V19.6, V20-V79, V80.3-V80.5, V81.0-V81.1, V82.0-V82.1, V83-V86, V87.0-V87.8, V88.0-V88.8, V89.0, V89.2
    "motveh_cr", -- Motor Vehicle Accident crude death rate per 100,000 population, ICD 10 code(s): V02-V04, V09.0, V09.2, V12-V14, V19.0-V19.2, V19.4-V19.6, V20-V79, V80.3-V80.5, V81.0-V81.1, V82.0-V82.1, V83-V86, V87.0-V87.8, V88.0-V88.8, V89.0, V89.2
    "motveh_n", -- Motor Vehicle Accident number of deaths, ICD 10 code(s): V02-V04, V09.0, V09.2, V12-V14, V19.0-V19.2, V19.4-V19.6, V20-V79, V80.3-V80.5, V81.0-V81.1, V82.0-V82.1, V83-V86, V87.0-V87.8, V88.0-V88.8, V89.0, V89.2
    "firearms_aar", -- Firearm age-adjusted death rate per 100,000 population, ICD 10 code(s): U01.4, W32-W34, X72-X74, X93-X95, Y22-Y24, Y35.0
    "firearms_cr", -- Firearm crude death rate per 100,000 population, ICD 10 code(s): U01.4, W32-W34, X72-X74, X93-X95, Y22-Y24, Y35.0
    "firearms_n", -- Firearm number of deaths, ICD 10 code(s): U01.4, W32-W34, X72-X74, X93-X95, Y22-Y24, Y35.0
    "homicide_aar", -- Homicide age-adjusted death rate per 100,000 population, ICD 10 code(s): X85-Y09, U01-U02, Y87.1
    "homicide_n", -- Homicide number of deaths, ICD 10 code(s): X85-Y09, U01-U02, Y87.1
    "opioid_aar", -- Opioid-related Drug Overdose age-adjusted death rate per 100,000 population, ICD 10 code(s): T40.0-T40.4, T40.6
    "opioid_cr", -- Opioid-related Drug Overdose crude death rate per 100,000 population, ICD 10 code(s): T40.0-T40.4, T40.6
    "opioid_n", -- Opioid-related Drug Overdose number of deaths, ICD 10 code(s): T40.0-T40.4, T40.6
    "drugs_aar", -- Drug Overdose age-adjusted death rate per 100,000 population, ICD 10 code(s): D52.1, D59.0, D59.2, D61.1, D64.2, E06.4, E16.0, E23.1, E24.2, E27.3,E66.1, F11.0-F11.5,F11.7-F11.9, F12.0-F12.5, F12.7-F12.9, F13.0-F13.5,F13.7-F13.9, F14.0-F14.5,F14.7-F14.9, F15.0-F15
    "drugs_cr", -- Drug Overdose crude death rate per 100,000 population, ICD 10 code(s): D52.1, D59.0, D59.2, D61.1, D64.2, E06.4, E16.0, E23.1, E24.2, E27.3,E66.1, F11.0-F11.5,F11.7-F11.9, F12.0-F12.5, F12.7-F12.9, F13.0-F13.5,F13.7-F13.9, F14.0-F14.5,F14.7-F14.9, F15.0-F15
    "drugs_n", -- Drug Overdose number of deaths, ICD 10 code(s): D52.1, D59.0, D59.2, D61.1, D64.2, E06.4, E16.0, E23.1, E24.2, E27.3,E66.1, F11.0-F11.5,F11.7-F11.9, F12.0-F12.5, F12.7-F12.9, F13.0-F13.5,F13.7-F13.9, F14.0-F14.5,F14.7-F14.9, F15.0-F15
    "parkinsons_aar", -- Parkinson's Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): G20-21
    "parkinsons_cr", -- Parkinson's Disease crude death rate per 100,000 population, ICD 10 code(s): G20-21
    "parkinsons_n", -- Parkinson's Disease number of deaths, ICD 10 code(s): G20-21
    "nephritis_aar", -- Nephritis, Nephrosis, and Nephrotic Syndrome age-adjusted death rate per 100,000 population, ICD 10 code(s): N00-N07, N17-N19, N25-N27
    "nephritis_cr", -- Nephritis, Nephrosis, and Nephrotic Syndrome crude death rate per 100,000 population, ICD 10 code(s): N00-N07, N17-N19, N25-N27
    "nephritis_n", -- Nephritis, Nephrosis, and Nephrotic Syndrome number of deaths, ICD 10 code(s): N00-N07, N17-N19, N25-N27
    "chrliver_aar", -- Chronic Liver Disease and Cirrhosis age-adjusted death rate per 100,000 population, ICD 10 code(s): K70, K73-K74
    "chrliver_cr", -- Chronic Liver Disease and Cirrhosis crude death rate per 100,000 population, ICD 10 code(s): K70, K73-K74
    "asthma_aar", -- Asthma age-adjusted death rate per 100,000 population, ICD 10 code(s): J45-46
    "asthma_n", -- Asthma number of deaths, ICD 10 code(s): J45-46
    "alzheimers_aar", -- Alzheimer's Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): G303
    "alzheimers_cr", -- Alzheimer's Disease crude death rate per 100,000 population, ICD 10 code(s): G303
    "alzheimers_n", -- Alzheimer's Disease number of deaths, ICD 10 code(s): G303
    "chrlowresp_aar", -- Chronic Lower Respiratory Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): J40-J47
    "chrlowresp_cr", -- Chronic Lower Respiratory Disease crude death rate per 100,000 population, ICD 10 code(s): J40-J47
    "chrlowresp_n", -- Chronic Lower Respiratory Disease number of deaths, ICD 10 code(s): J40-J47
    "diabetes_aar", -- Diabetes (any cause) age-adjusted death rate per 100,000 population, ICD 10 code(s): E10-E14 (any cause of death)
    "diabetes_cr", -- Diabetes (any cause) crude death rate per 100,000 population, ICD 10 code(s): E10-E14 (any cause of death)
    "diabetes_n", -- Diabetes (any cause) number of deaths, ICD 10 code(s): E10-E14 (any cause of death)
    "hypertension_cr", -- Hypertension crude death rate per 100,000 population, ICD 10 code(s): I10, I12, I15
    "hypertension_n", -- Hypertension number of deaths, ICD 10 code(s): I10, I12, I15
    "heartdis_aar", -- Heart Disease age-adjusted death rate per 100,000 population, ICD 10 code(s): I00-I09, I11, I13, I20-I51
    "heartdis_cr", -- Heart Disease crude death rate per 100,000 population, ICD 10 code(s): I00-I09, I11, I13, I20-I51
    "heartdis_n", -- Heart Disease number of deaths, ICD 10 code(s): I00-I09, I11, I13, I20-I51
    "cerebrovas_aar", -- Cerebrovascular Disease (Stroke) age-adjusted death rate per 100,000 population, ICD 10 code(s): I60-I69
    "cerebrovas_cr", -- Cerebrovascular Disease (Stroke) crude death rate per 100,000 population, ICD 10 code(s): I60-I69
    "cerebrovas_n", -- Cerebrovascular Disease (Stroke) number of deaths, ICD 10 code(s): I60-I69
    "cardiovas_aar", -- All Cardiovascular Diseases age-adjusted death rate per 100,000 population, ICD 10 code(s): I00-I78
    "cardiovas_cr", -- All Cardiovascular Diseases crude death rate per 100,000 population, ICD 10 code(s): I00-I78
    "cardiovas_n", -- All Cardiovascular Diseases number of deaths, ICD 10 code(s): I00-I78
    "cervicalca_aar", -- Cervical Cancer age-adjusted death rate per 100,000 population, ICD 10 code(s): C53
    "cervicalca_cr", -- Cervical Cancer crude death rate per 100,000 population, ICD 10 code(s): C53
    "cervicalca_n", -- Cervical Cancer number of deaths, ICD 10 code(s): C53
    "prostateca_aar", -- Prostate Cancer age-adjusted death rate per 100,000 population, ICD 10 code(s): C61
    "prostateca_cr", -- Prostate Cancer crude death rate per 100,000 population, ICD 10 code(s): C61
    "prostateca_n", -- Prostate Cancer number of deaths, ICD 10 code(s): C61
    "breastca_aar", -- Breast Cancer (female) age-adjusted death rate per 100,000 population, ICD 10 code(s): C50, Females Only
    "breastca_cr", -- Breast Cancer (female) crude death rate per 100,000 population, ICD 10 code(s): C50, Females Only
    "breastca_n", -- Breast Cancer (female) number of deaths, ICD 10 code(s): C50, Females Only
    "lungca_aar", -- Bronchus and Lung Cancer age-adjusted death rate per 100,000 population, ICD 10 code(s): C34
    "lungca_cr", -- Bronchus and Lung Cancer crude death rate per 100,000 population, ICD 10 code(s): C34
    "lungca_n", -- Bronchus and Lung Cancer number of deaths, ICD 10 code(s): C34
    "coloca_cr", -- Colorectal Cancer crude death rate per 100,000 population, ICD 10 code(s): C18-C21
    "coloca_n", -- Colorectal Cancer number of deaths, ICD 10 code(s): C18-C21
    "cancer_aar", -- All Cancers age-adjusted death rate per 100,000 population, ICD 10 code(s): C00-C97
    "cancer_cr", -- All Cancers crude death rate per 100,000 population, ICD 10 code(s): C00-C97
    "cancer_n", -- All Cancers number of deaths, ICD 10 code(s): C00-C97
    "death_aar", -- All Causes age-adjusted death rate per 100,000 population, ICD 10 code(s): ALL
    "death_cr", -- All Causes crude death rate per 100,000 population, ICD 10 code(s): ALL
    "death_n", -- All Causes number of deaths, ICD 10 code(s): ALL
    "agegroup", -- Deceden't age group at time of death
    "newrace", -- Decedent's Race/Ethnicity
    "newsex", -- Decedent's Gender
    "place", -- Decedent's Place of Residence
    "year", -- Year(s) of Death
    "hiv_n", -- HIV Disease number of deaths, ICD 10 code(s): B20-B24
    "conganom_cr", -- Congenital Anomalies crude death rate per 100,000 population, ICD 10 code(s): Q00-Q99
    "homicide_cr", -- Homicide crude death rate per 100,000 population, ICD 10 code(s): X85-Y09, U01-U02, Y87.1
    "chrliver_n", -- Chronic Liver Disease and Cirrhosis number of deaths, ICD 10 code(s): K70, K73-K74
    "asthma_cr", -- Asthma crude death rate per 100,000 population, ICD 10 code(s): J45-46
    "hypertension_aar", -- Hypertension age-adjusted death rate per 100,000 population, ICD 10 code(s): I10, I12, I15
    "coloca_aar" -- Colorectal Cancer age-adjusted death rate per 100,000 population, ICD 10 code(s): C18-C21
FROM
    "datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x:latest"."public_health_suburban_cook_county_selected_causes"
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 datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at datacatalog.cookcountyil.gov. When you querydatacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x: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)"
 

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 datacatalog.cookcountyil.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 \
  "datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x" \
  --handler-options '{
    "domain": "datacatalog.cookcountyil.gov",
    "tables": {
        "public_health_suburban_cook_county_selected_causes": "r5wk-nc2x"
    }
}'

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, datacatalog-cookcountyil-gov/public-health-suburban-cook-county-selected-causes-r5wk-nc2x is just another Postgres schema.

Related Documentation: