pa-gov/health-education-related-locations-statewide-da8t-93kj
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 health_education_related_locations_statewide table in this repository, by referencing it like:

"pa-gov/health-education-related-locations-statewide-da8t-93kj:latest"."health_education_related_locations_statewide"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "ddap_latitude_",
    "drugtakebackbox_box_status",
    "drugtakebackbox_attention",
    "drugtakebackbox_longitude",
    "drugtakebackbox_latitude",
    "nursing_chief_executive_title",
    "nursing_cheif_executive_name",
    "elrc_fax_number",
    "elrc_website",
    "elrc_county",
    "aging_website",
    "licensed_personal_care_home_street_additional", -- Street Additional Information
    "licensed_personal_care_home_total_capacity", -- Total Capacity
    "licensed_personal_care_home_object_id",
    "education_addressline2", -- Additional Information for Education entity addresses
    "education_school", -- Number associated with the Educational Institution
    "education_aun", -- Administrative Unit Number (AUN) - A 9-digit number assigned by the Pennsylvania Department of Education (PDE) to uniquely identify entities such as school districts, intermediate units, career and technical centers, charter schools, non-public and private schools, higher education institutions, state juvenile correctional institutions, dioceses, private residential rehabilitation institutions, private driver training schools, and libraries
    "child_care_provider_legal_entity_county",
    "child_care_provider_legal_entity_state_fips_code",
    "child_care_provider_legal_entity_state",
    "child_care_provider_legal_entity_address",
    "child_care_provider_legal_entity_name",
    "child_care_provider_head_start_state_supplemental",
    "child_care_provider_license_expiration_date",
    "child_care_provider_license_issue_date",
    "child_care_provider_responsible_person_first_name",
    "child_care_providers_facility_email",
    "child_care_providers_facility_county_fips_code",
    "child_care_provider_mpi_location_id",
    "child_care_provider_mpi_id",
    "sthealthcntr_fax_number", -- Fax Number of the Health related locations
    "longitude", -- Latitude of the Health related locations
    "latitude", -- Longitude of the Health related locations
    "city", -- Street of the Health related locations
    "address", -- Address of the Health related locations
    "child_care_provider_negative_sanctions",
    "ddap_longitude",
    "drugtakebackbox_location_1",
    "drugtakebackbox_county",
    "drugtakebackbox_state_fips",
    "dispensaries_open_on",
    "dispensaries_marijuana_available_beginning",
    "edcuation_zipcodeextn", -- Education Entity Zip Code additional 4-digit
    "child_care_provider_legal_entity_zip_code",
    "child_care_provider_responsible_person_last_name",
    "name", -- Name of the Health related locations
    "drugtakebackbox_hours_of_availability",
    "nursing_contact_email",
    "nursing_object_id",
    "aging_county",
    "licensed_personal_care_home_program_office", -- Program Office
    "education_grades", -- Grades that exist in the Educational Institution
    "child_care_provider_legal_entity_location",
    "child_care_provider_legal_entity_county_fips",
    "child_care_provider_legal_entity_address_continued",
    "child_care_provider_facility_county",
    "child_care_provider_star_level_effective_date",
    "layername", -- Health related locations Layer
    "dispensaries_object_id",
    "aging_additional_information",
    "aging_item_type",
    "ddap_county",
    "child_care_provider_elrc",
    "child_care_providers_facility_fax",
    "nursing_contact_name",
    "licensed_personal_care_home_accuracy", -- Accuracy of the Latitude and Longitude: X is for an intersection, 5 is interpolated house on street, 4 is street centroid, 3 is Zip Code + Extension centroid, 2 is Zip + 2 centroid, and 1 is Zip centroid.
    "child_care_provider_legal_entity_city",
    "child_care_provider_facility_address_continued",
    "licensed_personal_care_home_type_served", -- Type Served
    "drugtakebackbox_grant_owned",
    "aging_path",
    "child_care_provider_school_age_provider",
    "nursing_county",
    "nursing_facility_id_number",
    "aging_address_2",
    "child_care_provider_star_level",
    "child_care_provider_license_number",
    "phonenumber", -- Phone Number
    "zip", -- Zip Code of the Health related locations
    "drugtakebackbox_status",
    "dispensaries_available_on_10_04_19",
    "child_care_providers_facility_state_fips_code",
    "dispensaries_geocoding_certainty",
    "dispensaries_facility_id",
    "elrc_additional_address",
    "state", -- State of the Health related locations
    "child_care_provider_type",
    "aging_modified",
    "nursing_contact_number",
    "child_care_provider_responsible_person_title",
    "child_care_provider_capacity",
    "child_care_provider_pa_pre_k_counts",
    "the_geom", -- The Geometrical point
    ":@computed_region_3x3q_vpda", -- This column was automatically created in order to record in what polygon from the dataset 'US House Districts for PA 2019' (3x3q-vpda) the point in column 'child_care_provider_legal_entity_location' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_4fjn_fq7k", -- This column was automatically created in order to record in what polygon from the dataset 'PA County Boundaries Spatial Data Current Transportation' (4fjn-fq7k) the point in column 'child_care_provider_legal_entity_location' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    "nursing_facility_url",
    "dispensaries_facility_url",
    "education_webaddress", -- Web Address if available for the Educational Institution
    "more_info", -- This link will provide additional information.
    "directions" -- This link will open an external mapping application to help you navigate to this point of interest. 
FROM
    "pa-gov/health-education-related-locations-statewide-da8t-93kj:latest"."health_education_related_locations_statewide"
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 pa-gov/health-education-related-locations-statewide-da8t-93kj 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 pa-gov/health-education-related-locations-statewide-da8t-93kj: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 pa-gov/health-education-related-locations-statewide-da8t-93kj

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 pa-gov/health-education-related-locations-statewide-da8t-93kj:latest

This will download all the objects for the latest tag of pa-gov/health-education-related-locations-statewide-da8t-93kj 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 pa-gov/health-education-related-locations-statewide-da8t-93kj: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 pa-gov/health-education-related-locations-statewide-da8t-93kj: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, pa-gov/health-education-related-locations-statewide-da8t-93kj is just another Postgres schema.

Related Documentation:

Loading...