Query the Data Delivery Network
Query the DDNThe 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 individual_provider_network_data_2019_quarter_2
table in this repository, by referencing it like:
"health-data-ny-gov/individual-provider-network-data-2019-quarter-2-3h7m-vjgp:latest"."individual_provider_network_data_2019_quarter_2"
or in a full query, like:
SELECT
":id", -- Socrata column ID
"primspec", -- Primary specialty of the provider. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"secdspec", -- Secondary specialty of the provider. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"nysohdental3ind", -- New York State of Health (NYSOH) Individual Dental Network Indicator (1-4) 0=No 1=Yes
"hospcert", -- Operating certificate (OPCERT) number of hospitals affiliated with the provider (1-3)
"longitude", -- System-generated longitude for reported address
"nonmcovis3ind", -- Commercial Non-Managed Care Organization (MCO) Vision 3 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"lang2", -- Language that a provider or clinical staff member can speak to a member (1-7)
"nysohdental1ind", -- New York State of Health (NYSOH) Individual Dental Network Indicator (1-4) 0=No 1=Yes
"sitenpi", -- Provider facility’s National Provider Identifier (NPI
"address1_std", -- Standardized street address of the site
"hspcert3", -- Operating certificate (OPCERT) number of hospitals affiliated with the provider (1-3)
"medsid",
"nonmcodent1ind", -- Commercial Non-Managed Care Organization (MCO) Dental 1 Indicator 0=No 1=Yes Commercial Non-MCO Dental Indicator 1-5 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nonmcovis4ind", -- Commercial Non-Managed Care Organization (MCO) Vision 4 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nonmcovis2ind", -- Commercial Non-Managed Care Organization (MCO) Vision 2 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nysohmedical3ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"truecountyname", -- County Name
"lang3", -- Language that a provider or clinical staff member can speak to a member (1-7)
"zip_std", -- Standardized zip code
"lang1", -- Language that a provider or clinical staff member can speak to a member (1-7)
"lang6", -- Language that a provider or clinical staff member can speak to a member (1-7)
"chpind", -- Child Health Plus (CHP) Indicator 0=No 1=Yes
"nysohmedical2ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"pficert1", -- Permanent Facility Identifier (PFI) corresponding to HAOPECRT (1-3)
"lang4", -- Language that a provider or clinical staff member can speak to a member (1-7)
"sitename", -- Standardized name of the office or facility building
"pcapind", -- Partial Capitated (CAPS) Indicator 0=No 1=Yes
"lang5", -- Language that a provider or clinical staff member can speak to a member (1-7)
"nonmcomed8ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 8 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"harpind", -- Health and Recovery Plan Indicator (HARP) 0=No 1=Yes
"nysohdental2ind", -- New York State of Health (NYSOH) Individual Dental Network Indicator (1-4) 0=No 1=Yes
"quarter", -- Quarter and year of data submission
"brdstat", -- Level of education/training completed by a provider towards a recognized medical specialty certificate for the provider’s primary specialty. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"hspcert2", -- Operating certificate (OPCERT) number of hospitals affiliated with the provider (1-3)
"stdfirstname", -- Standardized first name of provider
"npi", -- The National Provider Identifier (NPI) is a 10-digit identification number issued to health care providers
"rmnumber", -- Room or suite number of the provider’s office
"nonmcodent3ind", -- Commercial Non-Managed Care Organization (MCO) Dental 3 Indicator 0=No 1=Yes Commercial Non-MCO Dental Indicator 1-5 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nonmcomed1ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 1 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"stdlastname", -- Standardized last name of provider
"lang7", -- Language that a provider or clinical staff member can speak to a member (1-7)
"nonmcomed3ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 3 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"state_std", -- Standardized state name
"city_std", -- Standardized name of the town or city
"bhpaind", -- New York State of Health (NYSOH) Standard Essential Health Plan (EP) Indicator/Basic Health Program Indicator 0=No 1=Yes
"hivsnpind", -- HIV (Human Immunodeficiency Virus) Special Needs Plans Indicator 0=No 1=Yes
"nonmcodent5ind", -- Commercial Non-Managed Care Organization (MCO) Dental 5 Indicator 0=No 1=Yes Commercial Non-MCO Dental Indicator 1-5 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"brdstat2", -- Level of education/training completed by a provider towards a recognized medical specialty certificate for the provider’s secondary specialty. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"nysohmedical5ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"nysohmedical6ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"nonmcodent2ind", -- Commercial Non-Managed Care Organization (MCO) Dental 2 Indicator 0=No 1=Yes Commercial Non-MCO Dental Indicator 1-5 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nysohmedical1ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"latitude", -- System-generated latitude for reported address
"provtype", -- Degree or licensure of the provider. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"pficert3", -- Permanent Facility Identifier (PFI) corresponding to HAOPECRT (1-3)
"nonmcomed7ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 7 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"fidaind", -- Fully-Integrated Dual Advantage (FIDA) Indicator 0=No 1=Yes
"fidaiddind", -- Fully-Integrated Dual Advantage for Individuals with Intellectual and Developmental Disabilities (FIDAIDD) Indicator 0=No 1=Yes
"planname", -- Name of submitted health plan
"wheelchr", -- Whether the office is wheelchair accessible 0=No 1=Yes
"primdesg", -- Primary designation of a provider. Refer to codes in the PNDS data dictionary: https://www.health.ny.gov/health_care/managed_care/docs/dictionary.pdf
"maind", -- 0=No 1=Yes
"nysohmedical7ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"commind", -- 0=No 1=Yes
"mcaidind", -- 0=No 1=Yes
"nonmcomed5ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 5 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nonmcomed4ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 4 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"truecountyfips", -- Federal Information Processing Standard (FIPS) county or borough code, based on geolocation
"nysohmedical9ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"nonmcovis6ind", -- Commercial Non-Managed Care Organization (MCO) Vision 6 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"sipind", -- SIP-PL (Specialized I/DD Plans- Provider Led) Indicator 0=No 1=Yes
"nonmcovis5ind", -- Commercial Non-Managed Care Organization (MCO) Vision 5 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"pndsid", -- Provider Network Data System (PNDS) identification number associated with plan submitter
"nonmcovis1ind", -- Commercial Non-Managed Care Organization (MCO) Vision 1 Indicator 0=No 1=Yes Commercial Non-MCO Vision Indicator 1-6 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"nonmcomed6ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 6 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"gender", -- 1=Male 2=Female
"nysohdental4ind", -- New York State of Health (NYSOH) Individual Dental Network Indicator (1-4) 0=No 1=Yes
"provcert", -- Operating certificate (OPCERT) number of the provider’s location
"nysohmedical8ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"nonmcomed2ind", -- Commercial Non-Managed Care Organization (MCO) Medical Indicator 2 0=No 1=Yes Commercial Non-MCO Medical Indicator (1-8) THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"mapind", -- Medicaid Advantage Plus (MAP) Indicator 0=No 1=Yes
"provpfi", -- The Permanent Facility Identifier (PFI) of the provider’s location
"nysohmedical4ind", -- New York State of Health (NYSOH) Individual Network Indicator (1-10) 0=No 1=Yes
"bhpind", -- New York State of Health Standard Essential Health Plan (EP) Indicator/Basic Health Program Indicator 0=No 1=Yes
"nonmcodent4ind", -- Commercial Non-Managed Care Organization (MCO) Dental 4 Indicator 0=No 1=Yes Commercial Non-MCO Dental Indicator 1-5 THIS IS CONSOLIDATED IN THE DICTIONARY ONLY
"paceind", -- Programs of All-Inclusive Care for the Elderly (PACE) Indicator 0=No 1=Yes
"pficert2" -- Permanent Facility Identifier (PFI) corresponding to HAOPECRT (1-3)
FROM
"health-data-ny-gov/individual-provider-network-data-2019-quarter-2-3h7m-vjgp:latest"."individual_provider_network_data_2019_quarter_2"
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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp
with SQL in under 60 seconds.
Query Your Local Engine
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; sgr
can 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 clone
and sgr checkout
.
Cloning Data
Because health-data-ny-gov/individual-provider-network-data-2019-quarter-2-3h7m-vjgp: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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp
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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp:latest
This will download all the objects for the latest
tag of health-data-ny-gov/individual-provider-network-data-2019-quarter-2-3h7m-vjgp
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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp: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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp: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/individual-provider-network-data-2019-quarter-2-3h7m-vjgp
is just another Postgres schema.