Bts

v0.2.1
io.github.pipeworx-io/bts Checked 1 day ago Published 1 month ago

U.S. Bureau of Transportation Statistics (BTS) — data.bts.gov open-data portal (Socrata platform).

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

search_datasets

Search datasets published on the U.S. Bureau of Transportation Statistics open-data portal (data.bts.gov). Returns each dataset's Socrata 4x4 id (e.g. "crem-w557"), name, and description. Use the id with dataset_columns and query_dataset. BTS covers aviation (passenger counts, on-time performance, air fares, airline financials), freight movement, transit ridership, border crossings, and transportation safety. Example queries: "aviation", "border crossing", "transit", "freight".

ParameterTypeDescription
q *stringFull-text search query, e.g. "aviation" or "border crossing".
limitnumberMax datasets to return (default 20).
offsetnumberPagination offset (default 0).

dataset_columns

List the columns of a data.bts.gov dataset: field name (used in SoQL $select/$where), human label, and data type (number, text, calendar_date, etc.). Call this before query_dataset so you know which fields exist. datasetId is the Socrata 4x4 code from search_datasets.

ParameterTypeDescription
datasetId *stringSocrata 4x4 id, e.g. "crem-w557".

query_dataset

Query rows from a data.bts.gov dataset using SoQL. datasetId is the Socrata 4x4 code from search_datasets. SoQL clauses: $select (columns / aggregates like "count(*)" or "avg(air_fare)"), $where (SQL-like filter, e.g. "date > '2024-01-01' AND state='TX'"), $order ("date desc"), $group, $q (full-text across the row). Use dataset_columns first to learn field names. Returns an array of row objects keyed by field name. Default $limit is 50 (Socrata max per page is 50000).

ParameterTypeDescription
datasetId *stringSocrata 4x4 id, e.g. "crem-w557".
$groupstringGroup-by field(s) for aggregation.
$limitnumberRows to return (default 50).
$offsetnumberPagination offset (default 0).
$orderstringSort, e.g. "date desc".
$qstringFull-text search across the whole row.
$selectstringColumns or aggregates, e.g. "date, safety_general_aviation".
$wherestringSQL-like filter, e.g. "date > '2024-01-01'".