health-data-ny-gov/home-care-registry-training-data-beginning-2009-72qx-k28n
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 home_care_registry_training_data_beginning_2009 table in this repository, by referencing it like:

"health-data-ny-gov/home-care-registry-training-data-beginning-2009-72qx-k28n:latest"."home_care_registry_training_data_beginning_2009"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    ":@computed_region_9yqb_tdyd",
    "withdrawn_student_count", -- Total number of students in Withdrawn status. Note: The status ‘Withdrawn’ describes those individuals who  withdrew from the training class without the course completion.
    "street_address", -- The street address of the Home Health Care Agency.
    "city", -- City where the Home Health Care Agency is located. 
    "state", -- State of the Home Health Care Agency.
    "county_code", -- County Code
    "county_name", -- County where the Home Health Care Agency is located.
    "approved_student_count", -- Total number of students in Approved status.
    "zip_code", -- Zip Code where the Home Health Care Agency is located.
    "region", -- The Regional location of the Training Agency site
    "geocoded_column_zip",
    "geocoded_column",
    "enrolled_student_count", -- Total number of students in Enrolled status. Note: The status ‘Enrolled’ describes those individuals who are currently registered in a training class. 
    "geocoded_column_address",
    "certified_student_count", -- Total number of students in Certified status. Note: An individual is considered certified when an authorized  Official has signed and notarized the Certification form, attesting to  the aide’s identity and his/her successful completion of the training  program. Certifying a student is a multi-step process consisting of  enrolling a student in a training class, approving the student’s  successful completion of the class and then attesting to the student’s  successful completion of the class.
    "geocoded_column_city",
    "language", -- Language of the Program (Example: English, Spanish, Russian, etc.)
    "geocoded_column_state",
    "methodology", -- There are six Methodologies defined in this dataset, out of which four are of type HHA and two are of type PCA.  HHA Methodologies include: Core Training, Competency Evaluation, Nurse Aide Transition, and Personal Care Aide Upgrade.  PCA Methodologies include: Basic Training, Alternative Competency Demonstration. 
    "certificate_type", -- Represents the type of Training Certificate. There are two certificate types defined in this dataset: Home Health Aide (HHA), Personal Care Aide (PCA).
    "number_of_classes", -- Total number of training classes provided by the Training Agency Site Note: The training classes count may be zero in a specific year, but the ‘Enrolled Student Count’ or ‘Approved Student Count’ or ‘Certified Student Count’ or ‘Withdrawn Student Count’ may be greater than Zero. This might be because a student enrolled in a specific year may not have been approved or certified or withdrawn in the same year. 
    ":@computed_region_43an_4dx5",
    "approving_state_agency", -- The State Agency that has approved the Training Agency Site: New York State Department of Health (NYSDOH), New York State Education Department (NYSED). 
    "training_agency_site_name", -- Name of the Training Agency Site.
    "operational_status", -- The operational Status of the Training Agency site: Open or Closed.
    "year", -- Represents the year in which number of training classes were provided by the Training Agency site. 
    ":@computed_region_5edz_4hdv",
    ":@computed_region_8ire_itmf",
    ":@computed_region_assa_msit"
FROM
    "health-data-ny-gov/home-care-registry-training-data-beginning-2009-72qx-k28n:latest"."home_care_registry_training_data_beginning_2009"
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/home-care-registry-training-data-beginning-2009-72qx-k28n 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/home-care-registry-training-data-beginning-2009-72qx-k28n: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/home-care-registry-training-data-beginning-2009-72qx-k28n

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/home-care-registry-training-data-beginning-2009-72qx-k28n:latest

This will download all the objects for the latest tag of health-data-ny-gov/home-care-registry-training-data-beginning-2009-72qx-k28n 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/home-care-registry-training-data-beginning-2009-72qx-k28n: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/home-care-registry-training-data-beginning-2009-72qx-k28n: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/home-care-registry-training-data-beginning-2009-72qx-k28n is just another Postgres schema.

Related Documentation:

Loading...