-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for deleted trips & including real-time cancelations in trip search #4759
Conversation
Codecov ReportBase: 61.83% // Head: 61.87% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #4759 +/- ##
=============================================
+ Coverage 61.83% 61.87% +0.04%
- Complexity 12713 12831 +118
=============================================
Files 1612 1619 +7
Lines 64614 64958 +344
Branches 7019 7078 +59
=============================================
+ Hits 39953 40196 +243
- Misses 22410 22481 +71
- Partials 2251 2281 +30
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -291,7 +291,8 @@ public UpdateResult applyTripUpdates( | |||
tripId, | |||
serviceDate | |||
); | |||
case CANCELED -> handleCanceledTrip(tripId, serviceDate); | |||
case CANCELED -> handleCanceledTrip(tripId, serviceDate, false); | |||
case DELETED -> handleCanceledTrip(tripId, serviceDate, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about this in the dev meeting today. I'm not a huge fan of passing booleans to methods. I think I have a slight preference for using an enum instead in this case but will leave the choice up to you: the enum also not very pretty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I perhaps ask you to write a test for a GTFS trip update with scheduleRelationship=DELETED
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from NeTEx/SIRI point of view.
I think REPLACED would be a better name for the new property. We are not really deleting this trip - we are replacing scheduled version of the trip with realtime-based version of the trip. I wonder if it wouldn't be better to have separate field for this property in TripTimes. This is for internal use only. We will never present this information to a client.
@@ -31,4 +31,9 @@ public enum RealTimeState { | |||
* trip pattern of the scheduled trip. | |||
*/ | |||
MODIFIED, | |||
|
|||
/** | |||
* The trip has been canceled, and should not be visible to the end user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true. It has been replaced, not cancelled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, in GTFS language it is deleted. This means that you should never ever show it to a user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definition comes from the GTFS-RT specification, which we use as a base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated description
@@ -72,7 +71,7 @@ public TripPatternForDate map(Timetable timetable, LocalDate serviceDate) { | |||
if (!serviceCodesRunning.contains(tripTimes.getServiceCode())) { | |||
continue; | |||
} | |||
if (tripTimes.getRealTimeState() == RealTimeState.CANCELED) { | |||
if (tripTimes.isDeleted()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we exclude both CANCELLED and DELETED here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, since those will be either filtered or not in the RaptorRoutingRequestTransitData
.
@@ -213,13 +213,13 @@ public List<String> getHeadsignVias() { | |||
} | |||
|
|||
public PickDrop getPickupType() { | |||
return tripTimes.isCanceled() || tripTimes.isCancelledStop(stopIndex) | |||
return tripTimes.isCanceledOrDeleted() || tripTimes.isCancelledStop(stopIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? Deleted does not mean that the pickup is cancelled.
? PickDrop.CANCELLED | ||
: tripPattern.getBoardType(stopIndex); | ||
} | ||
|
||
public PickDrop getDropoffType() { | ||
return tripTimes.isCanceled() || tripTimes.isCancelledStop(stopIndex) | ||
return tripTimes.isCanceledOrDeleted() || tripTimes.isCancelledStop(stopIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem as with pickup type
Summary
GTFS-RT recently added a
DELETED
real-time state in google/transit#352. Add support for this, as well as refactoring the internals of OTP, so that trips replaced by other patterns are marked asDELETED
, while only real cancellations are marked asCANCELED
. This also enables us to add a fieldincludeRealtimeCancellations
in the Transmodel API