app.api.views
Dashboard views: routes, vehicles and schedules in the shapes frontend/js/mock.js defines.
The dataset has no routes — only each vehicle’s planned stop visits for the day. So route_id is the
vehicle id, and every distinct trip shape (grouped by its first and last stop) is one «direction» with
its own line: the map projects the vehicle and its schedule onto the line of the vehicle’s current trip,
which a back-and-forth whole-day polyline would make ambiguous. Lines are stop-to-stop straight segments
(there is no road geometry in the dataset).
Functions
|
The latest forecast, while its target stop is still ahead. |
|
Next planned visit: after the last detected arrival if that's recent, otherwise by plan time and current deviation. |
|
The vehicle's current trip: passed stops with the detected arrival, the target stop with the model's forecast, other upcoming stops with the current deviation carried forward. |
|
|
|
Stops with the largest forecast delays over the last |
Classes
|
Built once from the schedules: route payloads and the direction of every trip. |
- class app.api.views.RouteCatalog(schedules: dict[int, VehicleSchedule])[исходный код]
Базовые классы:
objectBuilt once from the schedules: route payloads and the direction of every trip.
- __init__(schedules: dict[int, VehicleSchedule]) None[исходный код]
- direction(tr_id: int, trip: int) int[исходный код]
- app.api.views.current_prediction(p: Prediction | None, T: datetime) Prediction | None[исходный код]
The latest forecast, while its target stop is still ahead.
- app.api.views.next_pos(v: VehicleState, T: datetime) int[исходный код]
Next planned visit: after the last detected arrival if that’s recent, otherwise by plan time and current deviation.
- app.api.views.schedule_payload(state, v: VehicleState, T: datetime) dict[исходный код]
The vehicle’s current trip: passed stops with the detected arrival, the target stop with the model’s forecast, other upcoming stops with the current deviation carried forward.
- app.api.views.vehicle_payload(state, v: VehicleState, T: datetime, max_age_s: float) dict | None[исходный код]
- app.api.views.worst_stops(state, T: datetime, limit: int, window_s: float = 1800) list[dict][исходный код]
Stops with the largest forecast delays over the last
window_sof dataset time.