Documents and AI

How a document becomes a record

Extraction reads a classified document into named fields — for an invoice, its number, parties, dates and amounts. Parsers that read printed labels run first, the local language model fills in the rest, and every value is checked against the page.

ABOUT 8 MINUTESEXPLAINERFOR EVERYONE

Logley principleExtraction is deterministic first

A parser can only return what the page prints. The language model is the lowest tier: it supplies what the parsers could not read, and never overrules a value one of them read.

What a record holds

Each type has its own set of fields. These are the ones extraction looks for; a field the document does not print is left empty.

Fields extracted for each document type
TypeFields
InvoiceInvoice number; supplier and buyer, each with its tax ID; issue and due dates; currency; net, VAT and gross amounts; a separately billed insurance charge; route origin and destination; the transport order it bills and other reference numbers; line items with description, quantity, unit price and total; and its direction — money in, money out, or a credit note.
CMRCMR number; sender, carrier and consignee, with addresses; the carrier’s licence plate; goods and weight; loading and delivery dates; route; transport order reference; and any reservations written on it at delivery.
Customs DeclarationSAD number and MRN; declarant; customs office; goods; declared value and currency; customs duty; VAT; declaration date; import, export or transit; and the commodity lines, each with its CN code, description, value and net mass.
Delivery NoteNumber; sender; receiver; delivery date; goods; quantity; weight; warehouse; and whether it is signed.
ReceiptVendor; receipt number; the invoice it pays; date paid; amount and currency; buyer; and payment method.
ContractNumber and title; the two parties; effective and expiry dates; value and currency; type of contract; payment terms; auto-renewal; scope; notice period; and agreed rates per route.
Transport OrderOrder number; carrier and its tax ID; route; loading and delivery dates; agreed price and currency; payment terms; and cargo.
Correspondence and OtherNo record. The file and its text are kept, and search finds them.

Deterministic tiers first, the model last

Extraction runs as a ladder. The deterministic readers go first. Each covers the fields it can read reliably and stays silent unless the page is unambiguous: two captions giving two different values produce nothing, and the field falls through to the next rung.

  1. Parties by position

    On an invoice, the supplier and the buyer are read from the text block that sits beneath the seller and buyer headings (Sprzedawca and Nabywca, Lieferant and Käufer, Supplier and Buyer, and their French, Spanish and Romanian equivalents), using where the words sit on the page rather than the order the text came out in.

  2. Labelled values

    Gross and net amounts and the issue and due dates are read from the captions printed beside them (“Do zapłaty”, “Gesamtbetrag”, “Montant TTC”) in Polish, German, English, French and Romanian. The currency is taken when the page names exactly one, and each party’s tax ID when the seller and the buyer sit in separate columns. The VAT amount and the invoice number are scanned as well, but not yet trusted from captions alone.

  3. Customs and CMR fields

    A customs declaration’s goods table, where it has one, is parsed line by line into commodity codes, descriptions, masses and values, and its duty, VAT and declared value are read from their SAD boxes. A CMR’s loading and delivery dates are read from their box captions, day first, as the form prints them.

  4. The local language model

    The model reads the document and proposes every field for its type: this is the base layer. Wherever a deterministic tier already read a field, that value replaces the model’s. A first reading that is unusable or weak is retried and the better one kept. If the model fails outright, the fields the tiers read still stand, and the document goes to review.

  5. Checks on the final values

    Dates are rewritten in one format, read day first as European pages print them; every value that can be checked is compared with the text of the page; and an invoice’s amounts and dates are checked against each other. Why a value is never a guess explains these checks and what happens when one fails.

Where you see the record

Open a document from the Documents list. Extracted Data lists every field and, beside it, its evidence in words: Found on page 1 where the page says it, which brings that page into view, or the reason it is in doubt, such as Not found on the document, Fails the tax ID check or Read with low confidence. On an invoice, hovering the quote mark beside a field shows On the document: the page’s own words around the value. Where a scan was hard to read at that spot, the field adds the scan is hard to read here. On a PDF, Highlight fields in Document Preview marks each extracted value where it appears in the PDF’s text, and Extracted OCR Text shows everything the fields were read from. An invoice’s line items have their own Line Items table.

On the Invoices page, selecting an invoice shows its record beside an Evidence panel holding the source document and, once linked, the supplier record. Open full invoice record opens the same fields as an editable form.

The record of one invoice: each field with where the page says it, and an empty Order Reference shown as a dash rather than a guess.

Confidence, and what it decides

Every field carries a confidence, and so does the record as a whole. The document page shows no numbers and says in words what they mean for a field, as above; the invoice record’s form shows each field’s score. A score is set like this:

  • A field read by a deterministic tier carries 95% — high, while allowing for text that was itself misread.
  • A field the model proposed is scored from checks on the value. On an invoice, a field scored between 45% and 75% is read a second time, and a disagreement drops it to 30%.
  • A value the page does not support is capped at 30%. A value corrected by hand on the document page becomes 100%.
  • The record’s overall confidence can be no higher than its text allows: 50% plus half the OCR confidence, so a page read at 60% can claim at most 80%. Text from a PDF’s own layer sets no limit.

On an invoice, confidence routes the document. Any field at or below 50% sends it to review as Some fields were extracted with low confidence. An overall score under 85% means the extraction as a whole cannot be trusted: the type is reset to Other and the document flagged Extraction too weak, unless the score fell only because one value is not on the page, which is a problem with that field rather than with the document’s type. The 85% floor is the server setting Classification:InvoiceExtractionConfidenceFloor; Calibration, on the Extraction tab under Settings → Document intake, samples your confirmed invoices and recommends a value, without changing it.

Settings, then Document intake, then Extraction

Auto-approval then reads the confidence of the critical fields — the three amounts, the currency, the supplier, the invoice number and both dates. Automation, end to end covers the rest of its checks.

What the model may and may not decide

The model may
  • Read the fields no deterministic tier covers — most fields of a CMR, delivery note, receipt, contract or transport order, and an invoice’s number, VAT amount and line items.
  • Propose a document type, which keyword scoring cross-checks.
  • Recognize that an invoice is a credit note.
  • Say whether an invoice is income or expense — but only when Logley has no identity for your company to match against.
The model may not
  • Overrule a value a deterministic tier read.
  • Commit a value the page does not contain — such a value is flagged and not relied on.
  • See your own tax ID. It is withheld from the model, so it cannot be copied into the buyer’s field.
  • Decide income or expense when your company identity is set. That comes from matching your company’s names and tax ID against the parties on the page.
  • Choose the supplier record. Linking is a separate match on tax ID and name.
  • File a document as a transport order unless the text carries order markers.
  • Correct a sum that does not add up, or approve anything.

Your company identity is kept on the Company tab as Company name, Tax ID (NIP / VAT) and Company aliases:

Settings, then Organization, then Company

Limits

  • Nine types, and everything else is Other: kept and searchable, but without a record.
  • On a long document the model reads only the opening and closing parts of the text — the first 4,000 and last 2,000 characters of an invoice, CMR, customs declaration or delivery note, 3,000 and 2,000 of a receipt, and 5,000 and 3,000 of a contract or transport order. The deterministic tiers and the checks read all of it.
  • The VAT amount and the invoice number come from the model; no deterministic tier emits them yet.
  • Supplier-specific memory and templates exist but ship switched off, so every document is read on its own, whatever was corrected on the supplier’s earlier documents. When extraction gets something wrong explains what switching them on changes.
  • If the model fails and no deterministic tier read anything, the document has no record. Re-extract missing on the Invoices page runs invoices in that state through processing again.
NEXT GUIDEWhy a value is never a guess
Continue

Continue exploring

Was this guide useful?

If something was missing or unclear, the contact page says where to write.

Contact