Case Study 2 — Auditing the Archive: A Data-Quality Scorecard for 91 Races

Type: multi-season analytics study · Sources: OpenF1 2023–2026 R21, Jolpica-F1, the raw Jolpica CSV · Script: code/case_study_02.py (writes code/case_study_02_scorecard.csv) · Charts: 1, plus tables

Setup

Chapter 2 found a series of individual data problems: a 43-minute lap, a race with 23 missing laps, stint boundaries a lap early at three circuits, deleted laps that are still "clean", frozen telemetry. Each one was found by looking at a specific race. A strategist preparing for a season can't look at every race by hand. The question for this case study is the one a team's data engineer asks before the first model is trained: across the whole archive, which problems are common, which are rare, and which seasons have which?

Ray Castellano, whose bets depend on base rates computed across many races, puts the stakes plainly:

Ray: If one race in ten has a problem I don't know about, my base rates are wrong by an amount I can't estimate.

Aisha: Then let's make the amount estimable. Score every race.

The data

The script loops over all 91 races in the snapshot. For each one it builds a RaceData object (Box Box's data layer from this chapter) and records nine checks:

Check What it counts Why it matters
OpenF1 laps missing vs Jolpica Jolpica timed laps minus OpenF1 timed laps, per driver, summed holes in the detailed source
Untimed lap 1 OpenF1 lap-1 rows with no lap_duration start analyses lose cars
Stint start moved by the build stints with boundary_shifted pit loss and tyre age depend on it
Pit rows borrowed from Jolpica pit.source == "jolpica" no OpenF1 pit data (2023 R1–R6)
Laps deleted by race control parsed DELETED messages matter for qualifying-style questions
Red flag RED track-status windows extreme laps, restarts
Wet-tyre stints INTERMEDIATE or WET stints dry-tyre models must exclude them
0.0 °C track temperature weather records reading exactly zero sensor dropouts in a model input
Sprint stops in the race pit table rows of the processed race pit table that the raw Jolpica CSV tags as sprint stops an early build mixed them in

The last check needs the raw Jolpica CSV, because only the raw CSV carries each stop's session tag. It tests the book's own build: an early version flattened race and sprint stops into one table (Case Study 1 shows the consequences at Miami).

Analysis

How many races does each problem touch?

sprint-tagged stops in the raw Jolpica CSV, 2023+: 174 at 15 weekends; found in the processed race pit table: 0
races scored: 91

RACES AFFECTED BY EACH CHECK (count of races with a non-zero value), by season
year                       2023  2024  2025  2026
missing_vs_jolpica           12    15     1     2
lap1_untimed                 13    17     8     8
stint_starts_moved            3     3     3     3
pit_rows_from_jolpica         6     0     0     0
deleted_laps                 21    24    23    21
red_flags                     4     3     1     4
wet_stints                    2     3     3     3
zero_track_temp               0     0     0     7
sprint_stops_in_pit_table     0     0     0     0
races                        22    24    24    21

totals across all races: {'missing_vs_jolpica': 504, 'lap1_untimed': 93, 'stint_starts_moved': 396,
'pit_rows_from_jolpica': 219, 'deleted_laps': 1416, 'red_flags': 14, 'wet_stints': 354, 'zero_track_temp': 10,
'sprint_stops_in_pit_table': 0}

Grouped horizontal bars: share of races affected by each of nine data-quality checks, for 2023, 2024, 2025 and 2026.

📊 Figure (described): The share of races in each season that trip each check. Deleted laps are nearly universal (95–100 % of races every year). Missing or untimed lap-1 data are common in 2023 and 2024 and rarer since. Some problems belong to one season: Jolpica-borrowed pit rows only in 2023, 0.0 °C track readings only in 2026. Red flags stopped four races in 2023 and four again in 2026. The sprint-stop bar is empty in every season: the build now keeps sprint stops out of the race pit table.

Read the table by type of problem, because each type calls for a different response.

Ubiquitous, harmless if understood. Deleted laps appear in 89 of 91 races (1,416 race deletions in all). They are not errors; they are a fact about the race that matters for some questions (legal lap times) and not others (race pace). The response is an option in the loader, not a fix.

Common, small, concentrated in one place. "OpenF1 laps missing vs Jolpica" touches 30 races, but most of those have one or two missing laps, nearly all lap 1s with no time. Only two races are missing more than seven laps:

races with more than 1 OpenF1 lap missing vs Jolpica:
 2023    Italian Grand Prix                   7
 2023 United States Grand Prix                   4
 2024        Monaco Grand Prix                  16
 2025         Miami Grand Prix                 446
 ... (five more races with 2 each)

Monaco 2024's 16 are the red-flagged lap 1 (§2.7's Try-it box). Miami 2025's 446 are a real hole (Case Study 1). The response: exclude lap 1 from pace work (which the clean-lap rule already does), and treat a race with hundreds of missing laps as a special case.

Structural, fixed by the build. Stint starts moved by the build: 396 stints in three races per season, always the same circuits (Albert Park, Monaco, Montreal). Pit rows borrowed from Jolpica: 219 rows, all in the first six races of 2023. These are known, documented and repaired; the scorecard confirms that the repair is confined to where it should be.

Season-specific. The 0.0 °C track-temperature readings appear only in 2026 (10 readings in 7 races). They are rare, but a model that uses track temperature as an input will read each one as the coldest race ever run. A minimum-of-the-session statistic is exactly the kind of number they corrupt: the Las Vegas 2026 race's minimum track temperature is 0.0 °C raw and 13.1 °C once zeros are treated as missing.

A bug in our own pipeline. The raw Jolpica CSV holds 174 sprint stops across 15 sprint weekends. An early version of the book's build dropped the session tag and mixed every one of them into the race pit table; this check found them, the build was fixed, and the check now reads zero in every race. It is the one check in the list that reflects how the book's processed table was built rather than a property of the sources. Including it in the scorecard is the point. An audit that only checks the upstream data assumes your own code is correct, and a check that reads zero is how you know a fixed bug stays fixed.

Which races are the "messiest"?

The share of clean laps summarises how much of a race is usable for pace work:

clean-lap share per race: median 0.841, min 0.530 (2025 British Grand Prix), max 0.949 (2024 Dutch Grand Prix)

lowest clean-lap shares:
 year                             gp  clean_share  red_flags  wet_stints
 2025             British Grand Prix     0.529625          0          32
 2026 Bahrain Grand Prix in Malaysia     0.560699          0          11
 2025          Australian Grand Prix     0.581446          0          55
 2024            Canadian Grand Prix     0.649371          0          39
 2024           São Paulo Grand Prix     0.675462          1          53
 2023           Las Vegas Grand Prix     0.680761          0           0

Four of the six lowest have wet-tyre stints: rain removes laps through flags, pit stops and changing pace. The 2023 Las Vegas GP is the exception, with no wet stints and no red flag in the race, so its low share must come from other causes, such as safety cars or yellow flags (discussion question 5). The low-share list is a reading list. Before you use any of these six races in a model, look at its lap-classification chart (Figure 2.5 in the chapter shows how).

The races with the most deletions are a different list again:

most deleted laps in a race:
 2023      Austrian Grand Prix            53
 2023         Qatar Grand Prix            50
 2025     Abu Dhabi Grand Prix            40
 2024 United States Grand Prix            39
 2025       Bahrain Grand Prix            36

What it means (and doesn't)

What it means. The archive is in good shape and full of traps, and the scorecard tells you which traps apply to which races. Six of the nine checks touch fewer than one race in five; one check (deletions) touches nearly every race; and two (borrowed pit rows, zero temperatures) belong to a single season. A multi-season study that ignores the season-specific problems will find "trends" that are really changes in the data.

The scorecard also turns a vague worry ("is the data clean?") into numbers a strategist can act on. For example: "pit loss at Albert Park, Monaco and Montreal depends on the boundary fix; verify it", or "any 2026 track-temperature model must drop zeros".

What it doesn't mean. A race with many flags is not a "bad" race; it is a race with fewer clean laps. The checks count conditions, not errors, except the two that really are errors (the Miami hole and the sprint-stop mixing, now fixed). Nor does a clean scorecard prove a race is error-free: the frozen-telemetry problem from §2.8 isn't in this scorecard at all, because race telemetry hadn't finished downloading when the snapshot was taken. Every audit covers the checks you thought of.

From scorecard to rules

Here is how Aisha turned the table into the rules she proposes for Box Box before any multi-race model. Each rule names the check and the action.

Check Proposed rule Races affected in the snapshot
more than 10 % of Jolpica's laps missing from OpenF1 block: rebuild the race from Jolpica (Case Study 1) or drop it 1 (2025 Miami)
sprint stops in the race pit table block pit work until stops are filtered by session tag or lap signature 0 (174 stops at 15 weekends before the fix)
stint start moved by the build warn: pit loss and tyre age rely on the repair 12
wet-tyre stints filter wet laps out of dry-tyre models 11
0.0 °C track temperature filter: treat as missing 7
deleted laps option: exclude for qualifying-style questions only 89

Only two of the nine rules block an analysis; the rest change what you filter or what you say. That is the usual shape of a mature pipeline: very few hard stops, many documented choices.

Discussion questions

  1. Which three checks would you make blocking (the analysis refuses to run) and which warnings? Defend the split with a specific downstream model for each.
  2. Untimed lap 1s are much more common in 2023–2024 (30 races) than in 2025–2026 (16). Name two possible explanations, and say what evidence in the data could distinguish them.
  3. The deleted-lap count per race is highest at the 2023 Austrian GP (53). Does that tell you drivers broke track limits more there? What else could produce a high count?
  4. Why is it important that the scorecard includes a check on the book's own processed table, not just on the upstream sources?
  5. The 2023 Las Vegas GP has a low clean-lap share with no rain and no red flag. Which RaceData attributes would you inspect first to explain it?

Your turn

Add two checks to code/case_study_02.py and rerun it:

  1. Frozen telemetry, for qualifying sessions with car data on disk: the share of drivers whose fastest lap has a frozen run longer than 2 s (use boxbox.data.longest_frozen_run_s). Report it by circuit.
  2. Fastest lap ≠ pole: for each qualifying session, whether the fastest timed lap in the laps table equals the P1 time in the results table.

Then write a one-paragraph "data notes" entry for the 2026 season that a teammate could read before starting any 2026 analysis.