My data source changed its format and didn't tell anyone
Every 2 minutes I record the whole Paris transit network in real time, from PRIM, the open data portal of Île-de-France Mobilités. On December 4 I did my usual morning checks, and one number didn’t make sense: the disk grew 4 GB in 2 days. Normally it grows about 0.5 GB a day.
Where did it come from?
With du (a command that shows how much space each folder takes) I saw that each day of raw data went from about 2.8 GB to 5.1 GB, starting December 2.
Raw data stored per day. The weekend is always lower, but December 2 and 3 are almost double a normal weekday.
So two options: either my poller was writing twice as many files, or each file got bigger.
| Same hour, 08 UTC | Nov 30 | Dec 3 |
|---|---|---|
| files | 60 | 60 |
| journeys in one snapshot | 16,014 | 15,500 |
| stop calls in one snapshot | 159,014 | 181,428 |
| one snapshot (JSON) | 63.6 MB | 88.1 MB |
Same number of files, almost the same number of buses, but every snapshot is 39% bigger. It started at 07:00 UTC on December 2, right after the provider’s outage that morning. So they probably deployed something.
What changed
I compared the field names in two snapshots, before and after. There’s one new list, RecordedCalls: the stops a bus already passed, with the time it actually left.
But that list is small. The real difference is in the old list, EstimatedCalls, which I thought only held stops still ahead. So I measured how far each call is from the moment of the snapshot:
| Snapshot at 08 UTC | Nov 30 | Dec 3 |
|---|---|---|
calls in EstimatedCalls |
159,014 | 177,368 |
| already in the past | 25,782 (16%) | 79,080 (45%) |
| more than 30 min in the past | 7,850 | 36,234 |
| the oldest 1% | 1 hour ago | 24 hours ago |
calls in RecordedCalls |
none | 4,060 |
So even before, passed stops didn’t really disappear. Since December 2, almost half the snapshot is stops that already happened, some from the day before. That’s where the extra size comes from.
PRIM did update its docs on December 1, the day before. They say the answer covers stops from 30 minutes before the request. That matches neither day, and they never mention RecordedCalls. So nothing announced it, and the docs don’t describe it either.
Why nothing broke
My cleaning step keeps the last observation of each stop call. A stop that shows up again an hour later just repeats a state I already have, and calls from the day before are dropped because each call belongs to the day of its planned time. So I checked the shares of measured, cancelled and unreported calls before and after, and they stayed the same.
What I decided
I keep measuring the delay the same way for every day, so November and December stay comparable. The actual times go next to it, not instead of it. They’ll tell me how good the last predictions were, and they’re exactly the right answers a delay prediction model can learn from.
What I learned: a provider can change what it sends whenever it wants. This time df (the command that shows how full the disk is) caught it, but next time it should be an automatic check.
Sources
- PRIM: real-time timetables for all lines (estimated-timetable), the API I record from
- PRIM docs: description of the service, updated December 1
- PRIM docs: the time window of the answer, updated December 1
- PRIM: state of the APIs, where outages show up
- Transit data standards portal, for the SIRI format behind
EstimatedCallsandRecordedCalls