Original practice scenario: A hypothetical charging service receives start, meter and stop messages from stations that occasionally disconnect. Design a session record that remains explainable after retries.
Read model answer +
Use a stable session identity and distinguish physical observations from billing or authorization state. Message delivery can be repeated without representing additional energy or a new session.
Work through it
Record station, connector, session and sequence identifiers with meter readings and timestamps; validate monotonicity within a meter generation and retain anomalous readings.
Define session transitions and recoverable pending states when authorization, physical stop and server acknowledgment arrive in different orders.
Reconcile final meter evidence against accepted readings, deduplicate retransmissions and flag unresolved sessions instead of inventing an endpoint reading.
Tradeoffs to discuss
Waiting for final station evidence improves completeness but delays settlement; provisional views need a clear later-reconciliation policy.
Common pitfalls
A station reboot can reset a meter counter, so a lower reading is not automatically negative consumption.
Specify units and timestamp conventions, and keep manual corrections traceable to the observations they supersede.
Original practice scenario: A hypothetical fleet analysis estimates energy use per trip from irregular telemetry. Trips cross midnight and some readings arrive after the analysis run. Define the query boundaries.
Read model answer +
Start from explicit trip identities and an event-time interval rather than calendar-day grouping. Preserve when each reading became available if the query is intended to reproduce a past decision.
Work through it
Partition readings by vehicle and sensor generation, deduplicate their identities, and order by event time with a deterministic tie-break rule.
Calculate valid consecutive differences within trip boundaries, handling resets and long gaps separately instead of blindly summing every counter change.
Use the declared reporting zone for daily allocation and an arrival-time cutoff for reproducible historical runs; retain missing-coverage indicators beside totals.
Tradeoffs to discuss
Interpolation improves coverage for short gaps but assumes behavior between observations; reporting observed-only totals is conservative while potentially undercounting.
Common pitfalls
Do not connect the final reading of one trip to the first reading of another.
Late backfills must not silently change an already reviewed snapshot without a new result version.