app.state.arrivals
Arrival detection from GPS: when did a vehicle actually reach each planned stop.
A port of ml/src/features/tabular.gps_history with the same constants: the prediction model was
trained on arrivals found by exactly this rule, so the backend’s current deviation must use it too.
For a moment T, walk the stops planned in [T − 1 h, T + 5 min] (skipping manually-filled ones) in
order. The arrival at a stop is the GPS fix closest to it, within ARR_RADIUS_M, inside the window
[plan − 7 min, plan + 12 min] ∩ (previous arrival, T] — and only once the vehicle has since moved
LEAVE_M further away (it has left the stop). Dwell = time spent within ARR_RADIUS_M.
Functions
|
Arrivals at stops planned in [T − 1 h, T + 5 min], from cleaned telemetry ( |
Classes
|
- class app.state.arrivals.Arrival(pos: 'int', plan_s: 'int', arrival_s: 'int', delay_s: 'float', dwell_s: 'float')[исходный код]
Базовые классы:
object- __init__(pos: int, plan_s: int, arrival_s: int, delay_s: float, dwell_s: float) None
- arrival_s: int
- delay_s: float
- dwell_s: float
- plan_s: int
- pos: int
- app.state.arrivals.detect_arrivals(ts: numpy.ndarray, lon: numpy.ndarray, lat: numpy.ndarray, sched: VehicleSchedule, T: int) list[Arrival][исходный код]
Arrivals at stops planned in [T − 1 h, T + 5 min], from cleaned telemetry (
tssorted, int seconds, only fixes withts <= Tmatter; invalid positions are NaN).