--- license: cc-by-nc-4.0 language: - en pretty_name: NYC Subway Realtime Archive size_categories: - 100M- Released for non-commercial research, journalism, and civic analysis. Requests are reviewed manually; most are approved. extra_gated_prompt: | ## Before you dive in Short version: this is free for research, journalism, teaching, and personal projects. Please credit me, and please don't use it to make money without asking first. That's really the whole thing. **The MTA's data is theirs, and it's public.** GTFS-RT, static GTFS, and the ridership figures all come from the MTA's open data. I'm not claiming any of it, and you're very welcome to fetch it straight from the source — if today's feed is all you need, you don't need this archive at all. **What I'm sharing is the history.** The MTA keeps none: every poll overwrites the last, so nothing upstream remembers what the network looked like at 08:14 last Tuesday. The continuous capture since April 2026, the decoding and deduplication, the analytical panels, the learned baselines and the labelled prediction record are my work, and that's what I'm licensing to you under CC BY-NC 4.0. ## What you can do Use it, share it, adapt it, and publish whatever you find — just **credit** Henry Williams / subway.fyi. Academic work, journalism, teaching, civic and policy analysis, hobby projects: all welcome, and I'd genuinely like to hear what you build with it. ## The one real limit: not for commercial use Please don't use this, or anything derived from it, to make money without asking me first. That covers shipping it inside a paid product or service, training a model that's then deployed or sold commercially (derived weights carry the same limit), fee-paid consulting or analysis, and for-profit internal use. Access here isn't a commercial licence on its own — but do get in touch if you want one. I'm open to it, and it's usually a short conversation. ## Two caveats worth knowing - **No warranty.** This is an independent capture pipeline, not infrastructure. It has gaps, and it isn't safety-certified — please don't rely on it anywhere that being wrong would actually matter. - **It isn't an MTA product.** Unofficial and unaffiliated, so please don't present it as an MTA source. extra_gated_fields: Name: text Affiliation (university, newsroom, agency, or "independent"): text What do you plan to use this data for?: text I've read the terms above and I'm happy with them: checkbox I'll credit Henry Williams in anything I publish: checkbox I won't use this commercially without asking first: checkbox extra_gated_button_content: Agree and request access configs: - config_name: route_station_5min default: true data_files: - split: train path: data/route_station_5min/*.parquet - config_name: station_hourly data_files: - split: train path: data/station_hourly/*.parquet - config_name: station_daily data_files: - split: train path: data/station_daily/*.parquet - config_name: alerts_unique data_files: - split: train path: data/alerts_unique/*.parquet - config_name: delay_predictions data_files: - split: train path: data/delay_predictions/*.parquet - config_name: incident_replays data_files: - split: train path: data/incident_replays/*.parquet - config_name: ridership_hourly data_files: - split: train path: data/ridership_hourly/*.parquet - config_name: station_complex data_files: - split: train path: data/station_complex/*.parquet - config_name: station_complex_stops data_files: - split: train path: data/station_complex_stops/*.parquet - config_name: gtfs_stops data_files: - split: train path: data/gtfs_stops/*.parquet - config_name: gtfs_routes data_files: - split: train path: data/gtfs_routes/*.parquet - config_name: gtfs_trips data_files: - split: train path: data/gtfs_trips/*.parquet - config_name: gtfs_stop_times data_files: - split: train path: data/gtfs_stop_times/*.parquet - config_name: gtfs_shapes data_files: - split: train path: data/gtfs_shapes/*.parquet - config_name: baselines_headway data_files: - split: train path: data/baselines_headway/*.parquet - config_name: baselines_stop_hold data_files: - split: train path: data/baselines_stop_hold/*.parquet - config_name: station_adjacency data_files: - split: train path: data/station_adjacency/*.parquet - config_name: terminal_stops data_files: - split: train path: data/terminal_stops/*.parquet - config_name: feed_snapshots data_files: - split: train path: data/feed_snapshots/*.parquet - config_name: firehose_trip_updates data_files: - split: train path: data/firehose_trip_updates/*.parquet - config_name: firehose_stop_time_updates data_files: - split: train path: data/firehose_stop_time_updates/*.parquet - config_name: firehose_vehicle_positions data_files: - split: train path: data/firehose_vehicle_positions/*.parquet - config_name: firehose_alerts data_files: - split: train path: data/firehose_alerts/*.parquet --- # NYC Subway Realtime Archive Continuous capture of the New York City subway's public realtime feeds, decoded into analysis-ready tables — plus the derived service-quality panels, learned "normal" baselines, and disruption-prediction track record built on top of them. Collected every 30 seconds since **2026-04-16** across all nine MTA GTFS-RT feeds, by the pipeline behind [subway.fyi](https://subway.fyi). Source: [github.com/digitalhen/subway-data](https://github.com/digitalhen/subway-data). > **This archive exists because the source data disappears.** The MTA publishes > realtime feeds but no history: each poll overwrites the last, and our own > database drops the raw firehose after 60 days. Everything here is a permanent > record of moments that are otherwise gone. It is **append-only** — new days are > added, old days are never rewritten. ## What makes this different from GTFS-RT dumps Three things, roughly in order of how much work they represent: 1. **The 5-minute analytics panel** (`route_station_5min`) — the firehose already reduced to per route × station × 5-minute service quality: headways, dwell times, arrival delays, bunching, and whether an official alert was active. This is the table most research questions actually want, and it is ~250× smaller than the raw feed it came from. 2. **Learned baselines** (`baselines_headway`, `baselines_stop_hold`) — what "normal" looks like per route × station × day-of-week × hour, rebuilt nightly from months of history **with alert-active periods excluded** so normal never learns from a bad day. This is what turns a headway into an anomaly. 3. **A labelled disruption-prediction record** (`delay_predictions`) — every evaluation the live delay radar has made, each labelled by a nightly job against the alerts that actually followed. A ready-made benchmark, described below. Plus the NYCT protobuf extensions most parsers silently drop: `train_id`, `is_assigned`, `scheduled_track`, `actual_track`, NYCT direction. ## Quick start ```python from datasets import load_dataset panel = load_dataset("digitalhen/nyc-subway-realtime", "route_station_5min", split="train") ``` Most of this is better handled as Parquet than as a `datasets` iterator. For anything analytical, query the files directly: ```python import duckdb duckdb.sql(""" SELECT route_id, avg(avg_headway_sec)/60 AS mean_headway_min, avg(headway_cv) AS mean_bunching FROM 'data/route_station_5min/*.parquet' WHERE NOT alert_active AND extract(hour FROM bucket_start AT TIME ZONE 'America/New_York') BETWEEN 8 AND 9 GROUP BY 1 ORDER BY 2 DESC """) ``` ```bash hf download digitalhen/nyc-subway-realtime --repo-type dataset --local-dir . \ --include "data/route_station_5min/*" ``` ## Contents Coverage windows differ by table because retention policies differ. Row counts and exact per-file coverage are in `manifest.json`. ### Derived analytics — the long-history core | config | grain | coverage | notes | |---|---|---|---| | `route_station_5min` | route × station × 5 min | from 2026-05-14 | headways, dwell, delays, bunching, alert flags. The flagship table. | | `station_hourly` | station × hour | from 2026-04-29 | absolute service quality: avg headway, bunching CV, arrivals, routes served | | `station_daily` | station × day | from 2026-04-17 | daily "badness"/"awfulness" percentile ranks over 3h rolling windows | | `alerts_unique` | alert × content-state | from 2026-05-14 | deduplicated service alerts: cause, effect, full text, active periods, informed entities. **The label source.** | | `delay_predictions` | route × evaluation | from 2026-07-30 | every radar evaluation + nightly outcome labels. See benchmark below. | | `incident_replays` | incident | rolling 30 days | precomputed incident playbacks: contagion grid, origin station, radar-vs-MTA timing | ### Raw realtime firehose One Parquet file per UTC day, append-only. The database drops these chunks at 60 days; the files here are permanent. | config | rows/day | what it is | |---|---|---| | `firehose_stop_time_updates` | ~33 M | per-stop predicted arrival/departure inside each trip update. The big one. | | `firehose_trip_updates` | ~1.6 M | one row per trip entity per snapshot, incl. NYCT extensions | | `firehose_vehicle_positions` | ~1.4 M | per-vehicle position and status (`STOPPED_AT` / `IN_TRANSIT_TO` / `INCOMING_AT`) | | `firehose_alerts` | ~150 k | full re-ingest of every active alert, every poll. 95%+ are byte-identical republishes — use `alerts_unique` unless you specifically want the republish timing. | | `feed_snapshots` | ~26 k | one row per fetch attempt: latency, entity counts, errors. Capture-quality ground truth. | ### Reference and learned structure | config | what it is | |---|---| | `gtfs_stops`, `gtfs_routes`, `gtfs_trips`, `gtfs_stop_times`, `gtfs_shapes` | static GTFS: geography, schedules, route colours, track shapes | | `station_complex`, `station_complex_stops` | MTA station complexes and their GTFS stop mappings | | `ridership_hourly` | average ridership per complex × day-of-week × hour (MTA open data) | | `baselines_headway` | learned normal headway per route × station × dow × hour, alert periods excluded | | `baselines_stop_hold` | routine-hold duration per platform (p50/p95/p99) — a 9-min hold is normal at Canal St, an emergency at 167 St | | `station_adjacency` | directed station hops per route and direction, from static schedules | | `terminal_stops` | terminal platforms, where long dwells are normal | ## A ready-made benchmark: predict disruptions before the MTA announces them `delay_predictions` is a labelled record of a real prediction task run live in production. Each row is one evaluation of one route at one minute, with the features that drove it, whether it fired, and — from a nightly labelling job — whether an official MTA alert actually followed and how many minutes later. The production model ([`digitalhen/nyc-subway-delay-radar`](https://huggingface.co/digitalhen/nyc-subway-delay-radar)) scores, on a holdout it was evaluated on exactly once: | | delay radar v2.7 | naive rule | |---|---|---| | episode recall | 0.13 | 0.053 | | precision | 0.446 | 0.242 | | false alarms/day | 5.75 | 5.88 | | median lead time | 43 min | — | **Those are the numbers to beat.** Recall is genuinely low — about one disruption in eight — because most incidents never produce a legible signature in the public feed before they are announced. That is the research problem, not a bug in the benchmark. Four rules matter if you want your numbers to mean anything here, each learned by getting it wrong first: 1. **Split on time, never at random.** Adjacent 5-minute rows from one incident are nearly identical; a random split leaks and will flatter you enormously. 2. **Score episodes, not rows.** Rows within an incident are hugely autocorrelated. Per-row AUC on this data is meaningless. Collapse per route on a ~90-minute window. 3. **Use `alert_seen_at`, not the MTA's `active_period` start.** The MTA backdates alerts. `alert_seen_at` is *our own first observation* — the only timestamp that makes "we saw it first" a real claim rather than an artifact. 4. **Respect suppression.** A route with a currently active alert does not fire in production, so it must not train as though it would. Note that planned-work postings sit in the feed 24/7 — presence in the feed is not the same as being active. ## Provenance and honesty notes - **Timestamps.** Everything is `TIMESTAMPTZ`, stored UTC. NYC service days, rush hours, and weekend effects only make sense in `America/New_York` — convert before bucketing by hour or day, and note that DST transitions produce a 23- and a 25-hour day. - **`fetched_at` is when *we* observed it**, not when the MTA generated it. That distinction is the whole point of the archive; `feed_ts` in `feed_snapshots` carries the feed's own timestamp when you need the other one. - **Capture gaps are visible, not hidden.** `feed_snapshots` records every fetch attempt including failures. There is a known ~6-minute gap on 2026-07-30 (19:52–19:58 ET) from a planned database migration. Check `feed_snapshots` before attributing a quiet period to the subway rather than to us. - **JSON columns** (`active_period`, `informed_entities`, `payload`) are stored as JSON strings, not nested Parquet structs — parse with `json.loads` or DuckDB's `json` functions. - **Reproducible cutoff.** Every export run is bounded by one instant, recorded in `manifest.json`. Capture never stops, so a row count only matches a live database when both sides are bounded by the same instant. - **Not an MTA product.** Unofficial, unaffiliated, not endorsed. Derived from public feeds that remain subject to the MTA's own terms. - **No personal data.** GTFS-RT describes vehicles, not riders. Ridership figures are pre-aggregated MTA open data. - **`station_id` convention:** `COALESCE(parent_station, stop_id)` — platform rows are rolled up to the station they belong to. ## Updates **Updated daily**, at roughly 10:30 UTC, publishing the previous day once the upstream nightly jobs have finished computing and labelling it. History here only ever grows. A partition file stays open — rewritten on each run — until its period has closed and any late-arriving updates have landed; after that it is final and never touched again. Raw firehose days are final immediately, since a captured row never changes. So: - **New days append.** Old days do not move. - **The current month is live** and will keep growing until the month ends. - **A file that is final stays byte-identical**, which is what makes a pinned revision reproducible. Pin one with `revision=` if you need that guarantee. The one deliberate exception is `alerts_unique`, which is republished whole each run because an alert's `last_seen_at` keeps advancing while it is still live. Because the source database prunes the firehose at 60 days, this archive becomes the only surviving copy of those days — its history grows past what the database itself can hold. ## Citation ```bibtex @misc{williams2026nycsubway, author = {Williams, Henry}, title = {NYC Subway Realtime Archive}, year = {2026}, url = {https://huggingface.co/datasets/digitalhen/nyc-subway-realtime}, note = {Captured continuously from MTA GTFS-RT feeds since 2026-04-16} } ``` ## Licence **CC BY-NC 4.0** — use, share, and adapt it freely, with credit to Henry Williams / subway.fyi, for non-commercial purposes. Two layers, owned differently: | layer | status | |---|---| | upstream MTA GTFS-RT, static GTFS, ridership | the MTA's public open data, under the MTA's own terms. Not claimed here — fetch it from the source if that's all you need. | | this archive and everything derived from it — the captured history, the analytical panels, the learned baselines, the labelled predictions | my work, licensed to you under CC BY-NC 4.0 | The distinction matters because the MTA keeps no history: each poll overwrites the last. So this isn't a mirror of a public dataset — it's a record that wouldn't otherwise exist. For commercial use, including training a model that's commercially deployed or sold, please get in touch first — derived weights carry the same limit. Static GTFS and ridership tables are included for reproducibility and remain the MTA's.