health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b
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 institutional_provider_network_data_2019_quarter_3 table in this repository, by referencing it like:

"health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b:latest"."institutional_provider_network_data_2019_quarter_3"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "provider_network_data_system", -- Provider Network Data System (PNDS) identification number associated with plan submitter
    "plan_name", -- Name of submitted health plan
    "omh_id", -- Office of Mental Health (OMH) Home and Community Based Services (HCBS) Number or OMH License (OPCERT)
    "oasas_program_reporting_unit", -- Office of Alcoholism and Substance Abuse Services (OASAS) Program Reporting Unit (PRU) number
    "servicing_county_5", -- Surrounding counties being serviced using FIPS code
    "servicing_county_4", -- Surrounding counties being serviced using FIPS code
    "servicing_county_3", -- Surrounding counties being serviced using FIPS code
    "servicing_county_2", -- Surrounding counties being serviced using FIPS code
    "servicing_county_1", -- Surrounding counties being serviced using FIPS code
    "nysoh_medical_network_1", -- New York State of Health Medical Network Indicator
    "service_24", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_23", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_22", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_21", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_20", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_19", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_18", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_17", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_16", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_14", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_13", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_11", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_10", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_9", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_8", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_6", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_5", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_4", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_3", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_2", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_1", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "partial_caps_indicator", -- Partial Capitated (CAPS) Indicator; 0=No 1=Yes
    "harp_indicator", -- Health and Recovery Plan Indicator (HARP); 0=No 1=Yes
    "medicaid_provider", -- Medicaid Provider identification number
    "npi", -- The National Provider Identifier (NPI) is a 10-digit identification number issued to health care providers and facilities
    "designated_service", -- Refer to codes in the PNDS data dictionary
    "phone_number", -- Phone number of the site
    "area_code", -- Area code of the site
    "longitude", -- System-generated longitude for reported address
    "zip_code", -- Standardized zip code
    "state", -- Standardized state name
    "county_name", -- County name, based on geolocation
    "county_fips", -- Federal Information Processing Standard (FIPS) county code, based on geolocation
    "town_city", -- Name of town or city, standardized
    "address", -- Street address of the site
    "room_suite", -- Room or suite number. If not applicable, appears as "NA"
    "site_name", -- Standardized name of office or professional building
    "oasas_provider_number", -- Office of Alcoholism and Substance Abuse Services (OASAS) Provider number
    "service_15", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "service_7", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "sip_pl_indicator", -- SIP-PL (Specialized I/DD Plans- Provider Led) Indicator; 0=No 1=Yes
    "pfi", -- The Permanent Facility Identifier (PFI) is a unique number assigned to each hospital or clinic by the Department of Health.
    "license_number_facility", -- The license number or facility operating certificate of a service provider, if applicable
    "nysoh_medical_network_2", -- New York State of Health Medical Network Indicator
    "service_12", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "commercial_non_mco_medical_5", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_non_mco_medical_1", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "nysoh_ep_plus_adult_vision", -- New York State of Health (NYSOH) Standard Essential Health Plan (EP) Indicator/Basic Health Program Indicator; 0=No 1=Yes
    "nysoh_standard_essential", -- New York State of Health Standard Essential Health Plan (EP) Indicator/Basic Health Program Indicator; 0=No 1=Yes
    "fidaidd_indicator", -- Fully-Integrated Dual Advantage for Individuals with Intellectual and Developmental Disabilities (FIDA IDD) Indicator; 0=No 1=Yes
    "latitude", -- System-generated latitude for reported address
    "quarter", -- Quarter and year of data submission
    "nysoh_medical_network_5", -- New York State of Health Medical Network Indicator
    "commercial_non_mco_medical", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_non_mco_medical_6", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_non_mco_medical_4", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_provider_indicator", -- Commercial Provider Indicator; 0=No 1=Yes
    "nysoh_medical_network_3", -- New York State of Health Medical Network Indicator
    "service_25", -- Services offered by the facility. See appendix in the PNDS data dictionary.
    "map_indicator", -- Medicaid Advantage Plus (MAP) Indicator; 0=No 1=Yes
    "nysoh_medical_network_7", -- New York State of Health Medical Network Indicator
    "nysoh_medical_network_6", -- New York State of Health Medical Network Indicator
    "fida_indicator", -- Fully-Integrated Dual Advantage (FIDA) Indicator; 0=No 1=Yes
    "hivsnp_indicator", -- HIV (Human Immunodeficiency Virus) Special Needs Plans Indicator; 0=No 1=Yes
    "nysoh_medical_network_8", -- New York State of Health Medical Network Indicator
    "nysoh_medical_network_4", -- New York State of Health Medical Network Indicator
    "nysoh_medical_network", -- New York State of Health Medical Network Indicator
    "commercial_non_mco_medical_7", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_non_mco_medical_3", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "commercial_non_mco_medical_2", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator
    "pace_indicator", -- Programs of All-Inclusive Care for the Elderly (PACE) Indicator; 0=No 1=Yes
    "medicaid_advantage_indicator", -- Medicaid Advantage Indicator; 0=No 1=Yes
    "chp_indicator", -- Child Health Plus (CHP) Indicator; 0=No 1=Yes
    "medicaid_provider_indicator" -- Medicaid Provider Indicator; 0=No 1=Yes
FROM
    "health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b:latest"."institutional_provider_network_data_2019_quarter_3"
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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b 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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b: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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b

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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b:latest

This will download all the objects for the latest tag of health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b 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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b: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 health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b: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, health-data-ny-gov/institutional-provider-network-data-2019-quarter-3-v67e-nc2b is just another Postgres schema.

Related Documentation:

Loading...