Architecture kata · K—10

Claims Intake with Document Intelligence

Architecture kata · design study on a fictional brief

Sector
Insurance
Technologies
Apache Camel, Apache Kafka, PaddleOCR, vLLM, Flowable, Drools, PostgreSQL, Apache AGE, Debezium, Apache Iceberg, Langfuse, MLflow
Flow: OCR and a self-hosted LLM read claim documents, low-confidence fields go to review, rules or adjusters decide.
The design at a glance: the one-page, 30-minute live drawing.

In short

Self-hosted models recommend, rules and adjusters decide, eight GPUs sit behind a queue, every decision is auditable for seven years.

Problem

A property and casualty insurer handles 400,000 claims a year, and 60% arrive as e-mails with PDF forms, invoices and photos. About 600 adjusters spend roughly 40% of their time on data entry. The regulator requires human oversight and explainability for automated decisions, under the EU AI Act. The company owns eight GPUs and will not send customer data to external AI services. Simple claims under 2,000 EUR should be settled automatically by business rules.

Approach

The binding constraints are human oversight, reproducibility, eight GPUs, and no data leaving the premises. Customer SLAs are 24 hours to acknowledge and three days to settle simple claims, so accuracy and traceability matter more than speed. The model does not decide. It recommends. Rules decide simple claims, and a named human decides everything else, including every adverse outcome. GPU work waits in a queue.

Architecture

  • Intake: Apache Camel receives e-mail, portal, app and broker input. Originals go to object storage with Object Lock, and Kafka gets a claim.received event.
  • Document pipeline: OCR with PaddleOCR or docTR. An open-weight language model on vLLM then extracts fields into a JSON schema, with a confidence score per field.
  • Decision: Flowable runs the BPMN workflow. Drools decides simple claims. Fields below the threshold become review tasks for adjusters.
  • Fraud and tracing: a graph in PostgreSQL with Apache AGE scores repeat repair shops and duplicate invoices. Langfuse traces every model call. MLflow holds model versions, and prompts live in Git.
Architecture: claim documents from four channels pass a GPU queue for OCR and LLM extraction; rules or adjusters decide.
Solution overview: intake channels, the Kafka GPU work queue, the document pipeline, rules and human review, and the audit record.Open full size (opens in new tab)

Why these components

Need Choice Why
Multichannel intake Apache Camel IMAP, REST and SFTP connectors are ready, and every channel produces the same claim.received event and storage layout. A route per channel instead of custom code. Apache 2.0 with Red Hat support.
Document store Ceph RGW with S3 Object Lock Originals and OCR text stay unchanged for seven years. GPU workers and Iceberg use the same store through the S3 API. Ceph, because the MinIO community edition narrowed.
Event backbone and GPU job queue Apache Kafka on Strimzi Claim events and GPU jobs share one backbone; the priority and batch lanes are two topics. The queue absorbs GPU outages. I reused Kafka instead of adding RabbitMQ. Redpanda was ruled out over its licence.
Text recognition and document classes PaddleOCR or docTR Fast on GPU, with layout and table extraction, under Apache 2.0. Commercial OCR APIs are excluded because no data may leave the company. Tesseract is too weak on photographed documents.
Language model serving vLLM with an open-weight model Continuous batching gets the most from 8 GPUs. Output is constrained to a JSON schema, with confidence from calibrated log-probs. Apache 2.0 weights such as Qwen or Mistral; Llama’s licence is not OSI-approved.
Vision model Open-weight vision model on vLLM Damage class and duplicate-photo detection in the same serving layer, with its own model record. A separate vision platform is unnecessary.
Workflow Flowable with BPMN Every step from intake to payment is visible, with SLA timers and escalation built in. Human approval is a task type. Camunda 8 went source-available, and Camunda 7 is in maintenance mode.
Rule engine Drools with DRL and DMN Simple claims under 2,000 EUR are decided by deterministic, versioned, testable rules. The reason for a negative decision comes from the fired rule. This is where “the model does not decide” becomes concrete.
Fraud graph PostgreSQL with Apache AGE Repeat and ring patterns across repair shops, parties, invoices and accounts in Cypher, in the same database as the relational data. Neo4j Community is GPL and its clustering is commercial. JanusGraph adds operational load.
Decision audit record PostgreSQL outbox, Debezium, Apache Iceberg on Ceph The audit row and outbox row go into Flowable’s PostgreSQL transaction, and Debezium publishes from the log, so there is no dual write. Iceberg keeps seven years, and auditors query it with Trino.
LLM tracing Langfuse Prompt, version, tokens and latency for every call, plus evaluation scores and shadow comparisons. The core is MIT-licensed; the commercial enterprise features are not needed.
Model and prompt registry MLflow and Git Weight hash and version in MLflow; prompt templates and the evaluation set in Git, with a nightly regression run on a GPU. Promotion needs four-eyes approval, and rollback is a pointer change.
Gateway and identity Apache APISIX and Keycloak Adjuster, investigator, auditor and customer roles through OpenID Connect, with a gateway audit log and rate limits. APISIX, because Kong OSS moved features out of its open edition.
Secrets and keys OpenBao Envelope encryption with a data key per claim. Destroying the key at the end of retention is erasure; a litigation hold keeps it. HashiCorp Vault was ruled out because of its Business Source License.

Decisions and trade-offs

  • Two-lane GPU queue. The kata estimates 8 to 9 GPU-hours of work a day against 192 GPU-hours of capacity. The problem is latency variance, not utilisation. So the target is minutes, not seconds, and there is no client timeout. If the GPUs stop, the queue grows, while intake receipts and adjuster screens keep working. The cost: this setup would not serve real-time chat.
  • Audit row and outbox row in one transaction. Other katas write events straight to Kafka. Here the AI Act record and the workflow step must never drift apart, and a dual write to database and Kafka carries exactly that risk. Debezium publishes from the log. The cost is an Iceberg copy that lands seconds later, so PostgreSQL is the source of truth in that window.
  • The model suggests; rules and people decide. Drools closes only simple claims under 2,000 EUR. A rejection or reduction needs a named human approval. The customer explanation comes from the fired rule and the adjuster note, never from raw model output. The cost is automation bias, so 10% of claims are a blind sample to measure it.
  • Confidence per field, thresholds per field type. An IBAN and a free-text damage description do not share a threshold. A low-confidence field sends only that field to review, not the whole claim. Confidence comes from calibrated log-probs, because constrained output renormalises raw probabilities. The cost is keeping the calibration current.
  • Prompts and rules versioned like code. They are tested against an evaluation set in CI on a nightly GPU, and new versions run in shadow before they count. The 95% accuracy target is measured weekly by sampling, not promised. The cost is the effort to maintain that set.
  • Erasure by key destruction. Per-claim data keys are destroyed at the end of retention, and that counts as erasure under GDPR Article 17. Prompts and outputs in the audit record are stored encrypted too, so key destruction covers them. A litigation hold keeps the key. The cost is careful key management, which the data protection officer still has to review.
Flow: low-confidence fields go to human review, rules or adjusters decide, and each step is logged with the model hash.
The document pipeline with confidence gating, the GPU queue, the human loop and the audit record. The SLA is 24 hours, not 150 ms.Open full size (opens in new tab)

What I would revisit

  • GPU type. Are the 8 GPUs 40 to 80 GB data centre cards or 24 GB workstation cards? Model size and tensor parallelism depend on it.
  • What counts as a simple claim. I assumed 45% of claims. The real share sets the straight-through rate and the adjuster savings.
  • AI Act role. The insurer is the provider of a high-risk system. Who owns the technical file and the conformity assessment, and is a notified body needed?
  • Damage estimates from photos. Classification only, or an amount suggestion too? The vision model and its GPU share depend on it.

Outcome notes (design assumptions, not measurements)

This is a design exercise, not a running system. The output is a four-page diagram set, a one-page whiteboard version and a 16-page Turkish PDF. Field accuracy and the 45% share of simple claims are assumptions from the brief, not results.

Sources

  • Architecture PDF (Turkish, 16 pages).
  • draw.io diagrams (English labels): four-page set and a one-page 30-minute version.

Real projects on this topic

  1. P—03

    Active

    Featured

    Contract-Driven Data Platform with GenAI-Assisted Onboarding

    New data sources join through validated YAML contracts; LLM agents work at design time only, so production runs stay deterministic.

    • Data contracts
    • GenAI
    • LLM evaluation data
    • AI-ready data
    • Data governance
    • Data pipelines

    Role

    Architecture and hands-on development · Data Solution Architect

  2. P—04

    Completed

    Fashion Retail Competitive Intelligence & GenAI Trend Platform

    Competitor price, stock and colour data for 20+ brands in ~95 markets, normalized with LLMs: pricing and assortment decisions from 1 week to 1 day.

    • GenAI
    • AI-ready data
    • Decision support
    • Data platform
    • Cloud

    Role

    Design and build · Data Solution Architect

AI & GenAI: projects, katas and publications

About the katas

Write to me about a similar design problem.