Commit 2a0ef3b
Drop duplicate SIRI pings before plotting or averaging
Prompted by a good question — whether the vehicle id and timestamp had
actually been checked. They had not. Checking found one of each:
- Vehicle identity is fine. Across 6,326 rides in a sampled window, zero
span more than one siri_ride__vehicle_ref, so grouping by siri_ride__id
never blends two buses, and timestamps are monotonic within a ride.
- Timestamps are not. 1,936 of 20,000 rows (9.7%) are exact duplicates of
(ride, recorded_at_time, lat, lon) — the same physical observation
reported in overlapping SIRI snapshots.
Those duplicates were not harmless. On schedule-adherence-map each stop's
position is a 1/distance-weighted average of the pings that matched it, so
a duplicated ping carried its weight twice and pulled the measured route
toward whatever happened to be reported twice; matched pings for the
sample line drop 81 -> 73 once deduplicated. On gps-trace-map they
inflated the ping count and added zero-length map segments (13 -> 12).
Deduplicated at both fetch sites, with the dropped count surfaced in the
card's notes rather than silently discarded. The adherence cache key is
bumped so the fix actually takes effect instead of serving pre-dedup data.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 59d09cb commit 2a0ef3b
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
84 | 93 | | |
85 | 94 | | |
86 | 95 | | |
| |||
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
| 141 | + | |
| 142 | + | |
132 | 143 | | |
133 | 144 | | |
134 | 145 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
0 commit comments