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

# int_driver_circuit_era_affinity

> One row per (driver_id, circuit_id, era_key).

<Note>Part of the [Skill](/transform/families/skill) family.</Note>

One row per (driver\_id, circuit\_id, era\_key). Same shrinkage as int\_driver\_circuit\_affinity but split on the 2022 ground-effect regulation boundary so a driver's track record is never blended across incomparable car eras (pre2022 = 2018–2021, post2022 = 2022–2024). circuit\_id is the physical-circuit identifier, so renamed events and double-headers at one venue pool into a single track record. Within an era the residual is car-removed, so ranking drivers by shrunk\_affinity\_s ≈ "equal-car track record" at that circuit. Shrunk toward the driver's within-era global mean (Bayesian, prior = 5 virtual races). Negative = faster than field. Backs the Ghost Car Standings feature.

## Lineage

```mermaid theme={null}
flowchart LR
  int_driver_race_skill_loro --> int_driver_circuit_era_affinity
  style int_driver_circuit_era_affinity fill:#e40404,stroke:#e40404,color:#fff
```

## Overview

| Property          | Value                                                        |
| ----------------- | ------------------------------------------------------------ |
| Layer             | `intermediate`                                               |
| Family            | [Skill](/transform/families/skill)                           |
| Contract enforced | No                                                           |
| Tags              | `driver_rating`, `driver_affinity`                           |
| Upstream          | [`int_driver_race_skill_loro`](./int_driver_race_skill_loro) |

**21 tests** [guard](/transform/ci/overview) this model  -  18 generic, 3 singular.

## Columns

| Column                      | Type | Nullable | Tests                                                                                                          | Description                                                                                                                        |
| --------------------------- | ---- | -------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `driver_circuit_era_id`     |      | Yes      | [`not_null`](/transform/ci/structural), [`unique`](/transform/ci/structural)                                   | Surrogate PK = hash(driver\_id, circuit\_id, era\_key)                                                                             |
| `driver_id`                 |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Driver identifier                                                                                                                  |
| `circuit_id`                |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Physical-circuit identifier (slug of circuit\_name). Collapses event-slug aliases (renamed events, double-headers) onto one venue. |
| `circuit_name`              |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Canonical circuit display name for this circuit\_id.                                                                               |
| `era_key`                   |      | Yes      | [`not_null`](/transform/ci/structural), [`accepted_values`](/transform/ci/range-and-domain)                    | Regulation era. pre2022 = 2018–2021, post2022 = 2022–2024.                                                                         |
| `era_label`                 |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Human-readable era span ('2018–2021' / '2022–2024').                                                                               |
| `n_obs`                     |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Number of race-residual observations backing this estimate within the era                                                          |
| `seasons_observed_n`        |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Count of distinct seasons the driver raced at this circuit within the era                                                          |
| `raw_affinity_s`            |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Unshrunk observed mean residual at this circuit-era. Negative = faster.                                                            |
| `shrunk_affinity_s`         |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Bayesian posterior mean. Pulled toward the driver's within-era global mean.                                                        |
| `shrunk_affinity_se_s`      |      | Yes      | [`not_null`](/transform/ci/structural), [`expect_column_values_to_be_between`](/transform/ci/range-and-domain) | Posterior standard error in seconds. Non-negative.                                                                                 |
| `shrunk_affinity_ci_low_s`  |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Lower bound of 95% credible interval                                                                                               |
| `shrunk_affinity_ci_high_s` |      | Yes      | [`not_null`](/transform/ci/structural)                                                                         | Upper bound of 95% credible interval                                                                                               |
| `affinity_confidence`       |      | Yes      | [`not_null`](/transform/ci/structural), [`expect_column_values_to_be_between`](/transform/ci/range-and-domain) | Data fraction of posterior mass. n\_obs / (n\_obs + 5). \[0, 1].                                                                   |
