LIVE Structured extraction

BelegLotse

Extracts invoices/dunning letters into structure, validates them (validation flags) and exports to DATEV — optionally 100 % local. Live.

Problem & context

Typing in receipts is slow and error-prone

Every receipt must be captured, checked and exported to DATEV. An extractor that recognises fields, validates against §14 UStG and exports cleanly — optionally cloud-free — speeds up bookkeeping.

Solution

OCR + LLM + validation instead of typing

PDF/image via OCR or text, structured extraction (typed fields + confidence) and — the core — deterministic validation OVER the AI output: VAT arithmetic, § 14 UStG, default § 288 BGB, IBAN/VAT-ID → visible validation flags. Export to DATEV (EXTF), CSV, JSON.

BelegLotse extractor: an invoice with field table (confidence) and validation flags (VAT, § 14 UStG, IBAN) plus DATEV export.

Architecture

Clean Architecture, four layers

domain

Receipt, ValidationFlag + LLM/OCR port

application

BelegExtractor + validation rules (UStG/BGB)

infrastructure

pypdf, Tesseract OCR, Mistral/Ollama, DATEV/CSV/JSON

api

FastAPI: upload + /extract (SSE) + /export

Process history

From plan to deploy — six phases

  1. 01

    Setup & architecture

    DONE

    Clean-arch skeleton, Docker, CI (ruff + mypy --strict + pytest). Amber accent.

  2. 02

    OCR & extraction

    DONE

    PDF (pypdf) / image (Tesseract) / text; LLM structured output → receipt + confidence.

  3. 03

    Validation

    DONE

    Deterministic rules over the AI: VAT, § 14 UStG, § 288 BGB, IBAN (mod-97), VAT-ID → flags.

  4. 04

    Eval harness

    DONE

    10 receipts: field accuracy, exact-match, validation-catch-rate (detects VAT errors).

  5. 05

    Export & extractor (SSE)

    DONE

    DATEV (EXTF)/CSV/JSON, upload dropzone, live steps, field table + flags. BFSG/TDDDG.

  6. 06

    Deploy & docs

    DONE

    Live on own VPS via Traefik (image with Tesseract). Project docs + design public.

Results

Made measurable

100 %
Field accuracy (67/67, 10 receipts)
2/2
Validation-catch (VAT errors caught) · exact 10/10
~1,7 s
Latency p50 (extraction + checks)

Measured against a golden set (26 cases). Details in the project documentation.

Stack & compliance

Python 3.12FastAPIHTMX + SSETesseract / pypdfMistral / OllamaDATEV-EXTFDockerTraefik

Receipts contain personal & tax-relevant data → optionally 100 % local (Ollama + Tesseract), no storage (data minimisation). Disclaimer: no tax advice (StBerG).

BelegLotse live demo

Open live demo ↗ ← All projects