health-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie
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 certificate_of_need_applications_beginning_1974 table in this repository, by referencing it like:

"health-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie:latest"."certificate_of_need_applications_beginning_1974"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "actual_construction_completion_date", -- Actual date construction was completed.
    "assigned_contstruction_completion_date", -- Date construction is scheduled to be completed, as submitted by the applicant.
    "acs_letter_sent_date", -- Date the “All contingencies satisfied” letter was issued (related to Construction projects).
    "director_action", -- Name of the Committee or Council that took an action.
    "council_date_2", -- Date the recommendation or decision was made by the Committee or Council.
    "council_action_2", -- The recommendation or decision of the Committee or Council.
    "council_date_1", -- Date the recommendation or decision was made by the Committee or Council.
    "proposed_operator_address_line1", -- Address Line 1 of the proposed operator.
    "proposed_operator_operating_certificate_number", -- Operating Certificate number of the proposed operator (if applicable).
    "current_operator_address_line1", -- Address Line 1 of the current operator.
    "project_site_zip_code", -- Zip Code where the project site is located.
    "project_site_city", -- City where the project site is located.
    "project_site_address_line2", -- Address Line 2 of the project site.
    "project_site_address_line1", -- Address Line 1 of the project site.
    "project_site_facility_identifier", -- Facility ID of the project site (if applicable).
    "main_site_county_name", -- County where the Facility's main site is located.
    "main_site_address_line2", -- Address Line 2 of the Facility's main site.
    "main_site_address_line1", -- Address Line 1 of the Facility's main site.
    "main_site_facility_name", -- Name of the Facility's main site.
    "acknowledgement_date", -- Date the CON application was determined to be minimally complete and reviewable.
    "project_status", -- Status of a project (e.g., Under Review, Told to Contact Area Office).
    "revision_reason", -- Significant change to the project, from the original submission, prior to approval.
    "project_description", -- Brief narrative description of the project
    "main_site_facility_identifier", -- Facility ID of the Facility's main site.
    "council_name_8", -- Name of the Committee or Council that took an action.
    "council_date_6", -- Date the recommendation or decision was made by the Committee or Council.
    "council_date_4", -- Date the recommendation or decision was made by the Committee or Council.
    "proposed_operator_zip_code", -- Zip Code of the proposed operator.
    "proposed_operator_state", -- State of the proposed operator.
    "proposed_operator_city", -- City of the proposed operator.
    "main_site_zip_code", -- Zip Code where the Facility's main site is located.
    "application_received_month", -- The month number that the CON application was received.
    "proposed_operator_address_line2", -- Address Line 2 of the proposed operator.
    "council_name_1", -- Name of the Committee or Council that took an action.
    "facility_name", -- The current facility name or the applicant-submitted proposed facility name
    "actual_construction_start_date", -- Actual date construction was started.
    "assigned_construction_start_date", -- Date construction is scheduled to be started, as submitted by the applicant.
    "phc_final_approval_letter_sent", -- Date the PHHPC Final Approval letter was issued (related to Establishment projects).
    "director_action_date", -- Date of the Director Action
    "council_date_3", -- Date the recommendation or decision was made by the Committee or Council.
    "current_operator_zip_code", -- Zip Code of the current operator.
    "current_operator_state", -- State of the current operator.
    "current_operator_address_line2", -- Address Line 2 of the current operator.
    "project_site_county_name", -- County where the project site is located.
    "council_action_6", -- The recommendation or decision of the Committee or Council.
    "current_operator_county_name", -- County of the current operator.
    "current_operator_city", -- City of the current operator.
    "submission_type_s", -- Defines the type of application submitted.
    "council_name_7", -- Name of the Committee or Council that took an action.
    "council_action_1", -- The recommendation or decision of the Committee or Council.
    "project_status_date", -- The last date the status of the project changed.
    "council_date_7", -- Date the recommendation or decision was made by the Committee or Council.
    "council_date_5", -- Date the recommendation or decision was made by the Committee or Council.
    "project_site_facility_name", -- Name or proposed name of the project site.
    "application_received_date", -- Date CON application was received.
    "project_cost", -- Capital cost of project, identified by the applicant, at the time of CON submission
    "con_project_number", -- Project / Certificate of Need (CON) application number
    "proposed_operator_county_name", -- County of the proposed operator.
    "council_action_10", -- The recommendation or decision of the Committee or Council.
    "proposed_operator_name", -- Name of the proposed operator.
    "current_operator_operating_certificate_number", -- Operating Certificate number of the current operator of the facility.
    "current_operator_name", -- Name of the current operator of the facility.
    "main_site_city", -- City where the Facility's main site is located.
    "initial_review_date", -- Date the CON application was initially reviewed for acceptability and minimal completeness.
    "application_received_year", -- 4 digit year that the CON application was received.
    "review_level", -- Defines the type of CON application review (Full, Administrative, Limited).
    "facility_id", -- Site specific facility identification number
    "council_date_8", -- Date the recommendation or decision was made by the Committee or Council.
    "council_name_6", -- Name of the Committee or Council that took an action.
    "council_action_5", -- The recommendation or decision of the Committee or Council.
    "region", -- Health Systems Agency service area.
    "council_name_5", -- Name of the Committee or Council that took an action.
    "council_date_10", -- Date the recommendation or decision was made by the Committee or Council.
    "council_name_2", -- Name of the Committee or Council that took an action.
    "facility_type", -- A description of the type of facility.
    "council_name_4", -- Name of the Committee or Council that took an action.
    "council_action_4", -- The recommendation or decision of the Committee or Council.
    "project_site_state", -- State of the project site (always New York State).
    "council_name_3", -- Name of the Committee or Council that took an action.
    "council_action_8", -- The recommendation or decision of the Committee or Council.
    "council_action_9", -- The recommendation or decision of the Committee or Council.
    "council_action_7",
    "council_action_3", -- The recommendation or decision of the Committee or Council.
    "main_site_state", -- State of the Facility's main site (always New York State).
    "council_date_9", -- Date the recommendation or decision was made by the Committee or Council.
    "council_name_10", -- Name of the Committee or Council that took an action.
    "council_name_9" -- Name of the Committee or Council that took an action.
FROM
    "health-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie:latest"."certificate_of_need_applications_beginning_1974"
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/certificate-of-need-applications-beginning-1974-h343-jwie with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at health.data.ny.gov. When you queryhealth-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie: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 health.data.ny.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 \
  "health-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie" \
  --handler-options '{
    "domain": "health.data.ny.gov",
    "tables": {
        "certificate_of_need_applications_beginning_1974": "h343-jwie"
    }
}'

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, health-data-ny-gov/certificate-of-need-applications-beginning-1974-h343-jwie is just another Postgres schema.