> ## 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.

# clean_lap_filter

> Reusable WHERE clause predicate for filtering to 'clean' laps suitable for driver skill extraction.

Reusable WHERE clause predicate for filtering to "clean" laps suitable for driver skill extraction. A "clean lap" is one where: 1. correction\_weight = 1.0 (no manual outlier downweighting) 2. anomaly\_class ∉ ('mistake', 'conditions') (excludes crashes, water runoff, etc.) 3. is\_rain\_lap = FALSE (excludes wet-compound laps in mixed-weather races) This macro is the canonical definition. Use it in every model that extracts or depends on driver skill signals to prevent silent divergence where one model accidentally includes rain laps while another filters them out. Used as: WHERE \{\{ clean\_lap\_filter() }} in a FROM clause.

## Signature

```sql theme={null}
{{ clean_lap_filter() }}
```

## Returns

boolean expression (no parentheses, compose with AND as needed).

## Notes

-correction\_weight: int\_lap\_anomaly\_flags
-anomaly\_class: int\_lap\_anomaly\_flags
-is\_rain\_lap: int\_lap\_anomaly\_flags or stg\_laps
