app.predict.payload

Building ML PredictRequest bodies from vehicle state (contract: ml/src/inference_service.py).

Functions

predict_request(tr_id, T, target, cur_dev_s, ...)

sample_id(tr_id, T)

{tr_id}_{unix(T)} — the dataset's convention, so live predictions can be diffed against the batch.

schedule_rows(s)

The vehicle's whole day plan: the model derives trip structure (position in trip, terminals ahead) from the rows it gets, so a truncated plan would silently corrupt those features.

telemetry_rows(pings)

app.predict.payload.predict_request(tr_id: int, T: datetime, target: StopVisit, cur_dev_s: float, pings: list[Ping], schedule: list[dict]) → dict[исходный код]
app.predict.payload.sample_id(tr_id: int, T: datetime) → str[исходный код]

{tr_id}_{unix(T)} — the dataset’s convention, so live predictions can be diffed against the batch.

app.predict.payload.schedule_rows(s: VehicleSchedule) → list[dict][исходный код]

The vehicle’s whole day plan: the model derives trip structure (position in trip, terminals ahead) from the rows it gets, so a truncated plan would silently corrupt those features.

app.predict.payload.telemetry_rows(pings: list[Ping]) → list[dict][исходный код]