cityofnewyork-us/nyc-free-tax-prep-sites-5kqf-fg3n
Icon for Socrata external plugin

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 nyc_free_tax_prep_sites table in this repository, by referencing it like:

"cityofnewyork-us/nyc-free-tax-prep-sites-5kqf-fg3n:latest"."nyc_free_tax_prep_sites"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "nta", -- Neighborhood Tabulation Area of the service site's physical location
    "opendateiso", -- The starting date the NYC Free Tax Prep site opens to eligible New Yorkers, in International Organization for Standardization (ISO-8601) format.
    "isaturdayclose", -- Number representing the hour the site closes (24-hour clock)
    "isundayopen", -- Number representing the hour the site opens (24-hour clock)
    "imondayopen", -- Number representing the hour the site opens (24-hour clock)
    "ifridayclose", -- Number representing the hour the site closes (24-hour clock)
    "isaturdayopen", -- Number representing the hour the site opens (24-hour clock)
    "ituesdayopen", -- Number representing the hour the site opens (24-hour clock)
    "iwednesdayopen", -- Number representing the hour the site opens (24-hour clock)
    "geocoded_column",
    "icon", -- Type of icon to display on the map - supports front-end rendering on the map
    "ithursdayclose", -- Number representing the hour the site closes (24-hour clock)
    "ithursdayopen", -- Number representing the hour the site opens (24-hour clock)
    "communitydistrict", -- Community District of the service site's physical location
    "closedatestr", -- The closing date for the NYC Free Tax Prep site.
    "selfemployed", -- Indicator for whether the NYC Free Tax Prep site can help if you are self-employed; Yes; No
    "opendatestr", -- The starting date the NYC Free Tax Prep site opens to eligible New Yorkers.
    "prioryear", -- Indicator for whether the NYC Free Tax Prep site can help you with filing returns for previous tax years; Yes; No
    "aarp", -- Indicator for whether the NYC Free Tax Prep site can help if you are a senior over age 60 years with pension or retirement-related questions; Yes; No
    "tuesdayclose", -- Closing time in regular time format
    "tuesdayopen", -- Opening time in regular time format
    "mondayclose", -- Closing time in regular time format
    "mondayopen", -- Opening time in regular time format
    "thursdayclose", -- Closing time in regular time format
    "thursdayopen", -- Opening time in regular time format
    "wednesdayclose", -- Closing time in regular time format
    "saturdayopen", -- Opening time in regular time format
    "fridayclose", -- Closing time in regular time format
    "fridayopen", -- Opening time in regular time format
    "notes",
    "sundayclose", -- Closing time in regular time format
    "sundayopen", -- Opening time in regular time format
    "latitude", -- Latitude of the service site's physical location
    "ycoordinate", -- Mapping Ycoordinate of the service site's physical location
    "bbl", -- Borough-Block-Lot number of the service site's physical location
    "citycouncildistrict", -- Council District of the service site's physical location
    "longitude", -- Longitude of the service site's physical loation
    "xcoordinate", -- Mapping Xcoordinate of the service site's physical location
    "scheduleexceptions", -- Exceptions to the posted schedule, typically holidays where services are not available
    "ianydayclose", -- Maximum closing hour including all days of operation supporting map-filtering logic
    "isundayclose", -- Number representing the hour the site closes (24-hour clock)
    "iwednesdayclose", -- Number representing the hour the site closes (24-hour clock)
    "wednesdayopen", -- Opening time in regular time format
    "ituesdayclose", -- Number representing the hour the site closes (24-hour clock)
    "imondayclose", -- Number representing the hour the site closes (24-hour clock)
    "closedateiso", -- The closing date for the NYC Free Tax Prep site, in International Organization for Standardization (ISO-8601) format.
    "s1", -- The tax preparation service options available at the NYC Free Tax Prep site; In Person = An IRS certified VITA/TCE volunteer preparer will help you complete your return; Drop-off = You can drop off your tax documents and pick up the completed return later; Assisted Self-Preparation = Complete your tax return online with help from an IRS certified VITA/TCE preparer.
    "l1", -- The languages available at the NYC Free Tax Prep site.
    "city", -- The City of the service site's physical address
    "unit", -- Floor, Suite, or sub-unit of the service site's physical address.
    "sitekey", -- An Identification Number assigned to tax preparation sites for internal tracking.
    "ianydayopen", -- Minumum opening hour including all days of operation supporting map-filtering logic
    "saturdayclose", -- Closing time in regular time format
    "ifridayopen", -- Number representing the hour the site opens (24-hour clock)
    "apptorwalkin", -- Indicator of whether NYC Free Tax Prep site requires appointment, accepts walk-ins, or both.
    "building", -- The building number of the service site's physical location
    "geocoded_column_zip",
    "geocoded_column_city",
    ":@computed_region_efsh_h5xi",
    ":@computed_region_f5dn_yrer",
    ":@computed_region_yeji_bk3q",
    ":@computed_region_92fq_4b7q",
    ":@computed_region_sbqj_enih",
    "geocoded_column_address",
    "geocoded_column_state",
    "street", -- The street name of the service site's physical address
    "providername", -- Name of the organization providing free tax preparation services
    "sitename", -- Name of the specific site where services can be obtained
    "sitestatus", -- Name of the organization providing free tax preparation services; "Active = Site is currently active Concluded = The site is not currently providing services  Sites will only display on the map when SiteStatus = 'Active' and ShowOnMap = 'Yes'."
    "extension", -- Phone Extension
    "show311", -- Indicator of whether the site should be displayed on the map; Yes; No
    "mappedaddress", -- A concatenation of the service site's physical address used for map display purposes 
    "phone", -- Primary phone number of the service provider
    "postcode", -- The postal code of the service site's physical address
    "borough", -- The borough of the service site's physical address
    "amendedreturn", -- Indicator for whether the NYC Free Tax Prep site can help you with filing amended returns; Yes; No
    "itin", -- Indicator for whether the NYC Free Tax Prep site can help you with your Individual Taxpayer Identification Number (ITIN) application.
    "ada_accessible", -- Indicator of whether the service site is ADA accessible; Yes; No
    "incomelimit", -- Income limit, if any, to qualify for NYC Free Tax Prep service.
    "showonmap", -- Indicator of whether the site should be displayed on the map; Yes; No
    "website" -- Website of the service provider
FROM
    "cityofnewyork-us/nyc-free-tax-prep-sites-5kqf-fg3n:latest"."nyc_free_tax_prep_sites"
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/nyc-free-tax-prep-sites-5kqf-fg3n with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.cityofnewyork.us. When you querycityofnewyork-us/nyc-free-tax-prep-sites-5kqf-fg3n:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

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 (like this repository), 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, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.cityofnewyork.us, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "cityofnewyork-us/nyc-free-tax-prep-sites-5kqf-fg3n" \
  --handler-options '{
    "domain": "data.cityofnewyork.us",
    "tables": {
        "nyc_free_tax_prep_sites": "5kqf-fg3n"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

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/nyc-free-tax-prep-sites-5kqf-fg3n is just another Postgres schema.