Chapter 2 Key Takeaways — The F1 Data Pipeline
Key Takeaways
- Two free sources, one optional. OpenF1 (2023 onward) gives detail: laps, sectors, stints, compounds, pit visits, race control, weather, intervals and ~3.7 Hz car telemetry. Jolpica-F1, the Ergast successor, gives depth: results since 1950, lap times since 1996, pit-lane times since 2011. FastF1 is excellent, but its official timing source now needs an F1 TV subscription, so nothing in this book depends on it.
- Three layers: raw is evidence, processed is interpretation. Keep the raw downloads untouched; fix interpretations in the build scripts and rebuild in a minute.
- Timing data are literal. A 43-minute "green" lap (Pérez, 2023 Japanese GP) is a real line-to-line measurement around a 41-minute pit-lane stay. Clean by reasons (lap 1, pit laps, flags) before thresholds.
- The clean-lap rule keeps 83.3 % of race laps (84,881 of 101,949). Flags remove the most (8,099), the 107 % rule only 488. The 107 % reference is the driver's own stint median, not the session best, which would discard 8,258 more laps, mostly from slower cars and early stints.
- Build decisions have consequences. Moving 396 race stint starts from the in-lap to the out-lap (Monaco, Montreal, Melbourne) changes green-flag pit loss by 2.4–5.4 s at those circuits.
- Cross-check sources with an outer join. From lap 2, OpenF1 and Jolpica agree to the millisecond on 99.991 % of race laps; lap 1 never agrees (median offset +0.389 s). The join also exposes holes: OpenF1 has no laps 2–24 for the 2025 Miami GP.
- Join on keys, never names. Rounds are matched by date (the 2026 Sepang race is "Bahrain Grand Prix" in OpenF1); drivers by number and surname (Norris took number 1 for 2026); teams need a lineage id across rebrands.
- Telemetry is thin and sometimes broken. Median sample interval 0.240 s (~24 m apart above 300 km/h); distance is integrated and runs about 1 % short; 9.4 % of drivers' fastest 2026 qualifying laps contain a frozen stretch longer than 2 s. Plot against time, test for freezes, then align on distance.
Formulas & Metrics
| Name | Formula / rule | Snapshot value |
|---|---|---|
| Clean lap | not lap 1 ∧ not pit in/out ∧ GREEN all lap ∧ timed ∧ ≤ 1.07 × driver's stint median | 83.3 % of race laps |
| Integrated distance | $d_n=\sum_{i\le n}\tfrac{v_{i-1}+v_i}{2}(t_i-t_{i-1})$, $v$ in m/s | median −0.94 % vs official (19 good laps) |
| Lap delta | $\Delta t(d)=t_\text{cmp}(d)-t_\text{ref}(d)$, 5 m grid, laps rescaled to equal length | final value = lap-time gap |
| Green-flag pit loss | in-lap + out-lap − 2 × driver's median clean lap within ±5 laps; circuit median | Albert Park 20.9 s; Monaco 20.7 s; Montreal 20.3 s |
| Frozen-feed test | longest run with speed, rpm, throttle, gear all unchanged while moving | > 2 s on 43 of 459 laps |
| Pit-stop signature | in-lap + next lap − 2 × driver's median lap | real stops 15.6–52.8 s; non-stops ≈ 0 (2025 Miami) |
| Sample spacing | $v \times \Delta t$ | 343 km/h × 0.24 s = 22.9 m |
Common Mistakes
| Mistake | Fix |
|---|---|
| Averaging all laps | Use clean_laps(); know which rule removed what (the funnel). |
Treating lap_duration.min() as pole |
Use the results table; qualifying is classified by Q3 (2026 Brazil: fastest lap in Q2). |
| Inner-joining two sources | Outer join with indicator=True, then read the unmatched rows. |
| Joining on GP, team or driver names | Join on session_key, driver_ref and dates; add lineage ids explicitly. |
| Trusting a pit loss computed from raw OpenF1 stints | Use the fixed boundaries (boundary_shifted); compare with pit-lane time. |
| Assuming the race pit-stop table contains only race stops | On sprint weekends, filter by the raw session tag or the lap-time signature. |
Reading brake = 100 as brake pressure |
It is on/off only; we have no pressure, steering, g, tyre temperature or ERS channels. |
| Aligning laps by time | Align on distance, rescaled to equal length. |
| Plotting telemetry without checking it | Run longest_frozen_run_s; plot against time first. |
| Using 0.0 °C track temperatures | Treat zeros as missing (44 readings in the archive). |
Decision Checklist (before any analysis)
- [ ] Right source for the question (depth → Jolpica; detail → OpenF1)? Session
kindexplicit? Testing excluded? - [ ]
RaceData.summary()andcoverage()run? Any holes, red flags, wet stints? - [ ] Clean laps used, and "clean" right for this question (deleted laps for qualifying; traffic for pace)?
- [ ] Pit work at Monaco, Montreal or Melbourne uses the fixed stint boundaries? Sprint stops filtered?
- [ ] Telemetry plotted against time, frozen-run test passed, laps aligned on distance and rescaled?
- [ ] Resolution respected (~24 m between samples at speed) and missing channels stated?
- [ ] Every number in your write-up traceable to a script and its printed output?