← All projects
Data & Business Intelligenceexpert · ~210 min

One Number, One Definition — a Metric Contract Layer That Can Prove Every Figure You Publish

Every dashboard project teaches you to draw the number. None of them teach you to defend it. So the predictable thing happens: finance says June revenue was one figure, sales says it was another, both queries are correct, and four hours disappear into a spreadsheet argument that ends in a compromise nobody can reproduce next month. The real failure is not a bad chart or dirty data — it is that the definition of the metric lives in people's heads and in ad-hoc SQL, so it drifts silently and no one can say what last quarter's number even meant. This project builds the missing layer: metric definitions as reviewable files, a compiler that turns them into safe SQL, contract tests that make a definition change impossible to do quietly, an append-only ledger that can reconstruct any published figure months later, and a drift check that tells you whether this month's difference came from new data, a changed definition, or something nobody can explain — which is the only one of the three that should stop a publication.

🤝 Want this built for you? Start a request — our AI scopes it, estimates a price range, and matches you with a vetted AI Advisor.
Share this:
One Number, One Definition — a Metric Contract Layer That Can Prove Every Figure You Publish
Unlock this walkthrough

Two ways to open it

Just this build
$10 one-time

Unlocks this full walkthrough on your account — no subscription, and no account needed until you check out.

Best value Over 160 projects + the full course
$99 / year

Over 160 project walkthroughs, the 6-week course, and your certificate.

🔒 Secure checkout by Stripe · Already a member? Sign in

What you'll do

A metric contract layer you own end to end: business metrics defined in reviewable TOML files that state the owner, the unit, the date that starts the clock, and a plain-English sentence anyone in the company can read; a compiler that turns each definition into parameterised SQL with every table and column checked against the live schema, so a definition can never smuggle SQL through a column name; a query path locked down twice over by a read-only connection and a SQLite authorizer that denies everything but SELECT; ingestion guards that refuse unpadded dates and refuse to sum a money column where SQLite would silently read '1,500' as 1; contract tests that run against a frozen fixture warehouse so real new data never breaks them but a changed definition always does; a prose-drift gate that refuses to record a new expected value when the math changed and the plain-English sentence did not; an append-only JSONL ledger plus an explain command that reconstructs any published figure from its definition version, source-file fingerprints, and row count; a drift check that classifies every difference as MATCH, DEFINITION-CHANGE, LATE-DATA, or UNEXPLAINED with distinct exit codes; a close command that freezes a published month and a restatement path that requires a written reason; and four drills you have actually run — a late refund, an intentional definition change, a hand-edited warehouse, and a definition that tries to escape the compiler.