dtc-cash-onboarding

Every brand sends different files. This tool maps a brand's Shopify, Amazon, Faire, bank, card and chart-of-accounts exports into one cash ledger, and accepts the result only when independent records of the same money agree. What it cannot prove, it sends to a person instead of guessing.

Built by Avinash Rayudu. 13 synthetic brands: 7 to train, 3 to develop against, 3 written after the code was frozen.

Development brands, first upload
97.1% auto-labeled
at 100.0% precision; 18 of 630 lines sent to review instead of guessed
Second upload, same brands
1.3 items per brand
down from 7.0; memory recognized 22 of 22 files and caught 58 of 58 overlapping rows
Holdout, blind run
46.9% auto-labeled
1 file accepted under the wrong type; 2 of 3 brands accepted with bank data that never tied out. That is the gate hole the holdout found.
Injected mapping errors
0 of 51 accepted
wrong totals, swapped dates and missing exports; each one was blocked or held for review

How it works

1. ReadCSV, TSV, semicolon, xlsx; finds the real header under summary lines
2. Recognize and mapsource type and columns from header and value evidence; memory first
3. Standard tablessigns, dates, decimal commas, line-item totals, duplicates across uploads
4. Tie-outs (the gate)payouts, settlements, card payments and balances must agree with the bank
5. Label each lineby proof (tie-out), then memory, then the model; abstains below threshold
6. Decideaccepted, open review items, or blocked with the failing check named

The model never decides alone. A deposit that equals a Shopify payout to the cent within three days is labeled by proof. The model (2606 training lines, logistic regression on character and word n-grams) only labels what is left, and only above a threshold chosen for 99% precision on brands it did not train on.

Results, first pass before any review

brandsuploadlinesauto-labeledprecisionwrongto reviewfiles autoreview items per brandaccepted after review
Development brands (never trained on)upload_163097.1%100.0%01822/227.03/3
Development brands (never trained on)upload_255799.3%100.0%0422/221.33/3
Holdout brands (after fixes)upload_161895.2%99.7%23022/2215.73/3
Holdout brands (after fixes)upload_257897.9%99.8%11222/224.33/3
Training brands (in-sample)upload_11367100.0%100.0%0053/530.07/7
Training brands (in-sample)upload_21239100.0%100.0%0053/530.07/7

Training brands are in-sample, shown only for completeness. Precision is measured on lines the pipeline labeled itself; lines it sent to review are counted as not labeled.

What the holdout found

The holdout brands were written after the code and model were frozen (hashes in evals/FREEZE.json). Their blind results are kept unchanged in evals/results/holdout_v1_frozen/. They exposed four real problems:

The fixes were made after seeing the holdout, so the second set of numbers is not a blind test.

runuploadauto-labeledprecisionfiles accepted under wrong typeaccepted after reviewaccepted but wrongreceipts error (max)
blind, frozen codeupload_146.9%84.5%12/32100.0%
blind, frozen codeupload_256.6%97.5%12/32100.0%
after fixes, not blindupload_195.2%99.7%03/300.0%
after fixes, not blindupload_297.9%99.8%03/300.0%

Fault injection

Deliberate mistakes, applied to the first upload after its review (when the clean files pass). The question is whether the gate notices.

faultsplitrunsblockedheld for reviewrepaired automaticallysilently accepted
order subtotal mapped as the order totaldev22000
order subtotal mapped as the order totalholdout22000
order subtotal mapped as the order totaltrain55000
bank dates read day-first instead of month-firstdev11000
bank dates read day-first instead of month-firstholdout11000
bank dates read day-first instead of month-firsttrain66000
Shopify payouts export missingdev33000
Shopify payouts export missingholdout33000
Shopify payouts export missingtrain77000
Amazon settlement export missingdev22000
Amazon settlement export missingholdout21100
Amazon settlement export missingtrain55000
bank amounts exported with outflows positivedev30030
bank amounts exported with outflows positiveholdout30030
bank amounts exported with outflows positivetrain70070
Faire export missingdev22000
Faire export missingholdout21100
Faire export missingtrain44000
order totals summed across line-item rowsdev11000
order totals summed across line-item rowsholdout11000
order totals summed across line-item rowstrain22000

Brands

brandsplituploadfirst passreview itemsauto-labeledprecisionafter reviewreceipts errornaive sum overstates by
Hollis Homedevupload_1ties out, items open896.8%100.0%accepted0.0%30.7%
Hollis Homedevupload_2accepted0100.0%100.0%accepted0.0%63.9%
Quillon Coffee Roastersdevupload_1blocked1095.6%100.0%accepted0.0%7.5%
Quillon Coffee Roastersdevupload_2accepted0100.0%100.0%accepted0.0%45.0%
Saltmarsh Appareldevupload_1ties out, items open399.1%100.0%accepted0.0%5.6%
Saltmarsh Appareldevupload_2ties out, items open497.8%100.0%accepted0.0%59.8%
Copper Kettle Kitchenholdoutupload_1blocked1593.5%100.0%accepted0.0%0.1%
Copper Kettle Kitchenholdoutupload_2ties out, items open796.5%100.0%accepted0.0%55.6%
Lumen & Oakholdoutupload_1ties out, items open1993.2%99.0%accepted0.0%0.3%
Lumen & Oakholdoutupload_2ties out, items open299.0%99.5%accepted0.0%45.5%
Northwind Ceramicsholdoutupload_1ties out, items open1398.2%100.0%accepted0.0%30.0%
Northwind Ceramicsholdoutupload_2ties out, items open498.1%100.0%accepted0.0%66.1%
Bramble Pet Supplytrainupload_1accepted0100.0%100.0%accepted0.0%28.1%
Bramble Pet Supplytrainupload_2accepted0100.0%100.0%accepted0.0%89.6%
Copperleaf Teatrainupload_1accepted0100.0%100.0%accepted0.0%27.0%
Copperleaf Teatrainupload_2accepted0100.0%100.0%accepted0.0%64.0%
Fernwood Goodstrainupload_1accepted0100.0%100.0%accepted0.0%0.1%
Fernwood Goodstrainupload_2accepted0100.0%100.0%accepted0.0%41.3%
Lark & Pine Candle Cotrainupload_1accepted0100.0%100.0%accepted0.0%0.3%
Lark & Pine Candle Cotrainupload_2accepted0100.0%100.0%accepted0.0%57.3%
Marigold Skintrainupload_1accepted0100.0%100.0%accepted0.0%0.1%
Marigold Skintrainupload_2accepted0100.0%100.0%accepted0.0%47.2%
North Arc Outdoortrainupload_1accepted0100.0%100.0%accepted0.0%0.1%
North Arc Outdoortrainupload_2accepted0100.0%100.0%accepted0.0%56.2%
Tidewater Swimtrainupload_1accepted0100.0%100.0%accepted0.0%29.1%
Tidewater Swimtrainupload_2accepted0100.0%100.0%accepted0.0%62.3%

"Naive sum" adds up every deposit in the files. It overstates customer receipts because it counts transfers from savings, loan draws, vendor refunds and rows repeated in overlapping exports.

Limits