


HEXA VPN's dashboards reported a healthy connection success rate — but that headline counted every session that merely reported success. In reality, many of those weren't genuine wins: connections that dropped within seconds ("flaps"), sessions instantly replaced by an app bug, automated/bot traffic, corrupt records, and users who connected once and never returned. Leadership was making decisions on a number that overstated true product health. The company needed a way to measure the real success rate — and to know exactly why it differed.
I designed an automated, read-only data-quality framework in SQL that scores the telemetry and reclassifies "fake" successes to failures — without ever deleting an event. It runs as three tiers of checks:
| Tier | Question it answers | Examples |
|---|---|---|
| Row-level (#1–#15) | Is each record clean, valid, and plausible? | timestamp validity, plausible session length, valid server IP, self-replace-bug, plus the data-integrity checks below |
| Behavioural (B1–B10) | Is each account behaving like a real user? | inactivity churn, bot/burst detection, one-and-done, country-hopping |
| Journey (T1–T3) | Did the user get (and keep) a good session? | flap (<30s), activation, next-day return, churn-risk |
The row-level tier runs fifteen checks (#1–#15) in one modular pass — from basic record hygiene (valid timestamps, plausible durations, well-formed server IPs, the self-replace-bug guard) through to data-integrity and degraded-experience signals:
On top of the checks sits a before/after impact model: it computes the success rate as reported vs. the true rate after reclassification, splits the affected users into one-and-done vs. retained, and attributes the drop to individual checks. Attribution runs in priority order, so each check is credited only with the unique records it catches and the pieces always sum to the total.
The framework is a showcase of production-grade SQL:
LAG()/LEAD() OVER (PARTITION BY … ORDER BY …) to detect telemetry gaps and the self-replace bug (a session replaced, then the same account reconnecting within 60 seconds).FILTER aggregates to compute before/after success in a single pass.CASE tiering for per-check status (OK / FLAGGED / ALERT) and tier-aware thresholds.Everything is SELECT-only and version-scoped, so it is safe to run against a live database.
The framework surfaced a large gap between the reported and the true success rate (illustrative: ~92% reported → ~68% true) — and, just as importantly, explained it:
FILTER aggregates · CASE · subqueries) · data-quality engineering · data validation / self-checks · behavioural & churn analysis · analytical storytelling · stakeholder reporting.