Skip to content

Receipts, statements and tax forms

Thermal receipts, bank statements and the fixed-box tax forms where a field's meaning is defined by a government schema rather than a layout.

These documents divide into two kinds and almost every extraction mistake comes from treating one as the other. A tax form has a schema: the number printed next to a box is a reference into a document the IRS publishes, and the meaning of that box does not depend on where it appears on the page or what the surrounding text says. A receipt has no schema at all. It has a merchant’s idea of a receipt, printed on paper that is actively decaying, with the one field you most want — what kind of business this was — never printed on it anywhere.

What the two halves share is arithmetic. A receipt’s line items sum to its subtotal, a statement’s closing balance equals its opening balance plus its transactions, a payslip’s gross minus its deductions equals its net, and a Schedule C’s parts foot into each other. That arithmetic is the only thing on any of these documents that can tell you an extraction is wrong without a human reading it, so these pages are built around it: what the identity is, what breaks it legitimately, and what the size of the residual tells you about which field you misread.

Extracting Data From a Blurry Phone Photo of a Receipt

Why blur destroys the amounts before it destroys the words, and how to use the receipt's own arithmetic to find the digit you misread.

9 min read

Extracting Tip and Gratuity Amounts From a Restaurant Receipt

Why the printed total on a card receipt is the pre-tip total, and how to recover a handwritten tip from the settled amount instead of the pen stroke.

8 min read

Categorizing Receipt Line Items for Expense Reports

Build a category mapping onto expense categories that already exist in tax law, and allocate tax and tip across the categories rather than dumping them in one.

9 min read

Extracting Merchant Category From a Receipt When the Logo Is the Only Clue

The merchant category code lives in the card network's data and is never printed on the paper, so the receipt only supports an inference you should make with a lookup you control.

8 min read

Extracting Data From a Faded Thermal-Printer Receipt

Thermal fading is a chemical change in the paper's coating, not lost ink, so the strategy is partial extraction with explicit missing-field flags rather than restoration.

8 min read

Extracting Recurring Transactions From a Bank Statement

Normalise the descriptor, then cluster on the interval rather than the amount, so a price rise and a four-weekly billing cycle stop breaking the grouping.

9 min read

Extracting Opening and Closing Balances From a Multi-Page Bank Statement

The identity that closing equals opening plus transactions is the only check that catches a page you never knew was missing, and the size of the residual says which failure you have.

9 min read

Extracting Check Images and Numbers Referenced in a Bank Statement

Check numbers appear in two different places on a statement with different conventions, and the asterisk marking a sequence gap is the only signal a naive extractor throws away.

8 min read

Categorizing Bank Statement Transactions Into a Chart of Accounts

Keep extraction and classification as separate stages so the chart of accounts can change without re-reading the statement, and set the auto-post threshold per account rather than globally.

9 min read

Extracting Gross Pay, Deductions and Net Pay From a Payslip

A payslip has no standard layout but two arithmetic identities that must close, and employer-side contributions are the reason most naive extractions fail one of them.

9 min read

Extracting Year-to-Date Totals From a Payslip

Current-period and year-to-date figures are the same fields printed twice, indistinguishable in January, and the only check that proves you assigned them correctly needs two payslips.

8 min read

Extracting Tax Withholding Codes From a Payslip

A tax code is a jurisdiction's private shorthand with a defined grammar, so it should be validated structurally against a supplied table rather than interpreted by a model.

8 min read

Extracting Box Values From a W-2 Form

Every numbered box means one defined thing, boxes 1, 3 and 5 are supposed to differ, and box 12's four slots are positions rather than fields.

10 min read

Extracting Income Figures From a 1099-NEC or 1099-MISC

A box number on a 1099 means nothing without the form variant and the revision, because nonemployee compensation moved between forms and boxes have been renumbered since.

9 min read

Extracting Data From a Schedule K-1

Three different forms share the name, their box numbers disagree with each other, and the values you want are frequently not on the K-1 at all but on an attached statement it points to.

10 min read

Extracting Filing Status and Dependents From a Form 1040

Five mutually exclusive checkboxes resolve to one enum, but the text field beside them means different things depending on which box is ticked, and the dependents grid stops at four rows.

9 min read

Extracting Expense Categories From a Schedule C

The parts of a Schedule C foot into each other, which makes the extraction self-checking, and the line numbers move between tax years, which makes keying a ledger on them a mistake.

9 min read

Other topics