The boring product: bank statement PDF to CSV, exactly
A bank statement converter should be deterministic first, fail with named reasons, and treat a model as a human-checked rescue. A quietly wrong row costs more than an honest 'we cannot read this yet'.
ON THIS PAGE
Building Taxadoo, part 3 of 7. Lessons from building the statement engine behind Taxadoo, a UK bookkeeping product — the decisions and the failures, not the internals. The whole series.
A bank statement PDF-to-CSV converter should be deterministic by default, fail with named reasons, and treat a model as a checked rescue rather than the reader. If the CSV is the product users import elsewhere, a row that is right most of the time and quietly wrong otherwise is worse than an upload that says "we cannot read this yet".
Make the ordinary path boring#
The default request should be one synchronous operation: detect a known layout, run its parser, write the CSV. There is no job chain to unwind and nothing partial to resume. Success takes seconds; failure is bounded to that single call. The same set of layout detectors and parsers can serve both a stand-alone converter and a bookkeeping pipeline, so a parser built for either product benefits both.
The parser registry is therefore the product. One output shape is defined once, and every parser returns exactly that shape. Adding a parser is not a special feature; it is how the system learns a layout.
Every failure gets a name and an owner#
Malformed input should not become an HTTP error. A small set of failures is enough: the file cannot be read, no parser claims the layout, a parser throws, a parser claims the layout and finds no rows, or the output cannot be saved. Each ends in a stored file, a stored reason, and a queue a person can work. None fails silently.
Before the CSV is handed back, one whole-file balance check runs. A file that does not close is held for a person with the first wrong row named; no sign or amount is changed to force it to close. That check catches arithmetic inconsistency, not correctness, which is why a balance is not enough on its own.
The useful distinction is who can fix it. A password-protected file is the user's fix. A storage hiccup is infrastructure's, and it is the only class worth retrying automatically. An unclaimed parser that reruns without a new deploy fails the same way again and spends money doing it.
A parser that claims a layout and finds zero rows is the clearest signal of a new variant of a known layout. It has already said the file is its format, so the difference belongs to the parser maintainer.
Model as rescue, not the reader#
Do not make a model the default path in a converter with no independent check after it. A bookkeeping pipeline can compare two readings against a balance chain; a bare converter cannot, because its output goes straight to the user's spreadsheet. A probabilistic reader would become the source of truth with nothing to catch a plausible wrong amount.
Bring the model in as rescue, and only in stages. First as a back-office button with a person checking the output, which shows the real effort per file and how often the output looks right but is not. Next as an automatic fallback behind a switch that defaults off. A visible "converted with AI" label ships with the path, not after it.
The rescue must return exactly what a parser returns: same columns, same shape, same meaning of an empty cell. It should get its own instructions, not the bookkeeping extractor's, because the two jobs ask for different fields. A change to the conversion output is a product change, because it is the file the user downloads.
Every manual rescue is also labelled data: the layout, what the model read, what staff kept. That is the raw material for the next parser.
