Repository navigation
Add Leg.stopCalls with full flex information to GTFS API - #6757
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6757 +/- ##
=============================================
- Coverage 71.76% 71.76% -0.01%
- Complexity 19317 19327 +10
=============================================
Files 2088 2090 +2
Lines 78711 78770 +59
Branches 8020 8027 +7
=============================================
+ Hits 56487 56526 +39
- Misses 19367 19385 +18
- Partials 2857 2859 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@binh-dam-ibigroup If you want to test this, you can do it with the Clackamas GTFS feed and the following query |
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
Well-written and works after trying different configs. I made a few minor suggestions.
| try { | ||
| CallSchedule schedule = impl.schedule().get(env); | ||
| assertEquals(new CallSchedule(new TimeWindow(TEN_AM, TEN_AM.plusMinutes(30))), schedule); | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Previous test has Exception in the method declaration instead of a try/catch block, it should probably be the same here. You could also combine the two tests into a parameterized test.
There was a problem hiding this comment.
I agree but there is a complication, namely that this one activates the flex feature for the duration of the test, which means that the code is executed in a Runnable. This means that the exception is not propagated and needs to be handled explicitly. I don't like it either.
There was a problem hiding this comment.
Probably worth adding a comment about that.
Co-authored-by: Binh Dam <56846598+binh-dam-ibigroup@users.noreply.github.com>
| import org.locationtech.jts.geom.LineString; | ||
| import org.opentripplanner.framework.i18n.I18NString; | ||
| import org.opentripplanner.model.PickDrop; | ||
| import org.opentripplanner.model.TripTimeOnDate; |
| originates and the Place where the leg ends. For non-transit legs, null. | ||
| """ | ||
| intermediatePlaces: [Place] | ||
| intermediatePlaces: [Place] @deprecated(reason : "Use `leg.stopCalls` instead") |
There was a problem hiding this comment.
So this was always just stops despite using the place type?
There was a problem hiding this comment.
Yes, it was only stops:
For non-transit legs it returned null.
| type Location { | ||
| "The geometry representing the geographic extend of the location." | ||
| geometry: StopGeometries! | ||
| gtfsId: String! |
There was a problem hiding this comment.
Add a generic comment describing the id's structure like we usually have.
| This is mostly used by demand-responsive services. | ||
| """ | ||
| type LocationGroup { | ||
| gtfsId: String! |
| "The members that are part of the group." | ||
| members: [Stop!]! |
There was a problem hiding this comment.
Btw can these stops be stations? I think we should document it here regardless of how it is.
There was a problem hiding this comment.
I think that the assumption is that can only be regular stops, but if you forced it you could convince yourself that a station is allowed: https://gtfs.org/documentation/schedule/reference/#location_group_stopstxt
I will add a note but perhaps this could use a clarification in the spec.
| "A time window when a vehicle visit a stop, area or group of stops." | ||
| type TimeWindow { | ||
| end: OffsetDateTime! | ||
| start: OffsetDateTime! | ||
| } |
There was a problem hiding this comment.
Are the start and end inclusive/exclusive?
There was a problem hiding this comment.
Start is easily answered: it is inclusive.
End is defined as "the time that the service ends" so technically the last pick up time would be 17:59:59.999 and not 18:00. It would look pretty odd in a travel plan though so I'm not sure that it's worth being very strict with the spec here.
There was a problem hiding this comment.
Yeah I was just wondering if people would configure it with a minute granularity like 00:00-00:59 and then there is a whole minute where it's slightly unclear if the service is on or not.
| @@ -0,0 +1,41 @@ | |||
| package org.opentripplanner.updater.trip; | |||
There was a problem hiding this comment.
Sort of a weird package for this as we don't have support for flex in trip updates.
| import org.opentripplanner.transit.service.TimetableRepository; | ||
| import org.opentripplanner.updater.trip.FlexTripInput.FlexStop; | ||
|
|
||
| public class RealtimeTestEnvironmentBuilder { |
There was a problem hiding this comment.
Same concern again, why do we use a realtime test environment for flex stuff?
There was a problem hiding this comment.
The RealTimeTestEnvironement is the easiest way to build a full TransitService so you don't have to build the whole data model (stop times, trip, route, agency, trip times, timetables...) by hand.
The other option is to make a builder just for flex stuff but that would share much of the same code. What do you think of elevating this to a general purpose "data model builder" and renaming it?
There was a problem hiding this comment.
We discussed this on Tuesday and it's fine to use this test environment here for now.
|
There is a conflict |
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
I'm good with the latest documentation changes and cleanups.
Summary
Adds the field
Leg.callsto the GTFS API. This is intended as a replacement for bothintermediatePlacesandintermediateStopsby providing the full information about the calls of a leg, in particular the full information about flex windows and flex stop types.It uses the the
StopCalltype introduced in #5393 and adds flex-specific data to it.Unit tests
Lots added.
Documentation
Javadoc.
cc @miles-grant-ibigroup