Skip to content

Conversation

@thecristen
Copy link
Collaborator

Scope

Asana Ticket: [SF/UD] Subway: 🐞 Use vehicle info to inform "Approaching"/"Arriving"/"Boarding"

Implementation

For each prediction, fetch the related vehicle. If that vehicle has a populated status and the vehicle's corresponding stop is the same as the stop we're viewing in SF2.0, then we use this to display "Approaching"/"Arriving"/"Boarding".

How to test

Note this change only affects subway lines.

I like to watch Upcoming Departures alongside the corresponding screens in Screenplay. Screenplay doesn't update the previews as frequently as our LiveView updates, but you can see matching statuses!

@thecristen thecristen requested a review from a team as a code owner February 4, 2026 19:29
@thecristen thecristen requested a review from lvachon1 February 4, 2026 19:29
Copy link
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach! It's a bit different from how I was originally thinking this would be done, but I actually like your overall approach better!

My comment about showing Approaching for too long / still using the time even when we have vehicle info, is blocking.


defp realtime_arrival_status(%{route_type: :subway, vehicle_status: vehicle_status})
when vehicle_status != nil do
arrival_status_from_vehicle(vehicle_status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue (blocking): This is a bit too coarse. We still need to use arrival_time here, or else we'll show Approaching/Arriving for trains that have to make a long journey (e.g. it's six minutes from JFK to North Quincy, but we don't want to show Approaching for that whole time).

Image

@thecristen thecristen requested a review from joshlarson February 9, 2026 14:19
@thecristen
Copy link
Collaborator Author

@joshlarson I refactored this enough that I feel like it may as well be a new PR 😵
I'll note we might still notice discrepancy between upcoming departure and trip details, since this change only impacts the former (trip details already used vehicle status! just slightly differently) -- likely we might want to reconcile the two at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants