# Runtime driver working-time processing

Runtime driver working-time processing is a source-neutral processing plan over canonical EventHub events.

The preferred runtime execution endpoint is:

```http
POST /api/eventhub/runtime-processing/executions
```

Use:

```json
{
  "processingPlanKey": "driver-working-time-v1"
}
```

## Canonical input idea

The plan should work with events from any source once they are normalized into canonical EventHub event semantics:

```text
DRIVER_ACTIVITY START/END
DRIVER_CARD or DRIVER_VEHICLE_USAGE INSERT/WITHDRAW
POSITION / PLACE / BORDER_CROSSING / LOAD_UNLOAD / IGNITION / ODOMETER support evidence
```

Tachograph files and tachograph databases are only two possible sources. YellowFox and future telematics providers can contribute vehicle-only evidence that is attached to driver partitions by vehicle/time overlap.

## New source-neutral artifacts

```text
DriverWorkingTimeProcessingResultDto
DriverWorkingTimeProcessingCore
RuntimeDriverWorkingTimeScopeProcessingService
DriverWorkingTimeRuntimeProcessingPlan
runtime-driver-event-interval-preprocessor.epl
driver-working-time-derived-projections.epl
```

## Compatibility artifacts

The following names are kept only for backward compatibility with existing file-session APIs and older Postman calls:

```text
TachographEsperDriverProcessingResultDto
TachographEsperProcessingCore
UnifiedRuntimeTachographEsperScopeProcessingService
tachograph-driving-derived-projection-events-preprocessor.epl
tachograph-driving-derived-projection-bundle.epl
```

New runtime-processing code should use the driver-working-time names.

## EPL-backed phase modules

The driver working-time plan now contains first-class EPL-backed phase modules for event-to-interval conversion:

```text
event-to-activity-intervals
  EventHub DRIVER_ACTIVITY START/END events
  -> DriverActivityIntervalEvent

 event-to-vehicle-usage-intervals
  EventHub DRIVER_CARD INSERT/WITHDRAW events
  -> DriverVehicleUsageIntervalEvent
```

The final derived projection module still delegates to the shared working-time projection service for parity with existing file-session processing. This lets us migrate the pipeline gradually: common event-to-interval conversion is now EPL-module based, while the larger rest/trip/overnight projection bundle remains compatibility-safe.
