Map GTFS notice assignments on trip segments to individual stop times - #7809
Merged
leonardehrenfried merged 5 commits intoJul 21, 2026
Merged
Conversation
leonardehrenfried
force-pushed
the
trip-segments
branch
from
July 9, 2026 15:35
f1e9704 to
4cbf694
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7809 +/- ##
=============================================
+ Coverage 74.23% 74.25% +0.01%
- Complexity 22154 22169 +15
=============================================
Files 2461 2462 +1
Lines 86648 86675 +27
Branches 8574 8578 +4
=============================================
+ Hits 64325 64358 +33
+ Misses 19285 19283 -2
+ Partials 3038 3034 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
MaxGosau
approved these changes
Jul 21, 2026
MaxGosau
left a comment
Contributor
There was a problem hiding this comment.
good addition, implementation looks clean.
binh-dam-ibigroup
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds support for GTFS
notice_assignments.txtentries that targettrip_segments. A trip segment (a[from_stop_sequence, to_stop_sequence]range on a trip) is now expanded so that the referenced notice is attached to every stop time the segment covers, instead of being ignored.Issue
This builds on #7801, which added the
trip_segmentstable to the GTFS parser but ignored it when mapping notices (thetrip_segmentscase previously returnednull). Trip segments are part of the experimental GTFS proposal google/transit#638.How the code works:
TripSegmentMapperresolves eachtrip_segment_idto theStopTimeKeys of the stops within the segment's range. It uses the trip's sequence-ordered stop times (TripStopTimes) and includes every stop time whose GTFSstop_sequencefalls within[from_stop_sequence, to_stop_sequence].StopTimeKeyis built from the 0-based stop position in the pattern, not the raw GTFSstop_sequence, to match howStopTimeKeys are referenced elsewhere in OTP. TheStopTimeKey.of(...)Javadoc was clarified accordingly.trip_segment_id, andNoticeAssignmentMapperlooks them up when resolving assignments, emitting one notice assignment per covered stop time. Assignments referencing an unknown record continue to be reported as data-import issues.Unit tests
Unit tests were added to
NoticeAssignmentMapperTestcovering trip-segment notice assignments:from_stop_sequence == to_stop_sequence),stop_sequence, is used to build the key (using non-contiguous stop sequences).The mapping logic is tested at the mapper level with no need for a full graph build.
Documentation
TripSegmentMapperdescribing its purpose and the stored result.StopTimeKey.of(...)parameter documentation to state that the position is the 0-based stop position in the pattern rather than the GTFSstop_sequence.