JSON > + direction_id_use_other_trips_with_same_headsign #sncf - #80
JSON > + direction_id_use_other_trips_with_same_headsign #sncf#80mmathieum wants to merge 7 commits into
JSON > + direction_id_use_other_trips_with_same_headsign #sncf#80Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in GTFS parsing step to infer and fill missing trips.direction_id values by looking at other trips on the same route with the same trip_headsign, aligning with the PR goal of reducing missing direction IDs (e.g., SNCF feeds).
Changes:
- Introduces
GSpec.fixMissingTripDirectionIds()(guarded bydirection_id_use_other_trips_with_same_headsign) and wires it into the parser startup flow. - Extends route JSON config (
RouteConfig) with a new opt-in flag to enable this behavior. - Minor logging/formatting adjustments and a small iteration refactor.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/mtransit/parser/mt/MDirectionHeadSignFinder.kt | Tweaks debug log message formatting for headsign/merge diagnostics. |
| src/main/java/org/mtransit/parser/gtfs/data/GTrip.kt | Refactors list-update iteration style for trip updates. |
| src/main/java/org/mtransit/parser/gtfs/data/GSpecExt.kt | Adds opt-in direction-id auto-fix logic based on same-route same-headsign trips. |
| src/main/java/org/mtransit/parser/gtfs/data/GSpec.java | Exposes route-id enumeration for trips and includes minor formatting updates. |
| src/main/java/org/mtransit/parser/DefaultAgencyTools.java | Calls the new direction-id auto-fix step during parsing startup. |
| src/main/java/org/mtransit/parser/config/gtfs/data/RouteConfig.kt | Adds new JSON config flag direction_id_use_other_trips_with_same_headsign. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…d_use_other_trips_with_same_headsign
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThe change adds configurable inference for missing trip direction IDs, persists updates through ChangesTrip direction normalization
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DefaultAgencyTools
participant GSpec
participant GTrip
participant Database
DefaultAgencyTools->>GSpec: fixMissingTripDirectionIds()
GSpec->>GTrip: group missing IDs by headsign
GSpec->>GSpec: select one matching direction
GSpec->>GTrip: updateDirectionId(tripIdInts, directionId)
GSpec->>Database: persist direction IDs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Try to fix missing trips.direction_id when other route trips with same head-sign have a direction_id...