3.5 KiB
Patch: Vehicle Usage Interval Reconciliation
This patch extends the already introduced runtime event-mixing architecture with an interval-level reconciliation step for tachograph vehicle-usage evidence.
New module
Added runtime module:
vehicle-usage-reconciliation
It runs after:
event-to-vehicle-usage-intervals
and before:
vehicle-usage-merge
Main behavior
The module intentionally does not mix CARD_VEHICLES_USED and IW_CYCLE at event level. Instead, it reconciles the completed vehicle-usage intervals.
Processing phases:
- Split raw vehicle-usage intervals by source type:
CARD_VEHICLES_USEDIW_CYCLEOTHER
- Normalize
CARD_VEHICLES_USEDtechnical midnight splits. - Reconcile normalized
CARD_VEHICLES_USEDintervals withIW_CYCLEintervals. - Produce effective vehicle-usage intervals for downstream processing.
CVU technical midnight split
The technical midnight split is handled only for CARD_VEHICLES_USED / CVU intervals, not for IW_CYCLE.
Pattern:
CARD_VEHICLES_USED interval A ends at 23:59:59
CARD_VEHICLES_USED interval B starts at 00:00:00
same driver
same registration / compatible vehicle
max gap: 1 second
Result:
A + B => one normalized CARD_VEHICLES_USED interval
CVU vs IW reconciliation
After CVU normalization:
normalized CARD_VEHICLES_USED interval
vs
IW_CYCLE interval
Rule:
IW_CYCLE is primary for effective vehicle-usage identity.
CARD_VEHICLES_USED is fallback or corroborating evidence.
Matching currently supports exact or compatible start/end boundaries with a 60-second tolerance.
New classes
src/main/java/at/procon/eventhub/processing/eventprocessing/module/VehicleUsageReconciliationModule.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageIntervalDescriptor.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageIntervalDescriptorFactory.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageIntervalRole.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageIntervalSourceType.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageReconciliationDecisionDto.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageReconciliationResult.java
src/main/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageReconciliationService.java
src/test/java/at/procon/eventhub/processing/eventprocessing/vehicleusage/RuntimeVehicleUsageReconciliationServiceTest.java
Modified existing files
src/main/java/at/procon/eventhub/processing/eventprocessing/module/DriverWorkingTimeModuleKeys.java
src/main/java/at/procon/eventhub/processing/eventprocessing/module/DriverVehicleUsageMergeModule.java
src/main/java/at/procon/eventhub/processing/eventprocessing/plan/DriverWorkingTimeRuntimeProcessingPlan.java
Notes
vehicle-usage-merge now consumes the effective intervals from vehicle-usage-reconciliation when that module has run. If the reconciliation module is omitted from a custom module list, vehicle-usage-merge falls back to raw event-to-vehicle-usage-intervals output.
Tests were added for:
- CVU technical midnight split coalescing
- CVU + IW reconciliation with IW as primary
- CVU fallback when IW is missing
- IW primary when CVU is missing