# Data quality and observability scorecard

See which trip tables lose trust when a data load breaks.
Reproduce a clean control, four isolated injected faults and their combined downstream impact.

This independent portfolio study is for analytics engineering and data-platform
reviewers. It uses the licensed Chicago mobility sample and frozen dbt contract from the semantic
layer evaluation project. Arrival timestamps, redundant audit metres, owner assignments and
example downstream consumers are synthetic assumptions. No employer data is used.

## View and reproduce

Open `index.html` directly in a browser. No server, credentials or API calls are required to view
the static scorecard. Each scenario links to every check, its dimension weight and the shared
lineage. The chart is also available in [assets/trust.svg](assets/trust.svg).

Reproduction prerequisites are Linux, Python 3.12 and uv. All Python dependencies are pinned in
`requirements.lock`, including dbt-core 1.12.5, dbt-duckdb 1.11.0 and DuckDB 1.5.6. Bootstrap needs
internet access. The small, licensed data sample is included in the pinned dependency archive.

```sh
uv venv --python python3.12 .venv
uv pip sync --python .venv/bin/python requirements.lock
make scorecard
```

After bootstrap, `make scorecard` runs all scenarios in order, renders the pages and checks the
regression suite without API credentials. `make test` runs the fast fixture and integrity tests
without claiming to reproduce the headline scenario run. Runtime databases, command logs and
raw dbt artifacts stay in new directories under `runtime/runs/`; earlier runs are preserved.
The full run can be slow on a Windows-mounted WSL drive because each dbt command starts separately.

## What is measured

The historical clock is February 1, 2024 at 06:00. Clean arrivals are simulated at 01:00 on the day
after each trip date. The late-partition fixture removes January 31. Null, duplicate and units
fixtures affect January 30, so the combined scenario retains all four defects.

The model lineage is `raw_trips` to `stg_trips` to `trips` to `daily_trips`. It is computed from
the actual dbt manifest. It shows dependency exposure, not measured usage, affected people or
financial loss. The score evaluates the trip feed using source and mart checks, then propagates
conservatively to its descendants. Zones and the time spine are outside that descendant set.

Trust uses a fixed denominator: freshness, completeness and uniqueness each carry 25%; validity
carries 15%; anomaly carries 10%. Every required check in a dimension must pass to earn its weight.
Critical failures cap trust at 40. Unavailable evidence caps it at 20. Duplicated passing results
cannot increase the score, and missing or skipped checks cannot improve it.

Freshness uses simulated load timestamps with a fixed clock. Completeness checks the target day's
fare-null rate. The anomaly detector uses only fourteen preceding clean days and requires a
complete baseline. Its median/MAD threshold is frozen in [DESIGN.md](DESIGN.md). The validity
dimension retains all fifteen inherited dbt tests as well as the new units invariant.
The inherited `historical_freshness` test retains its original minimum load-date cutoff of
January 31 at 00:00. It is an additional frozen contract constraint. The consumer's freshness
dimension uses the February 1 clock and the separate six-hour warning and twelve-hour failure thresholds.

## Limits

- Detection applies to four deliberately constructed faults, not general production recall.
- The audit metres field is synthetic and derived before injection. A real units check needs an
  independently trustworthy reference; two consistently corrupted fields can pass this invariant.
- Missing fares already exist in the public sample. Thresholds represent stated service assumptions,
  not a claim that every missing fare is an error.
- The sample is deterministic and contains 10,000 January 2024 records. It is not a probability
  sample for estimating citywide transport behaviour. Original trip identifiers and precise
  location traces are excluded from the frozen dependency.
- Model and test commands are separate so expected test failures do not prevent downstream tables
  from being built. Compilation and runtime errors abort the run and are never counted as detections.
- Overlapping anomaly windows are dependent. Their false-positive count is a control-fixture
  measurement, not an independent estimate of a deployment rate.
- This project is unaffiliated with the City of Chicago or dbt Labs.

See [NOTICE.txt](NOTICE.txt) for attribution and [data/dependency.json](data/dependency.json) for
the archive version, source artifact and cryptographic identity. The consumer verifies every
member before use and writes all extensions into its own runtime directories.

## Measured fixture results

| Scenario | Trust | Failed checks |
|---|---:|---:|
| clean | 100/100 | 0 |
| late_partition | 40/100 | 1 |
| null_spike | 40/100 | 2 |
| duplicate_load | 40/100 | 2 |
| unit_change | 40/100 | 1 |
| combined | 0/100 | 6 |

Detected 4 of 4 isolated injected faults. The clean control passed all 20 required checks. The anomaly detector flagged 0 of 17 eligible clean days.

These are fixture findings. They establish neither production recall nor business impact.
