cityofnewyork-us/nycha-development-data-book-evjd-dqpz
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 nycha_development_data_book table in this repository, by referencing it like:

"cityofnewyork-us/nycha-development-data-book-evjd-dqpz:latest"."nycha_development_data_book"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "us_congressional_district", -- Congressional District Number
    "net_dev_area_sq_ft", -- This is square feet at a development less the land set aside for a park or playground. For the majority of developments this figure is the same acreage.
    "federalized_development", -- A development transferred from the City or State Program. The book has a list of developments that were transferred after construction was completed from either the City or State Program to the Federal Program. These developments are managed and operated 
    "operating_edp_", -- Electronic Data Processing # - This number is used to identify the managing development in the consolidation.
    "hud__", -- The U.S. Department of Housing and Urban Development (HUD) identification number.
    "number_of_rental_rooms", -- Rental room count per apartment is equal to 2 ½ plus the number of bedrooms. The number of rental rooms includes balconies and half-baths as half-rooms.
    "total_population", -- The total number of persons living at the development based on the January 1, 2012 Resident Data Files including the Section 8 Transition apartments in the LLC1 and LLC2 developments.
    "percent_fixed_income_households", -- Total number of families on fixed income divided by the total number of families
    "bldg_coverage_sq_ft", -- The total ground floor area of the building footprints of a development.
    "data_as_of", -- Last date that the date was updated
    "electricity_paid_by_residents", -- A "Yes" indicates developments where residents pay for their electricity.
    "tds_", -- Tenant Data System # - The number used by numerous computer applications to identify NYCHA Developments.
    "completion_date", -- The Initial Occupancy Completion Date: The date when the development was at least 95% occupied.
    "senior_development", -- A senior development where all residents are senior, aged 62 or older, is denoted as "Exclusively". A development where only some buildings are designated for senior residents is denoted as "Partially". A list of these developments is also included on pag
    "number_of_non_residential_bldgs", -- The number of non-residential buildings at a development.
    "development_edp_", -- Electronic Data Processing # - Number used to identify individual NYCHA developments.
    "total_number_of_apartments", -- The total number of apartments at the development including the Section 8 Transition apartments at the LLC1 and LLC2 developments.
    "population_section_8_transition", -- The number of persons living in the Section 8 Transition apartments in the LLC1 and LLC2 developments based on the January 1, 2012 Resident Data Files.
    "per_rental_room", -- Cost to develop the property divided by the number of rental rooms at the time of original construction.
    "ny_state_assembly_district", -- New York State Assembly District Number
    "number_of_stories", -- The number of floors in each building.
    "acres", -- The land area of the development including buildings and grounds is shown in acres (one acre equals 43,560 square feet).
    "borough", -- Bronx, Brooklyn, Manhattan, Queens, or Staten Island.
    "program", -- The development’s funding source including Federal, Mixed Finance, or Section 8 Housing Assistance Payment (HAP) agreement.
    "type", -- New Construction, Rehabilitation, New Construction or Rehabilitation for the Elderly.
    "density", -- Measure of development density as represented by the number of persons per acre.
    "total_of_fixed_income_household", -- Total number of families on fixed income. Fixed income is defined as households with income from Social Security, Supplementary Security Income (SSI), Survivors Insurance, Veterans Benefits, or Pension (as well as other Public or Non Public Benefits), while not earning employment income or receiving Public Assistance.
    "method", -- Conventional Method: The Authority acquires the land and contracts for general construction, heating and ventilation, elevators, electrical, and plumbing work.  Turnkey Method: The developer buys the land, constructs the development and sells it to the Au
    "ny_state_senate_district", -- New York State Senate District Number
    "development_cost", -- The sum of the land cost, construction cost and site improvement cost, including fees for architects and engineers at the time of original construction.
    "number_of_current_apartments", -- The number of apartments available for occupancy in the development as per the January 1, 2012. Dwelling Unit Inventory which is used to track the number of apartments on the rent roll. Units temporarily vacant and not permanently removed from the rent ro
    "location_street_a", -- For NYCHA developments that fit into a relatively neat rectangular block or two, these fields should be the four border streets (north, south, east and west) of the Development. For developments that are spread over some distance such as West Farms Road R
    "number_of_stairhalls", -- The number of individual entrances in each Development.
    "location_street_b", -- For NYCHA developments that fit into a relatively neat rectangular block or two, these fields should be the four border streets (north, south, east and west) of the Development. For developments that are spread over some distance such as West Farms Road R
    "cubage_cu_ft", -- Cubic Space (height x length x width of residential buildings) in all the buildings at a development, expressed as cubic feet.
    "private_management", -- A "Yes" indicates Developments managed by a private management company. A list of these developments is also included on page 133 of this book.
    "excluding_park_acres", -- This is the number of acres at a development less the land set aside for a park or playground. For the majority of developments this figure is the same as “acres”.
    "total_area_sq_ft", -- This number includes land acquired and developed as part of the development for a park or playground to be operated and maintained by the NYC Department of Parks. At State and City Developments, the park or playground is owned by the City of New York. At 
    "number_of_residential_bldgs", -- The number of residential buildings on the grounds that are used for dwelling units.
    "population_public_housing", -- The number of persons living in the public housing units in the LLC1 and LLC2 developments based on the January 1, 2012 Resident Data Files. The residents living in the Section 8 Transition apartments in the LLC1and LLC2 developments are not included in t
    "location_street_c", -- For NYCHA developments that fit into a relatively neat rectangular block or two, these fields should be the four border streets (north, south, east and west) of the Development. For developments that are spread over some distance such as West Farms Road R
    "avg_monthly_gross_rent", -- This is the average gross monthly rent of the households in each development as of January 1, 2012. The average tenant share of rent for the Section 8 households in the LLC1 & LLC2 Developments is included.
    "avg_no_r_r_per_apartment", -- The average number of rental rooms per apartment is the number of rental rooms divided by the number of current apartments. The Section 8 Apartments in the LLC1 & LLC2 Developments are included.
    "location_street_d", -- For NYCHA developments that fit into a relatively neat rectangular block or two, these fields should be the four border streets (north, south, east and west) of the Development. For developments that are spread over some distance such as West Farms Road R
    "number_of_section_8_transition_apartments", -- The total number of apartments transitioned to the Section 8 Program in the LLC1 and LLC2 developments.
    "consolidated_tds_", -- Abbreviation for Consolidated Tenant Data System Numbers. (see TDS)
    "hud_amp_", -- The U.S. Department of Housing and Urban Development (HUD) identification number.
    "development", -- The name of the housing development as listed in the Property Directory Database.
    "community_distirct", -- Community District Number
    "bldg_coverage__", -- This is the building coverage, divided by a development’s total area in square feet. This figure is presented as a percentage.
    "ny_city_council_district" -- New York City Council District Number
FROM
    "cityofnewyork-us/nycha-development-data-book-evjd-dqpz:latest"."nycha_development_data_book"
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/nycha-development-data-book-evjd-dqpz 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/nycha-development-data-book-evjd-dqpz: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/nycha-development-data-book-evjd-dqpz

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/nycha-development-data-book-evjd-dqpz:latest

This will download all the objects for the latest tag of cityofnewyork-us/nycha-development-data-book-evjd-dqpz 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/nycha-development-data-book-evjd-dqpz: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/nycha-development-data-book-evjd-dqpz: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/nycha-development-data-book-evjd-dqpz is just another Postgres schema.

Related Documentation:

Loading...