oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w
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 state_of_oregon_agency_data_inventory table in this repository, by referencing it like:

"oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w:latest"."state_of_oregon_agency_data_inventory"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "data_value", -- What is your sense of the relative value in publishing this data?    [High] - existing and ongoing requests for this data; this data addresses pressing information needs or pain points (for either State govt or other entities); or we have heard compelling examples of how this data could be used;     [Medium] - This data may be useful for other state or govt agencies or for other constituents; we occasionally receive requests for this information; or we have heard some examples for how this data could be used;    [Low] - This data has unclear value for either the public or other state or govt entitles; we have never received requests for this data; or we have never heard a use case for this data;   [N\A or blank] - An N\A or blank are used if "Data is not Publishable."
    "data_restrictions_or", -- Are there other restrictions or regulations that would limit the release of this data or require redaction of some fields? E.g. FERPA, HIPAA, Public Records Exemptions, statutory or contractual limitations.
    "type_of_existing_publication", -- If the answer to the previous question is yes, include a link to the publication or a description of the type of publication.
    "frequency_of_data_change", -- At what rate does the information in the dataset change? E.g., Hourly, Daily, Monthly, Annually
    "geographic_granularity", -- What is the lowest level of geographic granularity in the data? For example, if the data is collected by address, it would be Street Address.
    "agency_name", -- The name of the State agency who has inventoried the dataset and identified themselves as custodian of the dataset.
    "overall_priority", -- What is the overall priority for the agency in publishing this data?   [High] - This data is of high value/import to the agency and is an immediate priority for publication;   [Medium] - This data could be valuable if published, but is not an immediate priority;   [Low] - This data, due to either readiness or value considerations, is not a priority at this time;   [No priority or blank] - This data cannot be published; requires redaction; can be published "as-is" but priority decision is pending; or is already published as an open data set on data.oregon.gov, or another portal or website. 
    "data_readiness_for_publication", -- What is your sense of the readiness of this data to be made publicly available?   [High] - this data is of a high quality, requires little to no de-identification, intervention or transformation to make it suitable for external users;   [Medium] - This data may have a few quality issues, technological challenges/limitations, or other elements that would require work on behalf of the agency to clean, prepare, and ready it for publication;   [Low] - this data is of a low quality/usability, is technically challenging to access and export, or has other limitations that would require extensive work on behalf of the agency to clean, prepare, and ready it for publication;   [N\A or blank] - An N\A or blank is used if "Data is not Publishable."
    "geographic_boundaries", -- If this data contains geographic information, what are the bounding boxes for this data?
    "open_data_publishing_status", -- The publishing status of this data as an open dataset.
    "data_classification", -- How would you classify this data? Level 1, "Published" - Information that is not protected from disclosure, that will not jeopardize the privacy or security of agency employees, clients or partners. Level 2, "Limited" - Information that may not be protected from disclosure, but may jeopardize the privacy or security of agency employees, clients, or partners if made readily available. Examples: risk assessments, internal audits. Level 3, "Restricted" - Information intended for limited business use that may be exempt from public disclosure due to risks posed to privacy and security associated with release of this information.  Examples: network diagrams, personally identifiable information, information exempted from public records disclosure. Level 4, "Critical" - Information that is considered highly sensitive and is intended for use by specified individuals only.  Disclosure or release of this information poses a series threat and could cause major damage or injury. Examples: Records of victims of domestic violence/stalking, IRS records/data
    "department_division", -- Name of the business unit of the agency who is responsible for managing this data.
    "dataset_id", -- The unique ID given to the dataset during publishing automatically by the open data platform. This is null or empty when the "Publishing Status" = Not Published.
    "inventory_id", -- The unique ID for each inventoried dataset. This ID is used to track datasets through the publishing process. Once published, each inventoried dataset also contains a unique catalog ID (Dataset ID). Unique IDs are generated by the Chief Data Office as part of processing the inventories submitted by agencies. Unique IDs are a concatenation of the Agency acronym and a number.
    "data_contains_pii_phi", -- Does this data contain either Personally Identifiable Information or Personal Health Information? (PII, PHI, PII/PHI, No)
    "data_is_is_not_publishable", -- Is this data publishable? Data can be published as is: the data can be published with no redactions or removal of fields. Data can be published with some redactions: the data may be published but would require redactions, de-identification, statistical noise, or aggregation to make it public. Data is not publishable: the data cannot be published in any format. (As-is, Redaction required, Not publishable)
    "brief_description_of_data", -- Brief description of the dataset. What is the purpose? What is it used for? Include key data fields if possible.
    "dataset_name", -- Brief descriptive name for the dataset.
    "existing_publication", -- Is this data already made available for public consumption through an existing report, API endpoint, portal, etc.?
    "dataset_link" -- The hyperklink given to the dataset during publishing. This is null or empty when the "Publishing Status" = Not Published
FROM
    "oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w:latest"."state_of_oregon_agency_data_inventory"
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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w 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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w: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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w

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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w:latest

This will download all the objects for the latest tag of oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w 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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w: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 oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w: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, oregon-gov/state-of-oregon-agency-data-inventory-yp9j-pm7w is just another Postgres schema.

Related Documentation:

Loading...