datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re
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 2022_ntd_annual_data_service_by_mode_and_time table in this repository, by referencing it like:

"datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re:latest"."2022_ntd_annual_data_service_by_mode_and_time"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "charter_service_hours", -- Hours run in charter service.
    "actual_vehicles_passenger_car_revenue_hours", -- The hours that vehicles/passenger cars travel while in revenue service. Vehicle revenue hours (VRH) include:  • Revenue service  • Layover/recovery time  Actual vehicle revenue hours exclude:  • Deadhead  • Operator training  • Maintenance testing  • School bus and charter services
    "actual_vehicles_passenger_deadhead_miles", -- The miles that a vehicle/passenger car travels when out of revenue service. Deadhead includes:  • Leaving or returning to the garage or yard facility  • Changing routes  • When there is no expectation of carrying revenue passengers  However, deadhead does not include:  • Charter service  • School bus service  • Travel to fueling facilities  • Travel to maintenance facilities  • Operator training  • Maintenance testing
    "actual_vehicles_passenger_car_miles", -- The miles that vehicles/passenger cars travel while in revenue service (actual vehicle revenue miles (VRM)) plus deadhead miles. Actual vehicle miles include:  • Revenue service  • Deadhead  Actual vehicle miles exclude:  • Miles for charter services  • School bus service  • Operator training  • Vehicle maintenance testing
    "days_of_service_operated", -- Days of revenue service within the fiscal year.
    "days_not_operated_emergencies", -- Days of revenue service not operated due to emergencies.
    "service_area_sq_miles", -- The agency's service area's size in square miles.
    "organization_type", -- Description of the agency's legal entity.
    "directional_route_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "directional_route_miles", -- The mileage in each direction over which public transportation vehicles travel while in revenue service. Directional route miles (DRM) are:  •   A measure of the route path over a facility or roadway, not the service carried on the facility; e.g., number of routes, vehicles, or vehicle revenue miles. •   Computed with regard to direction of service, but without regard to the number of traffic lanes or rail tracks existing in the right-of-way (ROW). Directional route miles (DRM) do not include staging or storage areas at the beginning or end of a route.
    "unlinked_passenger_trips_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "passenger_miles", -- The cumulative sum of the distances ridden by each passenger.
    "passenger_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "brt_non_statutory_mixed_traffic", -- Miles of roadway used by Bus Rapid Transit routes that are not recognized by FTA as Bus Rapid Transit for funding purposes.
    "sponsored_service_upt", -- Unlinked Passenger Trips embarked under sponsored service.
    "unlinked_passenger_trips_upt", -- The number of passengers who board public transportation vehicles. Passengers are counted each time they board a vehicle no matter how many vehicles they use to travel from their origin to their destination.
    "days_not_operated_strikes", -- Days of revenue service not operated due to strikes.
    "passengers_per_hour_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "scheduled_vehicles_passenger_car_revenue_miles", -- The total service scheduled to be provided for picking up and discharging passengers. Scheduled service is computed from internal transit agency planning documents (e.g., run paddles, trip tickets, and public timetables). Scheduled service excludes special additional services.
    "average_passenger_trip_length_aptl_", -- The average distance ridden by each passenger in a single trip, computed as passenger miles traveled (PMT) divided by unlinked passenger trips (UPT). May be determined by sampling, or calculated based on actual data.
    "city", -- The city in which the agency is headquartered.
    "scheduled_revenue_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "vehicle_revenue_hours_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "school_bus_hours", -- Hours run in school bus service.
    "train_revenue_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "ada_upt", -- Unlinked Passenger Trips embarked per stipulations of the Americans with Disabilities Act.
    "train_deadhead_hours", -- The hours that a train travels when out of revenue service. Deadhead includes:  • Leaving or returning to the garage or yard facility  • Changing routes  • When there is no expectation of carrying revenue passengers  However, deadhead does not include:  • Charter service  • School bus service  • Travel to fueling facilities  • Travel to maintenance facilities  • Operator training  • Maintenance testing
    "train_revenue_hours", -- The hours that trains travel while in revenue service. Train revenue hours include:  • Revenue service  • Layover/recovery time  Train revenue hours exclude:  • Deadhead  • Operator training  • Maintenance testing  • Charter services
    "train_hours", -- The hours that trains travel while in revenue service plus deadhead hours. Train hours include:  • Revenue service  • Deadhead  • Layover/recovery time  Train hours exclude:  • Hours for charter service  • Operator training  • Vehicle maintenance testing
    "train_deadhead_miles", -- The miles that a train travels when out of revenue service. Deadhead includes:  • Leaving or returning to the garage or yard facility  • Changing routes  • When there is no expectation of carrying revenue passengers  However, deadhead does not include:  • Charter service  • School bus service  • Travel to fueling facilities  • Travel to maintenance facilities  • Operator training  • Maintenance testing
    "train_miles", -- The miles that trains travel while in revenue service (actual vehicle revenue miles (VRM)) plus deadhead miles. Train miles include:  • Revenue service  • Deadhead  Train miles exclude:  • Miles for charter services  • Operator training  • Vehicle maintenance testing
    "state", -- The state in which the agency is headquartered.
    "mode", -- A system for carrying transit passengers described by specific right-of-way (ROW), technology and operational features.
    "type_of_service", -- Describes how public transportation services are provided by the transit agency: directly operated (DO) or purchased transportation (PT) services.
    "mode_voms", -- The number of revenue vehicles operated by the given mode and type of service to meet the annual maximum service requirement. This is the revenue vehicle count during the peak season of the year; on the week and day that maximum service is provided. Vehicles operated in maximum service (VOMS) exclude atypical days and one-time special events.
    "primary_uza_name", -- The name of the agency's Urbanized Area.
    "trains_in_operation_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "actual_vehicles_passenger_car_deadhead_hours", -- The hours that a vehicle/passenger car travels when out of revenue service. Deadhead includes:  • Leaving or returning to the garage or yard facility  • Changing routes  • When there is no expectation of carrying revenue passengers  However, deadhead does not include:  • Charter service  • School bus service  • Travel to fueling facilities  • Travel to maintenance facilities  • Operator training  • Maintenance testing
    "average_speed_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "deadhead_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "deadhead_hours_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "train_revenue_miles", -- The miles that trains travel while in revenue service. Train revenue miles include:  • Revenue service  Train revenue miles exclude:  • Deadhead  • Operator training  • Maintenance testing  • Charter services
    "time_service_ends", -- The time at which a particular mode/type of service ends revenue service, presented in a 24-hour format.
    "time_service_begins", -- The time at which a particular mode/type of service begins revenue service, presented in a 24-hour format.
    "service_area_population", -- The population of the service area served by the agency.
    "primary_uza_population", -- The population of the urbanized area primarily served by the agency.
    "primary_uza_area_sq_miles", -- The agency's Urbanized Area's size in square miles.
    "train_revenue_hours_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "average_speed", -- The average speed of a vehicle/passenger car during revenue service.
    "train_hours_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "trains_in_operation", -- The maximum number of trains actually operated to provide service during the year.
    "actual_vehicles_passenger_car_hours", -- The hours that vehicles/passenger cars travel while in revenue service plus deadhead hours. Actual vehicle hours include:  • Revenue service  • Deadhead  • Layover/recovery time  Actual vehicle hours exclude:  • Hours for charter service  • School bus service  • Operator training  • Vehicle maintenance testing
    "actual_vehicles_passenger_car_revenue_miles", -- The miles that vehicles/passenger cars travel while in revenue service. Vehicle revenue miles (VRM) include:  • Revenue service  Actual vehicle revenue miles exclude:  • Deadhead  • Operator training  • Maintenance testing  • School bus and charter services
    "train_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "vehicle_hours_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "vehicle_revenue_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "vehicle_miles_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "mode_voms_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "time_period", -- The time period for which data was collected.
    "primary_uza_code", -- UACE Code remains consistent across census years.
    "agency_voms", -- The number of revenue vehicles operated across the whole agency to meet the annual maximum service requirement. This is the revenue vehicle count during the peak season of the year; on the week and day that maximum service is provided. Vehicles operated in maximum service (VOMS) exclude atypical days and one-time special events.
    "_5_digit_ntd_id", -- A five-digit identifying number for each agency used in the current NTD system.
    "agency", -- The transit agency's name.
    "aptl_questionable", -- FTA marks a data point as Questionable when there is reason to believe it is incorrect, but the reporting agency has been unable to correct the data or offer an explanation for its anomalous appearance.
    "reporter_type", -- The type of NTD report that the agency completed this year.
    "passengers_per_hour", -- The average number of passengers to board a vehicle/passenger car in one hour of service. For trains, this applies to passengers per hour on a single train car.
    "mixed_traffic_right_of_way" -- Roadways other than exclusive and controlled access rights-of-way (ROW) used for transit operations that are mixed with pedestrian and/or vehicle traffic. Does not include guideways that have only grade crossings with vehicular traffic.
FROM
    "datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re:latest"."2022_ntd_annual_data_service_by_mode_and_time"
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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re 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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re: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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re

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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re:latest

This will download all the objects for the latest tag of datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re 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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re: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 datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re: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, datahub-transportation-gov/2022-ntd-annual-data-service-by-mode-and-time-wwdp-t4re is just another Postgres schema.

Related Documentation:

Loading...