time-travel-robustness at beginning of trips #162
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed previously in the Transitous channel, time travel is not fixed by nigiri under certain circumstances, e.g. in this DELFI RT feed update from today 18:06 (archive) for
trip_id
2716892734:I.e. the
stop_time_update
s only start atstop_sequence
2, and so nigiri keeps the scheduled times or whatever was set before as rt times for the first two stops, crucially without then ensuring a non-negative travel time to the third stop. This is fixed with this PR.Note that according to the GTFS-RT spec, if initial stops don't have a
stop_time_update
, "then the consumer should assume that no real-time information exists for [that stop] at that time, and schedule data from GTFS should be used". AFAICT, the nigiri model does not allow for that, because realtime info can not be removed on a stop-by-stop basis. But I don't think this is a major problem, keeping previous realtime info might actually be helpful in some cases, and this should in theory only occur for stops in the past...