> ## Documentation Index
> Fetch the complete documentation index at: https://offthepace.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# stg_laps

> Cleaned lap-level data from FastF1 race sessions.

<Note>Part of the [Staging](/transform/families/staging) family.</Note>

Cleaned lap-level data from FastF1 race sessions. One row per driver × lap. Renames Bronze columns to snake\_case, casts nanosecond timings to seconds, and derives the validity / track-status flags consumed across the warehouse. is\_valid\_lap = TRUE excludes pit laps, deleted laps, SC/VSC laps, and lap 1.

## Lineage

```mermaid theme={null}
flowchart LR
  stg_laps --> dim_constructors
  stg_laps --> dim_corners
  stg_laps --> dim_drivers
  stg_laps --> fct_ghost_car_pace
  stg_laps --> fct_ghost_race_finish
  stg_laps --> fct_stint_features
  stg_laps --> fct_telemetry_deltas
  stg_laps --> int_constructor_structural_pace
  stg_laps --> int_corner_skill_residuals
  stg_laps --> int_driver_race_skill_loro
  stg_laps --> int_event_corrections
  stg_laps --> int_lap_fuel_state
  stg_laps --> int_lap_normalized_pace
  stg_laps --> int_lap_residual_decomposed
  stg_laps --> int_lap_thermal_proxy
  stg_laps --> int_pit_loss_circuit
  stg_laps --> int_sc_hazard_history
  stg_laps --> int_sector_residual_decomposed
  stg_laps --> int_stint_geometry
  stg_laps --> int_synthetic_teammate
  stg_laps --> mart_corner_skill_driver
  stg_laps --> stg_sector_times
  stg_laps --> stg_weather
  style stg_laps fill:#e40404,stroke:#e40404,color:#fff
```

## Overview

| Property          | Value                                  |
| ----------------- | -------------------------------------- |
| Layer             | `staging`                              |
| Family            | [Staging](/transform/families/staging) |
| Contract enforced | No                                     |

**15 tests** [guard](/transform/ci/overview) this model  -  10 generic, 5 singular.

## Columns

| Column                   | Type      | Nullable | Tests                                                                        | Description                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------ | --------- | -------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `lap_id`                 | `varchar` | Yes      | [`not_null`](/transform/ci/structural), [`unique`](/transform/ci/structural) | Surrogate key   \{season}*\{race\_id}*\{driver}\_\{lap\_number}.                                                                                                                                                                                                                                                                                                            |
| `race_year`              | `integer` | Yes      | [`not_null`](/transform/ci/structural)                                       | Season year.                                                                                                                                                                                                                                                                                                                                                                |
| `circuit_key`            | `varchar` | Yes      |                                                                              | Event/grand-prix key (equals race\_id); used to group laps by circuit.                                                                                                                                                                                                                                                                                                      |
| `race_id`                | `varchar` | Yes      | [`not_null`](/transform/ci/structural)                                       | Numeric FastF1 event id cast to string (e.g. '4'); the join key used across staging, not the human-readable slug.                                                                                                                                                                                                                                                           |
| `driver_id`              | `varchar` | Yes      | [`not_null`](/transform/ci/structural)                                       | FastF1 three-letter driver code (e.g. VER, HAM).                                                                                                                                                                                                                                                                                                                            |
| `driver_number`          | `varchar` | Yes      |                                                                              | Car number the driver carried in this session.                                                                                                                                                                                                                                                                                                                              |
| `constructor_id`         | `varchar` | Yes      |                                                                              | Team name as reported by FastF1 (e.g. 'Mercedes').                                                                                                                                                                                                                                                                                                                          |
| `lap_number`             | `integer` | Yes      | [`not_null`](/transform/ci/structural)                                       | Lap index within the race (1-based).                                                                                                                                                                                                                                                                                                                                        |
| `stint_number`           | `integer` | Yes      |                                                                              | Stint index within the race (1-based); increments after each pit stop.                                                                                                                                                                                                                                                                                                      |
| `tyre_life`              | `integer` | Yes      |                                                                              | Laps already completed on the current tyre set at the start of this lap.                                                                                                                                                                                                                                                                                                    |
| `is_fresh_tyre`          | `boolean` | Yes      |                                                                              | TRUE when the lap began on a freshly fitted tyre set.                                                                                                                                                                                                                                                                                                                       |
| `is_personal_best`       | `boolean` | Yes      |                                                                              | FastF1 flag   the lap was the driver's personal best at the time it was set.                                                                                                                                                                                                                                                                                                |
| `position`               | `integer` | Yes      |                                                                              | Track position (classification order) at the end of the lap.                                                                                                                                                                                                                                                                                                                |
| `lap_time_s`             | `double`  | Yes      |                                                                              | Lap time in seconds (Bronze nanoseconds ÷ 1e9); NULL when not timed.                                                                                                                                                                                                                                                                                                        |
| `lap_start_time_s`       | `double`  | Yes      |                                                                              | Session clock (s) at the start of the lap; used to join weather and air state.                                                                                                                                                                                                                                                                                              |
| `sector1_time_s`         | `double`  | Yes      |                                                                              | Sector 1 time in seconds; NULL when missing.                                                                                                                                                                                                                                                                                                                                |
| `sector2_time_s`         | `double`  | Yes      |                                                                              | Sector 2 time in seconds; NULL when missing.                                                                                                                                                                                                                                                                                                                                |
| `sector3_time_s`         | `double`  | Yes      |                                                                              | Sector 3 time in seconds; NULL when missing.                                                                                                                                                                                                                                                                                                                                |
| `sector1_session_time_s` | `double`  | Yes      |                                                                              | Session clock (s) at the sector 1 split.                                                                                                                                                                                                                                                                                                                                    |
| `sector2_session_time_s` | `double`  | Yes      |                                                                              | Session clock (s) at the sector 2 split.                                                                                                                                                                                                                                                                                                                                    |
| `sector3_session_time_s` | `double`  | Yes      |                                                                              | Session clock (s) at the sector 3 split.                                                                                                                                                                                                                                                                                                                                    |
| `speed_i1_kph`           | `double`  | Yes      |                                                                              | Speed-trap reading at intermediate point 1 (kph).                                                                                                                                                                                                                                                                                                                           |
| `speed_i2_kph`           | `double`  | Yes      |                                                                              | Speed-trap reading at intermediate point 2 / sector 2 exit (kph).                                                                                                                                                                                                                                                                                                           |
| `speed_fl_kph`           | `double`  | Yes      |                                                                              | Speed-trap reading at the finish line (kph).                                                                                                                                                                                                                                                                                                                                |
| `speed_st_kph`           | `double`  | Yes      |                                                                              | Speed-trap reading on the longest straight (kph).                                                                                                                                                                                                                                                                                                                           |
| `track_status`           | `varchar` | Yes      |                                                                              | Raw FastF1 TrackStatus string for the lap (concatenated digit codes, e.g. '41' = SC+yellow).                                                                                                                                                                                                                                                                                |
| `is_pit_lap`             | `boolean` | Yes      |                                                                              | TRUE when the lap has a pit-in or pit-out time (an in/out lap).                                                                                                                                                                                                                                                                                                             |
| `is_deleted`             | `boolean` | Yes      |                                                                              | TRUE when stewards deleted the lap time (e.g. track-limits breach).                                                                                                                                                                                                                                                                                                         |
| `is_accurate`            | `boolean` | Yes      |                                                                              | FastF1 quality flag   timing considered reliable.                                                                                                                                                                                                                                                                                                                           |
| `is_fastf1_generated`    | `boolean` | Yes      |                                                                              | TRUE when the row was synthesised by FastF1 rather than read from raw timing.                                                                                                                                                                                                                                                                                               |
| `compound`               | `varchar` | Yes      | [`accepted_values`](/transform/ci/range-and-domain)                          | Normalised tyre compound label (UPPER). None/nan/UNKNOWN mapped to NULL. Pre-2019 compounds (SUPERSOFT/ULTRASOFT/HYPERSOFT) preserved as-is.                                                                                                                                                                                                                                |
| `is_safety_car_lap`      | `boolean` | Yes      | [`not_null`](/transform/ci/structural)                                       | TRUE when TrackStatus contains a 4 (SCDeployed). Full safety car only   VSC is is\_vsc\_lap and a red flag is is\_red\_flag\_lap. Decode matches stg\_track\_status, ground-truthed against the bronze Message column.                                                                                                                                                      |
| `is_vsc_lap`             | `boolean` | Yes      | [`not_null`](/transform/ci/structural)                                       | TRUE when TrackStatus contains a 6 (VSCDeployed) or 7 (VSCEnding). Decode matches stg\_track\_status.                                                                                                                                                                                                                                                                       |
| `is_red_flag_lap`        | `boolean` | Yes      | [`not_null`](/transform/ci/structural)                                       | TRUE when TrackStatus contains a 5 (Red). A red flag is a full session stoppage   physically the opposite of a VSC lap (tyres go to ambient, and may legally be changed), so it is flagged separately rather than folded into either neutralisation flag. The three flags together are the neutralised set the layer excludes; consumers should test all three, not a pair. |
| `is_valid_lap`           | `boolean` | Yes      |                                                                              | Clean-lap flag: timed (lap\_time\_s > 0), not a pit lap, not deleted, accurate, lap\_number > 1, and no SC/VSC/red flag (TrackStatus contains no 4–7).                                                                                                                                                                                                                      |
