goodservice.io
Sunny Ng
Transit Techies NYC #7 - March 20, 2019
Slide 2
Slide 2 text
About Me
Full-stack Software Engineer @ Harry’s by day
Public transit nerd all times, occasionally bikes
Slide 3
Slide 3 text
December 31, 2017
NYCT finished implementing
countdown clocks on all lines
Slide 4
Slide 4 text
Inspiration
Slide 5
Slide 5 text
Inspiration
Slide 6
Slide 6 text
What if we automatically detect
irregular headways?
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
MTA NYCT Real-Time Feeds
• GTFS-RT standard + extensions
• 9 endpoints
• IRT, A/C/E/S (Rockaway/Franklin), N/Q/R/W, B/D/F/M, L, SIR, G, J/Z, 7
• Updates every 30 seconds
Slide 9
Slide 9 text
MTA NYCT Real-Time Feeds
Arrival Time Stop ID Stop Name (not in the feed)
9:28:25 am A24N 59 St–Columbus Cir
9:38:37 am A15N 125 St
9:41:37 am A12N 145 St
9:45:37 am A09N 168 St
9:48:37 am A07N 175 St
9:49:37 am A06N 181 St
9:51:37 am
A05N 190 St
9:55:07 am
A03N Dyckman St
9:58:07 am A02N Inwood–207 St
Trip ID: 072200_A..N Direction: 0
Route ID: A Train ID: 1A 1155 FAR/207
Timestamp: 9:37:49 am
Slide 10
Slide 10 text
MTA NYCT Static Feeds
• GTFS Standard
• Zip file of CSV files for routes, trips, stops, stop times, etc.
• Provides scheduled information for a time period
• 19,891 trips, 548,745 stop times
Slide 11
Slide 11 text
Initial Implementation
• Identify “key stations”
• Calculate actual headway using real-time feed
• Calculate scheduled headway using static-feed
• Compare scheduled and actual headways
Slide 12
Slide 12 text
• Minimum or average/median headway is not important
• Routes can be very long
• A train’s run time is 98 minutes each way
• Parts of each route can be in different schedule periods
• Incidents affecting one part/direction of the route may not affect others
Slide 13
Slide 13 text
Uneven Headways
* From MTA’s Review of the G Line (July 10, 2013)
Scheduled departures at
Bergen St (2013)
Slide 14
Slide 14 text
Washington Heights
Central Park W
8 Avenue
Fulton St
Lefferts Blvd Branch
Rockaway (Far Rockaway Branch)
Rockaway (Rockaway Park Branch)
via Chambers St
Slide 15
Slide 15 text
Splitting by Lines
• Routing is transient
• Cannot completely rely on scheduled data
• When was the last time you’ve seen the M train run up to 71 Av until
midnight?
• Provide a view of grouped routes for each line
• Need to differentiate between local/express per line
• GTFS-RT doesn’t explicitly tell us if a train is running local/express
Slide 16
Slide 16 text
Revised Implementation
• Identify physical lines and seed key stations
• Make minimal assumptions about where a route will go
• Service pattern for a route may change within the hour
• Allow multiple concurrent segments
• Ability to detect service changes for free
Slide 17
Slide 17 text
Express or Local?
e.g. Broadway Line (Uptown & Queens)
34 St–Herald Sq
14 St–Union Sq
23 St
28 St
• Trip includes 28 St: local
• Trip includes 14 St–Union Sq, but not 28 St: express
• Trip only includes stop at 34 St—Herald Sq: !
Slide 18
Slide 18 text
Detecting Delays
Slide 19
Slide 19 text
Statuses
• Delay: Any train’s estimated arrival time at the terminal has increased by >= 5
minutes while in between the same two stations
• Service Change: Any train is stopping at different stations than what are
scheduled
• Not Good: Difference in maximum scheduled and actual headway >= 3 minutes
• No Service: Route scheduled to run but no trains detected
• Not Scheduled: Route not scheduled to run
• Good Service: None of the above, hooray!
Slide 20
Slide 20 text
Demo
Slide 21
Slide 21 text
View service levels by route
Slide 22
Slide 22 text
View service levels by line
Slide 23
Slide 23 text
Adapting to late night/weekend service changes
Slide 24
Slide 24 text
Performance stats for each route
Slide 25
Slide 25 text
Slack Integration
Slide 26
Slide 26 text
Twitter Bot - @goodservice_io
Slide 27
Slide 27 text
What’s next?
Slide 28
Slide 28 text
What’s next?
• Real-time service map
• Detect trains slowing down
• Analyze frequent locations of slow downs
• Analyze accuracy of countdown clocks
• Mobile app???