cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad
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 dohmh_hivaids_annual_report table in this repository, by referencing it like:

"cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad:latest"."dohmh_hivaids_annual_report"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "hiv_diagnosis_rate", -- HIV diagnoses per 100,000 NYC population using annual intercensal population estimates  *‘99999’ value indicates suppressed cell representing 1-5 person(s) with an underlying denominator of <=500 people or non-zero cell with a denominator <=100.
    "non_hiv_related_death_rate", -- Death rate for those assigned a non-HIV-related cause of death. *‘99999’ value indicates rate is not calculated because the underlying denominator is equal to zero or is unknown.
    "hiv_related_death_rate", -- Death rate for those assigned an HIV-related cause of death. *‘99999’ value indicates rate is not calculated because the underlying denominator is equal to zero or is unknown.
    "death_rate", -- Deaths per 1,000 mid-year people living with HIV/AIDS, excluding deaths in which the person was diagnosed with HIV at the time of death or up to 15 days prior to death. Deaths are age-adjusted to the NYC Census 2010 population and include deaths from any cause (including unknown causes). 
    "deaths", -- Number of deaths from any cause among people with HIV/AIDS 13 years of age or older. *‘99999’ value indicates suppressed cell representing 1-5 person(s) with an underlying denominator of <=500 people or non-zero cell with a denominator <=100.
    "viral_suppression", -- Proportion of people living with diagnosed HIV infection 13 years of age or older with at least one viral load test during the calendar year whose last HIV viral load value was ≤200 copies/mL.  *‘99999’ value indicates proportion is not calculated because the underlying denominator is equal to zero or is unknown.
    "plwdhi_prevalence", -- Estimated number of people 13 years of age or older living with diagnosed HIV infection (PLWDHI) per 100 NYC population using annual intercensal population estimates. *‘99999’ value indicates rate is not calculated because the underlying denominator is equal to zero or is unknown.
    "linked_to_care_within_3_months", -- Proportion of new HIV diagnoses with an HIV viral load or CD4 test drawn within 3 months (91 days) of HIV diagnosis, following a 7-day lag *‘99999’ value indicates proportion is not calculated because the underlying denominator is equal to zero or is unknown.
    "concurrent_diagnoses", -- Number of HIV diagnoses 13 years of age or older with a concurrent AIDS diagnosis (within 31 days)
    "hiv_diagnoses", -- Number of HIV diagnoses 13 years of age or older, including those concurrent with AIDS, excluding people known to have been diagnosed outside of NYC
    "uhf", -- United Hospital Fund neighborhood of residence at HIV diagnosis for HIV diagnoses, HIV diagnosis rates, Concurrent diagnoses, and % Linked to care within 3 months; UHF of residence at AIDS diagnosis for AIDS diagnoses and AIDS diagnosis rates; UHF of residence at most recent address for PLWDHI prevalence and % viral suppression; UHF of residence at death for Deaths and all death rates.  
    "gender", -- Gender: when Borough, UHF, Age, and Race categories are all equal to 'All', Gender is displayed as Male, Female, and Transgender (mutually exclusive categories). In all other rows, Male includes transgender men and Female includes transgender women.
    "race", -- Race/ethnicity; Other/Unknown category includes people of Native American, multiracial, and unknown races.
    "borough", -- Borough of residence at HIV diagnosis for HIV diagnoses, HIV diagnosis rate, Concurrent diagnoses, and % linked to care within 3 months; Borough of residence at AIDS diagnosis for AIDS diagnoses and AIDS diagnosis rates; Borough of residence at most recent address for PLWDHI prevalence and % viral suppression; Borough of residence at death for Deaths and all death rates.
    "aids_diagnoses", -- Number of AIDS diagnoses 13 years of age or older.  *‘99999’ value indicates suppressed cell representing 1-5 person(s) with an underlying denominator of <=500 people or non-zero cell with a denominator <=100.
    "year", -- Calendar year
    "age", -- Age at HIV diagnosis for HIV diagnoses, HIV diagnosis rates, Concurrent diagnoses, and % Linked to care within 3 months; Age at AIDS diagnosis for AIDS diagnoses and AIDS diagnosis rates; Age as of the end of the given year for PLWDHI prevalence and % viral suppression; Age at death for Deaths and all death rates.
    "aids_diagnosis_rate" -- AIDS diagnoses per 100,000 NYC population using annual intercensal population estimates. *‘99999’ value indicates rate is not calculated because the underlying denominator is equal to zero or is unknown.
FROM
    "cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad:latest"."dohmh_hivaids_annual_report"
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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad 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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad: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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad

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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad:latest

This will download all the objects for the latest tag of cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad 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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad: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 cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad: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, cityofnewyork-us/dohmh-hivaids-annual-report-fju2-rdad is just another Postgres schema.

Related Documentation:

Loading...