Analytics engineering / margin decisions
Margin Control Tower
When weekly contribution margin changes, this browser tool starts from a hash-verified Olist aggregate, traces discounts, returns, cost of goods, and fulfillment, then tests a bounded promotion scenario before recording an action.
- Problem
- A revenue-only view hides the margin lost to discounts, returns, cost of goods, and fulfillment, and gives a category manager no way to test a response.
- Audience
- E-commerce category managers and analytics engineers who need to test a margin decision, not just chart it.
- What I built
- I built the six-table Olist pipeline, source locks, data contracts, metric definitions, diagnosis and scenario engine, holdout check, browser UI, governed fixture, and tests.
- Result
- The default path verifies the committed Olist artifact before rendering, exposes measured detection and elasticity reports, recomputes a bounded scenario, and records a category action for review.
How it works
- 01Acquire
Lock six licensed Olist source tables by URL, retrieval date, size, and hash.
- 02Reconcile
Join orders, items, customers, products, payments, and reviews at a declared weekly grain.
- 03Contract
Stop if source hashes, schema, grain, accounting math, or browser artifact drift.
- 04Diagnose
Decompose contribution-margin drivers and load artifact-bound detection and elasticity reports.
- 05Test
Apply disclosed scenario assumptions, inspect the later holdout, and record an action.
Try it
The committed Olist artifact is requested first. If its Parquet or hash-bound reports fail validation, the lab keeps the fixed-seed synthetic fallback active and shows the blocked state.
Loading the requested margin source...
Methods / Results / Real-data analysis
Loading the pipeline-backed methods report…
How this was verified
- The default source is real: a compact 748-cell preview is generated from the exact Olist Parquet, bound to its SHA-256, and re-verified in the browser without downloading DuckDB or the complete artifact. An explicit complete-data action downloads and verifies olist-margin.parquet, then queries all 15,809 rows through DuckDB-WASM; failure preserves the labeled real preview and blocks full mode.
- Real mode loads the committed Olist aggregate produced from 99,441 orders and 112,650 item rows under CC BY-NC-SA 4.0 (retrieved 2026-07-17); source-table hashes, transport commit, transforms, and proxy boundaries are embedded in the Parquet metadata.
- Measured fields use observed order items and freight after payment/review reconciliation; discounts, returns, and COGS remain explicitly documented proxies. The first observed week of each category falls back to current item price and therefore has zero proxy discount.
- The optional seed-2026071301 fixture contains 9,360 synthetic rows across 52 weeks and remains isolated as a reproducible fallback and test mode.
- The inherited Tableau/RFM dashboard is prior work only and is not evidence for this rebuild.
What this does not prove
- Synthetic currency and injected anomalies do not show real lift, detection accuracy, or causal impact.
- The scenario uses a disclosed elasticity assumption and is not a forecast.
- Olist detection and elasticity results appear only from committed detection-report.json and elasticity-report.json files; missing reports remain visibly pending and never render placeholder results.
- Detection precision and recall evaluate six deterministic perturbations on observed Mondays after the real totals are reindexed to a complete Monday calendar; 11 weeks with no derived cells are zero-filled. No manually labeled real anomaly is claimed, and neither calendar-completion rows nor perturbations enter the Parquet artifact.
- The associational elasticity coefficient is fit on the analysis window; the later eight-week holdout evaluates MAPE only. Reference price, return deductions, and 60% COGS are disclosed proxies; no causal lift, audited company margin, forecast, or production decision is claimed.