ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2
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 public_assistance_and_supplemental_nutrition table in this repository, by referencing it like:

"ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2:latest"."public_assistance_and_supplemental_nutrition"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "border_unresolved", -- Percentage of TA/SNAP cases on the Bordering States match that were not investigated during the reporting period. Available from 2019 Q4.
    "prison_total_matches", -- Number of TA/SNAP recipients potentially in prison to be investigated during the reporting period.
    "prison_closed_prior_resolved", -- Percentage of TA/SNAP recipients on the Prison match that were closed before the case was investigated.
    "quarter", -- Calendar quarter the data pertains to.
    "feds_total_investigated", -- Number of Front End Detection System (FEDS) TA/SNAP case referrals that were investigated during the reporting period.
    "feds_cases_no_impact", -- Percentage of investigated TA/SNAP cases where a discrepancy was identified but it had no effect on the case’s budget.
    "prison_closed_resolved", -- Percentage of TA/SNAP recipients on the Prison match that were closed as a result of the investigation.
    "paris_exonerated_resolved", -- Percentage of TA/SNAP recipients on the Public Assistance Reporting Information System (PARIS) match that were eligible for benefits as a result of the investigation.
    "border_closed_prior", -- Percentage of TA/SNAP recipients on the Bordering States match that were closed before the case was investigated. Available from 2019 Q4.
    "district_cd", -- Contains a code ranging from 01 to 57 and 66, designating each of the State’s Local Social Services Districts, which are New York City and the remaining 57 counties. For the non-New York City counties, the code refers to the alphabetical order of the district name (e.g., Albany=01, Yates = 57). For New York City, the code is 66.
    "year", -- Calendar year of the calendar quarter the data pertains to. Reporting is by calendar quarter.
    "district", -- Text name of each social services district.
    "feds_cases_referred", -- Percentage of Front End Detection System (FEDS) new Temporary Assistance / Supplemental Nutrition Assistance Program  (TA/SNAP) case applications that were referred for investigation.
    "feds_cases_denied_grant_reduced", -- Percentage of investigated TA/SNAP cases that were either denied or grant reduced.
    "feds_cases_no_errors", -- Percentage of investigated TA/SNAP cases where no discrepancy was identified.
    "ipv_positive_investigations", -- Number of Intentional Program Violations (IPVs) on TA/SNAP cases that were investigated during the reporting period.
    "total_ipvs", -- Percentage of TA/SNAP cases that were investigated and resulted in an Intentional Program Violation (IPV).
    "prison_exonerated_resolved", -- Percentage of TA/SNAP recipients on the Prison match that were eligible for benefits as a result of the investigation.
    "prison_unresolved", -- Percentage of TA/SNAP cases on the Prison match that were not investigated during the reporting period.
    "paris_total_matches", -- Number of TA/SNAP recipients potentially receiving benefits in another state to be investigated during the reporting period.
    "paris_closed_prior_resolved", -- Percentage of TA/SNAP recipients on the Public Assistance Reporting Information System (PARIS) match that were closed before the case was investigated.
    "paris_closed_resolved", -- Percentage of TA/SNAP recipients on the Public Assistance Reporting Information System (PARIS) match that were closed as a result of the investigation.
    "paris_unresolved", -- Percentage of TA/SNAP cases on the Public Assistance Reporting Information System (PARIS) match that were not investigated during the reporting period.
    "border_total_matches", -- Number of TA/SNAP recipients potentially receiving benefits in another state to be investigated during the reporting period. Available from 2019 Q4.
    "border_closed", -- Percentage of TA/SNAP recipients on the Bordering States match that were closed as a result of the investigation. Available from 2019 Q4.
    "border_exonerated" -- Percentage of TA/SNAP recipients on the Bordering States match that were eligible for benefits as a result of the investigation. Available from 2019 Q4.
FROM
    "ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2:latest"."public_assistance_and_supplemental_nutrition"
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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2 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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2: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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2

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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2:latest

This will download all the objects for the latest tag of ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2 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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2: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 ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2: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, ny-gov/public-assistance-and-supplemental-nutrition-uubd-eei2 is just another Postgres schema.

Related Documentation:

Loading...