app.api.dashboard
The dashboard’s REST API — the calls frontend/js/api.js makes, in the shapes mock.js defines.
Functions
|
Classes
|
- class app.api.dashboard.WhatifRequest(*args: Any, **kwargs: Any)[исходный код]
Базовые классы:
BaseModel- at_stop_id: str | None = None
- route_id: str
- scenario: Literal['add_reserve', 'adjust_interval', 'detour', 'signal_priority', 'hold_at_stop']
- app.api.dashboard.metrics_bunching() list[dict]
Always empty: bunching needs vehicles sharing a route and direction, and the dataset has no route relations between vehicles (each vehicle is its own «route»).
- async app.api.dashboard.metrics_model(request: fastapi.Request) dict
The ML service’s model metrics (cached; last known copy while ML is down) plus live backend metrics.
- app.api.dashboard.metrics_worst_stops(request: fastapi.Request, limit: int = fastapi.Query) list[dict]
Stops with the largest forecast delays over the last 30 minutes (average ≥ 30 s).
- app.api.dashboard.route_signals(route_id: str) list[dict]
Always empty: the dataset has no traffic-light data (the dashboard’s signal layer is a mock-mode feature).
- app.api.dashboard.routes(request: fastapi.Request) list[dict]
One «route» per scheduled vehicle (the dataset has no route ids); each distinct trip shape is a direction.
- app.api.dashboard.schedule(request: fastapi.Request, vehicle_id: int) dict
The vehicle’s current trip, stop by stop: actual arrivals behind it, forecasts ahead.
- app.api.dashboard.vehicles(request: fastapi.Request) list[dict]
Vehicles in service: position, current deviation, the forecast for their target stop and its risk.
- app.api.dashboard.vehicles_now(state) list[dict][исходный код]
- async app.api.dashboard.whatif(request: fastapi.Request, body: WhatifRequest) dict
Scenario effect on the vehicle’s latest forecast, from ML
/whatif/predict; also pushed aswhatif.result.