pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b
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 2023_municipal_election_mail_ballot_requests table in this repository, by referencing it like:

"pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b:latest"."2023_municipal_election_mail_ballot_requests"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "dateofbirth", -- This is the voter's month and year of birth.
    "disposition_reason", -- Reason for the Disposition of the Ballot Application.
    "ballot_status", -- Status of the ballot  •	Pending: Not yet returned •	Received: Received by county elections office.  •	Cancelled: the county election authority cancelled the mail label.
    "perm_indicator", -- True/False – indicates whether voter has requested to be on the permanent absentee list or permanent mail-in list. If a voter record has this flag as “True”, the voter is to be mailed an application for ballot at the beginning of the year and if they complete the application and if county board of elections approved the application,  they receive  ballots for all elections occurring in that year provided they maintain eligibility.
    "id_verification_status", -- This field indicates whether voter’s ID has been verified or not.
    ":@computed_region_its3_bt6a", -- This column was automatically created in order to record in what polygon from the dataset 'PA State House Districts 2016 Health' (its3-bt6a) the point in column 'georeferenced_latitude_longitude' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_75dh_jrw3", -- This column was automatically created in order to record in what polygon from the dataset 'PA State Senate Districts 2016 Health' (75dh-jrw3) the point in column 'georeferenced_latitude_longitude' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_gbji_5m4q", -- This column was automatically created in order to record in what polygon from the dataset 'US House Districts for PA 2019 Health' (gbji-5m4q) the point in column 'georeferenced_latitude_longitude' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_4fjn_fq7k", -- This column was automatically created in order to record in what polygon from the dataset 'PA County Boundaries Spatial Data Current Transportation' (4fjn-fq7k) the point in column 'georeferenced_latitude_longitude' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_3x3q_vpda", -- This column was automatically created in order to record in what polygon from the dataset 'US House Districts for PA 2019' (3x3q-vpda) the point in column 'georeferenced_latitude_longitude' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    "georeferenced_latitude_longitude", -- A generic georeferenced Latitude & Longitude point within the county. These points can be used to create visualizations such as maps to show the data by county. A point is also provided for outside of the state (on a map it will sit to the southeast of the state). This number represents the total number for the state and this location provides a spot on a map to display the PA number without having it duplicate within a county when using in a mapping visual.
    "ballot_application_disposition", -- Disposition of the ballot application – Approved/Declined
    "longitude", -- A generic Longitude point within the county. A point is also provided for outside of the state (on a map it will sit to the southeast of the state). This number represents the total number for the state and this location provides a spot on a map to display the PA number without having it duplicate within a county when using in a mapping visual.
    "latitude", -- A generic Latitude point within the county. A point is also provided for outside of the state (on a map it will sit to the southeast of the state). This number represents the total number for the state and this location provides a spot on a map to display the PA number without having it duplicate within a county when using in a mapping visual.
    "congressional", -- This is the voter's congressional district.
    "ballotsentdate", -- This is the date the county confirmed the application to queue a ballot label to mail the ballot materials to the voter.
    "appreturndate", -- This is the date the application was processed by the county election office.
    "appissuedate", -- This is the date the application was submitted by the voter.
    "legislative", -- This is the voter's state house district.
    "countyname", -- This identifies the county of registration for the voter submitting an application to vote by mail.
    "ballot_status_reason", -- Reason for the status of the ballot. The following are optional values for this field:  •	CANC – EMAIL BALLOT UND BATCH •	CANC – EMAIL BALLOT UNDELIVERABLE •	CANC – INCORRECT DATE •	CANC – LABEL CANCELLED •	CANC – NO DATE •	CANC – NO ID •	CANC – NO SECRECY ENVELOPE   •	CANC – NO SIGNATURE •	CANC – REPLACED •	CANC – RETURNED AFTER DEADLINE •	CANC – UNDELIVERABLE •	CANC – VOTE CANCELLED •	CANC – VOTE CHALLENGED •	PEND – NOT YET RETURNED •	RECORD – BALLOT RETURNED
    "party", -- This identifies the voter's party when submitting their application.
    "senate", -- This is the voter's state senate district.
    "mailapplicationtype", -- This field identifies the application type of mail ballot requested by the voter. The following are the optional values for this field. •	Alt - This is an alternative ballot application for voters are at least 65 years of age where the polling place may not be fully accessible.  •	BV - Bedridden Veteran.  •	BVRI - Bedridden Veteran - Remote/Isolated  •	C- This is an absentee ballot application submitted during the emergency absentee period.  •	CIV- This is a civilian absentee ballot application that was submitted via paper.  •	CRI- This is an absentee ballot application for an overseas civilian voter in a remote/isolated location. •	CVO- This is an absentee ballot application for an overseas civilian voter. •	F- This is an absentee application for an individual who qualifies to vote for federal offices in federal election years.  •	OLMAILV-This is a mail-in ballot application that was submitted online.  •	M-This is an absentee ballot application for a military voter.  •	MAILIN-This is a mail-in ballot application submitted via paper.  •	MRI-This is an absentee ballot application for a military voter in a remote/isolated location. •	OLREGV-This is a civilian absentee ballot application that was submitted online.  •	PER-This is an absentee ballot application where a voter has requested permanent status.  •	PMI- This is a mail-in ballot application where the voter has requested permanent status.  •	REG-This is an absentee ballot application that was submitted via paper.  •	OLMAILNV: This is an Online Mail-In Ballot Application, where ID verification did not occur  or was not successful at the time of submission.  •	OLREGNV: This is an Online Regular Absentee Ballot Application, where ID verification did not occur or was not successful at the time of submission.  Note : NV designation in the application type field is a systematic assurance that before county users are able to approve them these applications will go through the ID verification process. After the verification process occurs, only those voters whose identification could not be verified will be required to submit valid ID before the sixth day after the election. For example, a ballot application would be marked with NV if it is a new application that comes in and the provided ID was not able to be immediately verified. Or, for another example, a ballot application would be marked as NV if it is from a voter on the permanent mail-in or absentee list who requested a mail ballot for both the primary and general elections, and their ID needs to be verified again for the general election. •	V: Veteran.  
    "ballotreturneddate" -- This is the date the county marked the ballot as received after the voter returned the completed ballot back to the county.
FROM
    "pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b:latest"."2023_municipal_election_mail_ballot_requests"
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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b 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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b: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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b

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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b:latest

This will download all the objects for the latest tag of pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b 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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b: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 pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b: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, pa-gov/2023-municipal-election-mail-ballot-requests-gvuf-mt9b is just another Postgres schema.

Related Documentation:

Loading...