NeTEx mapping to StopTime.timepoint - #3898
Conversation
ab9d46b to
67421f2
Compare
|
I think the |
|
@hannesj Are you saying that GTFS timepoints and Netex waitpoints are the same thing? |
|
I don't think that timepoint is the same as waitPoint, this is not how I interpret it. Please let me know if I'm wrong and we should use the field for bouth. We have a mix of GTFS and NeTEx so it would be important that they represent the same situation. I can agree with that the documentation in GraphQl timepoint is different from GTFS documentation, but I don't know if it's part of this pull request to change and if so to what, the pull request regards first and most NeTEx. |
|
The definition for a time point, is that a vehicle will not leave it before the assigned departure time, even if it was running ahead of schedule before it. I think this is quite the same as a waitPoint in Netex, or what do you think is the difference? |
|
What's the NeTEx definition of waitPoint? |
| .description("Whether this is a timing point or not. Boarding and alighting is not allowed at timing points.") | ||
| .dataFetcher(environment -> ((TripTimeOnDate) environment.getSource()).isTimepoint()) | ||
| .description( | ||
| "Whether this is a timing point or not. Boarding and alighting is not allowed at timing points.") |
There was a problem hiding this comment.
In GTFS, you can board and alight at timepoints. Furthermore, in the current GTFS spec timepoints are always stops (i.e., timepoint is an attribute of a record in stops.txt).
There was a problem hiding this comment.
We have talked about this PR internally, I will open an new and put a link here. The business logic for the NeTEx waitPoint is not OK and @hannesj you are right, the attribute exists already, the name should be different because it is not transmodel, but I will keep it as is. @barbeau I will explain in detail the NeTEx definition of waitPoint in the next PR. It will be much cleaner and simpler.
There was a problem hiding this comment.
I’d suggest to just reuse this PR and force-push a new more clean commit. That way we can have the discussion and history in one place
- Map from NeTEx to StopTime in StopTimesMapper - Add Unit test in StopTimesMapperTest for all permutations of mapping possibilties
67421f2 to
52ae014
Compare
I can't comment on the current behavior in OTP as I'm not familiar with the code, but I agree that the description does not match the GTFS definition of timepoint. Boarding and alighting is certainly allowed at timepoints in GTFS by default. |
Just to clarify the previous discussion - so it seems to me that conceptually the basic definition of @TimMickelsonSkanetrafiken Do you agree? |
@barbeau This is exactly what I mean, I just wanted to be very precise in my documentation. In NeTEx we have the |
| // From NeTEx we define timepoint as a waitpoint with waiting time defined (also 0) | ||
| if (Boolean.TRUE.equals(stopPoint.isIsWaitPoint()) | ||
| && passingTime.getWaitingTime() != null) { | ||
| stopTime.setTimepoint(1); |
There was a problem hiding this comment.
I think it would be an immprovment if the OTP internal model for time point would be an enum. The value 1 here is not telling me what this is. Then there is also a place to document what this mean in NeTEx as well. So for the future don´t hasitate to make this kind of improvements. For example: enum TimePoint {ESTIMATE(0), TIMEPOINT(1); int gtfsCode;}.
t2gran
left a comment
There was a problem hiding this comment.
I will approve this, my only comment is relay about the old code, which is using an integer code without any documentation of what 1 and 0 means.
07d06de
@t2gran Please let me know if you want me to document somewhere, that could be done quite quickly I guess? |
Summary
As GTFS has a mapping
stop_times.timepointto OpenTripPlanner internal modelStopTime.timepointa similar timepoint exists in NeTEx. The short definition is that if theStopPointInJourneyPattern.isWaitPointis true and theTimetabledPassingTime.WaitingTimeis defined then theStopTime.timepointis consideredtrue(The vehicle has a planned waiting time on given stop).The more complex description is that in NeTEx we are actually considering an object called
TimingPoint. This object is more complex than an GTFSstop_times.timepointthat is basically a boolean. But a special case when theTimingPointhas set a WaitTime then the NeTExTimingPointis considered to have planned wait time if the vehicle is ahead of schedule. TheTimingPointin NeTEx can be linked to the JourneyPattern and if so the stop is aTimingPointfor all trips on this pattern. Actually there is a convinience boolean already included in NeTEx for if the WaitTime is set on the journey pattern, the already mentionedStopPointInJourneyPattern.isWaitPoint. TheTimetabledPassingTimehas no such boolean but could contain aTimingPointreference to link theTimingPointnot only to the journey pattern but actually to the stop and the given trip. But thankfully, theTimetabledPassingTimehas a convinience variable calledWaitingTime, documented as Planned waiting time at a Point.Note: Sadly the Transmodel GraphQl API exposes a boolean named timepoint, note that this name is not transmodel, it would probably be more correct with the name WaitPoint as in the
StopPointInJourneyPattern.isWaitPoint. Even worse, then name timepoint is very easily confused with the existing Transmodel objectTimingPoint. I don't wont to touch the name though, becuase it would be a breaking change.Note2: The actual documentation on the exposed timepoint is Whether this is a timing point or not. Boarding and alighting is not allowed at timing points. This text does not seem to be true, and is not what is documented actually in GTFS (https://developers.google.com/transit/gtfs/reference#stop_timestxt). I would like to change this documentation, e.g. Indicates whether the stop has planned wait time for given trip, i.e. if the stop is a timing point.. Please let me know if you agree?
Unit tests
A test was added for the NeTEx mapping to check some different cases.
Documentation
GraphQl attribute is documented