eventhub/README_HOME_TO_HOME_TRIP_PA...

53 lines
1.6 KiB
Markdown

# HOME-to-HOME classified trip patch
## Definition
A complete trip is created from two consecutive NDI classifications with status `HOME`.
- Active trip start: `startHomeClassification.evidence.endedAt`
- Active trip end: `endHomeClassification.evidence.startedAt`
- Boundary evidence: both complete HOME classification objects
- Contained evidence: every `NOT_HOME` classification fully contained in the active trip window
- Country segmentation: calculated separately inside each completed trip
A middle HOME classification is shared: it closes the preceding trip and starts the following trip.
Classifications before the first HOME and after the last HOME are not assigned to a completed trip. Their count is exposed as `unassignedNonHomeClassificationCount`.
## Result additions
`DriverCountryTripSegmentationResult` now contains:
- `tripCount`
- `unassignedNonHomeClassificationCount`
- `trips`
Each `DriverClassifiedTrip` contains:
- `tripId`
- `startedAt`, `endedAt`, `durationSeconds`
- `startHomeClassification`
- `endHomeClassification`
- `containedNonHomeClassifications`
- `drivingIntervalCount`
- `countrySegmentCount`
- `countrySegments`
Each `DriverCountryTripSegment` now contains:
- `tripId`
- `countryCode`
The former flat `segments` collection remains available and is the concatenation of all per-trip segments. Compatibility constructors are retained for Java callers using the former record signatures.
## Pipeline order
`country-trip-segmentation` now explicitly depends on:
```text
support-evidence-normalization
ndi-home-classification
```
This guarantees that the trip boundaries are available before country segmentation starts.