01 / THE START
Three systems were good. One coherent system would be better.
DeTLeng originally had three separate repositories: a case-study website, a FastAPI/OpenAI backend, and BigQuery MCP analytics tools. Keeping these pieces aligned increased operational overhead.
WebsiteFastAPI + AIBigQuery MCP tools↓One unified DeTLeng codebase
- Integrated 100 approved analytics tools into the unified backend.
- Preserved the existing static website and AI Task cards.
- Verified local tests, GitHub CI and Render deployment before relying on the unified service.
Engineering decisionSimplify deployment boundaries without compromising the working product.
02 / THE NEW QUESTION
“Our AI answers look great. But who checks the numbers?”
All 100 Task cards could query BigQuery and produce conversational explanations. The project owner then changed the acceptance standard: a polished answer was not enough. Visitors should be able to reproduce its numerical evidence.
The task wasn't to make AI sound more confident. It was to make the evidence independently inspectable.
- Keep the original AI answer visible.
- Recalculate approved KPIs without another paid BigQuery or OpenAI request on the verification click.
- Show exact differences and data provenance—not automatic green badges.
Product decisionAdd a Verify with SQL control beneath eligible successful AI answers.
03 / THE ARCHITECTURE
Two calculation paths. One transparent comparison.
LIVE ANSWERTask card → FastAPI → approved BigQuery SQL → structured KPI → OpenAI explanation
INDEPENDENT CHECKVerify button → static CSV + SHA-256 → browser DuckDB-Wasm → approved SQL → JavaScript comparison
The browser does not run arbitrary visitor SQL. It fetches a fixed, allowlisted query and the required static snapshot tables. It can report MATCH, MISMATCH, PARTIAL or NOT VERIFIABLE based on the numerical evidence available.
Trust boundaryMatching numbers demonstrate reproducibility on the snapshot. They do not independently certify the source data or every statement in the AI prose.
04 / THE FIRST WORKING BUILD
Start small. Validate the mathematics. Then ship a pilot.
The processed cs003_olist_analytics layer was exported to a private D: drive. Four compact, column-reduced CSV files powered the initial five-KPI browser pilot.
- Total Revenue, Total Orders and Total Products.
- Average Order Value and On-Time Delivery Rate.
- Snapshot checksum validation, SQL provenance, popup interaction and regression tests.
First live result15,843,553.24BigQuery-backed revenue = independent browser SQL revenue · difference 0.00
SELECT ROUND(SUM(total_sale_value), 2) AS total_revenue
FROM fact_sales;
Illustrative unqualified SQL equivalent of the verified revenue calculation; the browser engine runs its approved query file against the snapshot.
Data governanceKeep credentials private. Public snapshots require column review, pseudonymization, source attribution and redistribution checks; pseudonymized data is not necessarily anonymous.
05 / EXPANSION TO 100
Move from a successful demo to a mapped verification platform.
The architecture expanded to 100 approved SQL mappings and a nine-table full-v2 static snapshot. The backend supplied structured evidence for scalar KPIs and multirow reports while protecting private identifiers.
backend/analytics/tools/*.pybackend/proofsql_metadata.pyproofsql/queries/full-v2/proofsql/engine/
- Run Python and JavaScript regression tests.
- Check the 100 SQL definitions and snapshot manifest.
- Deploy the static site through GitHub Pages and the backend through Render separately.
- Preserve accurate outcomes; 100 mappings never meant 100 automatic MATCH results.
What changed?The pilot's single-object verification.metrics expanded to allow verification.records for table-shaped results.
06 / THE UNEXPECTED BUG & PATCH
The queries were ready. The buttons were not.
Before an employer demo, the project owner tested beyond the early pilot and found many answers without a Verify button. The missing-button cause was not a missing SQL mapping: the frontend only accepted the old metrics field, while expanded responses could contain only records.
BEFORE · Pilot-only gate
if (evidence && evidence.tool && evidence.metrics &&
(!tool || evidence.tool === tool)) {
AFTER · Compatible evidence gate
if (evidence && evidence.tool &&
(evidence.metrics || Array.isArray(evidence.records)) &&
(!tool || evidence.tool === tool)) {
One targeted edit to chat-widget.js was tested locally, reviewed in a Git diff, committed and retested in production. The backend, snapshots and successful five-KPI pilot did not need to be rebuilt.
Engineering lessonA green test suite cannot replace checking the entire user journey: Task → answer → button → SQL → comparison.
07 / THE EVIDENCE & OWNERSHIP
What was observed. What was not claimed.
| Live check | Observed outcome |
| Original Revenue Pilot | MATCH · 15,843,553.24 on both paths |
| Task #92 · Month Over Month Growth | SQL NUMBERS MATCH — 24 live rows, 24 browser rows, 120 numeric comparisons; SHA-256 verified |
| Task #96 · Yearly Revenue | MATCH · six numeric comparisons |
| Task #100 · Top Products | MATCH · ten numeric comparisons |
Human project lead: defined goals, directed architecture, managed exports and deployments, demanded independent verification, tested production and discovered the pre-presentation defect.
AI engineering assistant: supported architecture, code, mappings, tests, debugging and documentation. The project owner's decisions and hands-on verification drove acceptance.
Honest project statusThe full-range verification architecture is working on observed later tasks. This is not a claim that all 100 tasks were individually tested and matched. A complete outcome matrix and performance review remain valuable follow-up work.