Data Quality Recovery System
Bell Canada
The investigation and repair work that found why historical data was missing and wrong, then recovered 28K+ silently dropped records and stopped it from happening again.
Reports only went back a month and quietly disagreed with the source systems, so nobody fully trusted the analytics.
- 01The 30-day blind spot
- Broke
- An external validator flagged ~28,000 mismatched records, and history only reached back about a month when it should have covered years.
- Why
- A staging load had a hardcoded 30-day lookback filter, silently trimming everything older than a month on every run.
- Fix
- Traced it to that one filter, then ran a full historical recast from January 2025 through an isolated off-hours flow so it would not crush the daily job. Usable history went from 1 month to 9+ months and the 28K+ dropped records came back.
- 023.5 million phantom rows
- Broke
- Joining events to the employee-hierarchy table multiplied rows, about 3.5 million duplicates, inflating every count built on top of it.
- Why
- The join flattened history with a MAX() subquery and keyed on a volatile mix of email and agent ID, so one event matched many hierarchy versions.
- Fix
- Switched to SCD Type 2 point-in-time joins (match the event to the hierarchy that was true on its date) with a stable composite key. The duplicates disappeared.
28K+records recovered
9+months of usable history
- Internal REST API
- Maximo (ERP)
- Billing orders
- LDAP (Directory)
- Ingest / Raw Landing
- Validate / Rules & Schemas
- Transforms / Standardize & Conform
- Canonical Trusted Dataset
| Metric | Before | After |
|---|---|---|
| Records recovered | — | 28K+ |
| Usable history | 1 month | 9+ months |
| Duplicate hierarchy rows | 3.5M | removed |
Net improvement: usable history restored from 1 to 9+ months
| Check | Before | After | Status |
|---|---|---|---|
| Historical attribution (SCD Type 2) | drifted | resolved | ✓ |
| Freshness & volume alerts | — | P10/P90 bands | ✓ |
- 01
# Incident: rows multiplying on load - 02
# Runbook: dedup_recovery (generalized) - 03
- 04
1. Confirm the duplication - 05
- Count distinct vs total per key - 06
- Sample the shape of the dupes - 07
2. Find where it enters - 08
- Trace lineage to the load step - 09
- Diagnose the load-key mismatch - 10
3. Re-key the load - 11
- Upsert key vs primary index - 12
- Make the write idempotent - 13
4. Prove it before release - 14
- Idempotency: run it twice - 15
- Reconcile counts end to end - 16
5. Stage the cutover - 17
- Rehearse a reversible plan - 18
- Monitor after go-live
Impact: Resolved a data quality incident across historical pipelines. Downstream metrics restored and validated.