MTA Monitor is a web applications that displays real time train information for New York's MTA system (NYCT, LIRR, MNR). This utilizes the MTA's GTFS-RT feeds and presents the data on a webpage using Flask.
MTA ToS for RT Feeds: https://www.mta.info/developers/terms-and-conditions
git clone https://github.com/millionsouls/mta-monitor.git
cd mta-monitor
pip install -r requirments.txt
Running the app
python app.py
Contains header
entity[]
Field | Type | Description |
---|---|---|
header |
object | Metadata about the feed |
entity[] |
array | List of trip updates or alerts |
Field | Type | Description |
---|---|---|
gtfs_realtime_version |
string | GTFS-Realtime version |
incrementality |
enum | Specifies if the feed is a full dataset or a diff |
timestamp |
integer | Time the feed was generated (UNIX time) |
Contains trip_update
vehicle
Extension
Field | Type | Description |
---|---|---|
id |
string | Unique identifier for this entity |
alert |
object | Optional alert message (if present) |
trip_update |
object | Trip information and stop updates |
vehicle |
object | (Not used) |
is_deleted |
boolean | (Not used by MTA) |
Contains trip
stop_time_update[]
Contains nyct_trip_descriptor
Field | Type | Description |
---|---|---|
trip_id |
string | Unique trip identifier |
route_id |
string | Associated subway route (e.g., A , 6 ) |
start_time string |
UNIX time service begins | |
start_date |
string | Service date in YYYYMMDD format |
schedule_relationship |
enum | Status of the trip |
Field | Type | Description |
---|---|---|
is_assigned |
boolean | Whether the trip is currently assigned to a train |
train_id |
string | Internal train identifier |
direction |
enum | Direction of travel (NORTH , SOUTH ) |
Each object represents timing info for a stop in the trip.
Field | Type | Description |
---|---|---|
stop_id |
string | GTFS stop identifier |
arrival |
object | Arrival time info (UNIX timestamp) |
departure |
object | Departure time info (UNIX timestamp) |
schedule_relationship |
string | Status (SCHEDULED , SKIPPED , etc.) |
Field | Type | Description |
---|---|---|
scheduled_track |
string | Planned track at the stop |
actual_track |
string | Real-time track assignment |
This field is not used by MTA NYCT Subway in the feed.
Attached as an extension to the FeedHeader
.
| Field | Type | Description |
|--------------------------|-----------|
| nyct_subway_version
| string | Version of the NYCT feed specification |
| trip_replacement_period[]
| array | Specifies replacement periods for routes |
Field | Type | Description |
---|---|---|
route_id |
string | Route affected by replacement trips |
replacement_period |
object | Time range during which replacement trips apply |
Field | Type | Description |
---|---|---|
id |
string | Unique indentifer for trip |
trip_update |
object | Constrains trip and stop_time_update data |
Field | Type | Description |
---|---|---|
trip_id |
string | Unique trip identifier |
start_date |
string | Service data |
schedule_relationship |
string | Status of the trip |
route_id |
stirng | Name of the route |
direction_id |
int | direction of travel |
Requires protobuf extension. Array, each entry repsents one stop
Field | Type | Description |
---|---|---|
stop_seuqnece |
int | Order of the stop in ascending order |
arrival.time |
int | UNIX time arrived at station; else scheduled time and accounts for delay |
arrival.delay |
int | Delay in seconds, negative if ahead of schedule |
departure.time |
int | UNIX time departed from station; else scheduled time and accounts for delay. |
departure.delay |
int | Delay in seconds, negative if ahead of schedule |
stop_id |
string | Station identifier, refer to stops.txt |
'mta_railroad_stop_time_update' | object | Contains track and train status data |
Field | Type | Description |
---|---|---|
timestamp |
int | Update time |