Siddhesh Patil · Data Reliability
Case study · portfolio project on realistic synthetic data

Finding $32,337 the dashboard said wasn't missing

A dbt pipeline that reconciles every storefront order against every processor payment, classifies each gap, and turns 57 automated checks into a one-page report that finance can act on.

3.11%
of $1.04M gross revenue unreconciled
171
order-level exceptions, each with a cause and a dollar impact
12 / 12
planted defect types caught, measured against a ground-truth table

Honesty note: this is a portfolio project, not a client engagement. The data is synthetic but modelled on real e-commerce failure modes: webhook replays, partial captures, currency mix-ups, double charges, over-refunds and gaps in the FX feed. Every planted defect is recorded, so detection is measured, not claimed. The code is public and runs in about two minutes.

The situation

A multi-currency online store sells in USD, EUR, GBP, AUD and SGD. Orders come from the storefront, cash comes from the payment processor, and finance reports from the warehouse. The three numbers rarely match. The gap is small enough to ignore any one month, but large enough to matter by year-end audit.

What was broken

ExceptionRecordsImpact (USD)
Captured amount ≠ order total52$12,209
Completed order, no payment captured53$11,052
Customer charged twice22$5,739
Charged in the wrong currency27$3,041
Payment with no matching order3$297
Refund larger than payment14flagged separately

The pipeline also caught 32 duplicate order rows from webhook replays, 22 future-dated and 22 negative orders, 31 orders converted with a stale FX rate, and 32 missing or invalid customer emails.

Approach

  1. Warn at the source, error at the mart. Upstream defects are reported without stopping the pipeline. Tables that BI reads are tested strictly, so bad data never reaches a dashboard.
  2. Exclude, don't fix. Corrupt records are removed from the BI fact table and listed in an issue queue for operations, instead of being quietly "corrected".
  3. Contract-enforced BI table. A dbt model contract fixes column types and the primary key, so an upstream schema change fails the build instead of breaking dashboards.
  4. Gap-tolerant currency conversion. An ASOF join uses the latest available FX rate and flags any order that relied on a stale one.
  5. A business SLA as a test. A warning fires when unreconciled revenue goes above 0.5% of gross. Finance chooses the threshold, not engineering.
  6. Unit-tested logic. A dbt unit test pins how all 8 exception types are classified and in what order of precedence.
  7. CI on every change. GitHub Actions runs source freshness, the full build and the report on every pull request.

The deliverable a stakeholder sees

Engineers get test output. Finance gets this one-page report: total exposure, where the money is leaking, the ten largest exceptions, and which checks need attention.

Applying it to your stack

The models are standard SQL. Moving to Snowflake or BigQuery means changing the dbt adapter and rewriting the FX lookup in about ten lines. Sources would typically be Shopify or WooCommerce plus Stripe or Adyen, loaded with Fivetran or Airbyte. A first version on real client data usually fits the Revenue Reconciliation Build.

Stack

dbt-core 1.11DuckDBPythonGitHub Actionsdbt unit testsmodel contractssource freshness