Skip to content

Building an extraction pipeline

The machinery every extraction shares: reading order, schema design, validation rules, per-field confidence, review queues and audit trails.

An extraction pipeline is usually described as a model with a schema attached. That framing hides where the work actually is. By the time a model sees a page, somebody has already decided which text runs belong to which column, which order the paragraphs go in, what the fields are called, what a valid value looks like, and what happens to the eleven percent of documents that do not fit. Those decisions determine the accuracy of the system far more than the choice of model does, and none of them is a prompting problem.

These pages are the general machinery, written once so that pages about a particular document type do not have to repeat it. Reading order and table geometry first, because they run before anything else and destroy information silently when they are wrong. Then schema shape, then validation rules that can actually reject a value rather than merely flagging it, then confidence, review and the audit trail that lets you answer, eighteen months later, why a field says what it says.

Extracting a Table That Uses Merged Cells Across a Header Row

Why a merged header label lands on one column and leaves the rest blank, and how to propagate it across the columns it actually covers.

9 min read

Extracting a Table Whose Columns Don't Align Between Pages

Why values jump into the wrong column partway through a multi-page table, and how to key columns by header identity instead of by x position.

10 min read

Extracting Text From a Two-Column Academic PDF in Reading Order

Why text comes out interleaved across both columns, and the projection-profile method that recovers the real reading order.

10 min read

Extracting Data From a Document With a Sidebar and Main Column

How pull quotes and call-out boxes get spliced into body text, and a bounding-box method that separates them without discarding what they contain.

9 min read

Extracting Text From a Scanned Fax With Header Noise on Every Page

Where the transmission header on every fax page comes from, why cropping it is the wrong fix, and how to detect it by cross-page repetition.

10 min read

Extracting Data From a Fax Cover Sheet

The routing fields a cover sheet carries, and why its claimed page count is the most useful field on it.

9 min read

Designing an Extraction Schema Before You've Seen Every Document Variant

Why a schema built from the common case breaks on the fifth format, and how to design one that can absorb a variant it has never met.

10 min read

Choosing Between a Nested and a Flat Schema for Document Extraction

One invoice modelled both ways, and the cardinality rule that decides which shape a field belongs in.

10 min read

Designing an Extraction Schema That Survives a Multi-Entity Document

How to name fields on a document that carries several parties, dates or amounts of the same kind without inventing unstable numbered fields.

9 min read

Writing a Validation Rule for a Date Field That Rejects Impossible Dates

A shape check plus a real calendar parse plus a range rule, and why the middle one must not be a regular expression.

9 min read

Writing a Validation Rule for a Currency Amount Field

A parser that decides the decimal separator from evidence rather than configuration, and stores the result in integer minor units.

10 min read

Writing a Validation Rule for an Extracted Identifier Field With a Checksum

Luhn, ISO 7064 mod 97-10 and modulo-11 side by side, with what each catches and what a passing check does not prove.

10 min read

Writing a Cross-Field Validation Rule That Compares Two Extracted Amounts

How to check that an invoice's subtotal, tax and total agree, in integer minor units, with a rounding tolerance you can derive rather than guess.

10 min read

Handling a Required Field That Is Missing From the Source Document

Why a field the document does not contain and a field your pipeline failed to read are different results, and what collapsing both to null costs you downstream.

9 min read

Handling a Field That Is Present but Illegible

When to store a low-confidence best guess and when to store an explicit illegible flag, worked through the downstream error cost of each choice.

9 min read

Scoring Confidence Per Field Instead of Per Document

Why one score for a document hides the one field that is wrong, and why the correct document-level rollup is a product or a minimum rather than a mean.

10 min read

Calibrating an Extraction Model's Confidence Scores Against Actual Error Rate

How to bucket extracted fields by reported confidence, measure each bucket's real accuracy, and fit a correction that turns a score into a probability.

12 min read

Setting a Confidence Threshold That Sends a Field to Human Review

Deriving the review cut-off from the cost of a review and the cost of an escaped error, including the reviewer's own error rate, instead of defaulting to 0.8.

10 min read

Building a Review Queue That Shows the Source Location for Each Extracted Field

How to carry a page, a bounding box and the verbatim source text through extraction so a reviewer checks a crop instead of re-reading the document.

11 min read

Prioritizing a Human Review Queue by Financial Impact, Not Arrival Order

Ranking a capacity-constrained review queue by expected loss avoided per reviewer-minute, and the measurement it quietly destroys if you do not compensate.

10 min read

Correcting One Extracted Field Without Re-Running the Whole Document

A patch-shaped correction model where a reviewer's fix is stored as a field-level event, so it survives concurrent edits and a later re-extraction.

10 min read

Feeding Human Corrections Back Into an Extraction Prompt Without Overfitting to One Document

How to tell a correction that reveals a real prompt gap from a one-off document oddity, and a rule for which corrections earn a change.

10 min read

Building an Audit Trail That Shows Who Corrected an Extracted Field and When

A field-level correction trail — prior value, new value, reviewer, timestamp, reason — that is append-only, verifiable, and survives the record being superseded.

10 min read

Keeping an Audit Trail of Which Model Version Extracted Each Field

Why every extracted field needs a composite version stamp covering model, prompt, schema and preprocessing, and why a model alias is not a version.

9 min read

Other topics