Multileg unified implementation test#103
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a unified multileg flight aggregation system that replaces the previous merged flights approach with a chain-based model. The new implementation handles direct flights (2 stops), multi-leg flights (3+ stops), and circular routes uniformly by stitching individual arrival/departure records into complete flight chains.
Changes:
- Introduced
UnifiedFlightandFlightStopmodels to represent flight chains with multiple stops - Implemented
fetchUnifiedFlights()method that groups flights by ID+date and stitches legs chronologically - Added
mapUnifiedFlightsToSiri()in SiriETMapper to convert unified flights to SIRI format - Updated
/siriendpoint to use the new unified flight aggregation system - Added comprehensive test suite covering direct, multi-leg, circular, and edge-case scenarios
- Added Svalbard (LYR) airport handling (classified as international by Avinor but treated as domestic)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/model/UnifiedFlight.kt | New model classes for representing flight chains with multiple stops and status tracking per stop |
| src/main/kotlin/service/FlightAggregationService.kt | Implements flight chain stitching logic with gap detection, origin/destination inference, and time window filtering |
| src/main/kotlin/siri/SiriETMapper.kt | Adds unified flight to SIRI mapping with route hash computation, status handling, and fully-cancelled flight detection |
| src/main/kotlin/Endpoint.kt | Updates /siri endpoint to use new fetchUnifiedFlights() instead of fetchAllMergedFlightsAsList() |
| src/main/kotlin/constants.kt | Adds SVALBARD_AIRPORTS constant for special handling of Svalbard routes |
| src/main/kotlin/Main.kt | Updates scanBasePackages from "routes.api" to "routes" (cosmetic change with no functional impact) |
| src/test/kotlin/service/FlightAggregationServiceTest.kt | Comprehensive test suite covering direct flights, multi-leg flights, circular routes, gap detection, missing data inference, and Svalbard classification |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dundant cancellation checks
NiriLorentzen
left a comment
There was a problem hiding this comment.
Should have some more comments to explain the flow better, otherwise nice code.
…cation and enhance documentation
|
NiriLorentzen
left a comment
There was a problem hiding this comment.
My comments seem to have been resolved, lgtm


No description provided.