jamespfennell / transiter

Web service for transit data
https://demo.transiter.dev
MIT License
62 stars 7 forks source link

Return `directionId` with StopTime #105

Closed cedarbaum closed 1 year ago

cedarbaum commented 1 year ago

This change modifies the StopTimes returned from calls to the /stops to also include the directionId for the associated trip. The reason for the change is that when using the PATH system, there does not seem to be a way to easily determine what direction the train is heading. For the NYC subway, in contrast, this can be inferred by either the trip's ID or the platform.

On a side note, I know I've sent a lot of PRs recently, so I wanted to thank you again for all your time (and please don't feel obligated to review this quickly, it's not urgent)!

jamespfennell commented 1 year ago

This sounds great to me! Just one suggestion: would it be possible to put the new field in the Trip.Preview message instead? Each stop time contains this message in the trip field, so you will still be able to read the field if you have a stop time.

This suggestion is mainly because the direction ID is a property of the trip, rather than the stop time. But also the GTFS realtime spec is kind of weird and the direction ID is technically part of the "trip descriptor" that uniquely identifies a trip, and so it should probably be in the trip preview anyway...

cedarbaum commented 1 year ago

Makes sense, I've made the change to add it to the Trip.Reference entity instead.

jamespfennell commented 1 year ago

Super, thanks!