06.10

Obrada dokumenata

Sažetak

Vanjski dokumenti — uputnice, laboratorijski nalazi, raniji zapisi — skeniraju se na zlonamjerni kod, čitaju, klasificiraju i strukturiraju u četiri koraka. Izvučene vrijednosti postaju činjenice tek nakon pregleda kliničara.

Tehnička specifikacija vodi se na engleskom jeziku; naslovi i sažeci poglavlja prevedeni su na hrvatski.

Overview

  • ProductionProduce · Document Intelligence
    Bring outside documents into the structured record without retyping, and without letting an extraction error become a fact.

Pipeline

  1. Upload passes a ClamAV scan and magic-byte checks.
  2. Ingest (OCR) and classification run on the flash tier.
  3. Extraction of structured values and clinical interpretation run on the pro tier.
  4. Results land as artifacts with value snapshots; patient-attribution suggestions are offered when the document’s patient is uncertain.
  5. On acceptance, a fact writer emits extracted values as proposed facts.

Data owned

  • Documents
    Holds
    Uploaded files and metadata
  • Document AI value snapshots
    Holds
    What each stage extracted, versioned
  • Patient suggestions and attribution records
    Holds
    Which patient a document belongs to, and how that was decided

Models and engines

  • Ingest (OCR), classify
    Model or engine
    Gemini 3 Flash-Lite (flash tier)
    Notes
    Extraction temperature 0.1
  • Extract, interpret
    Model or engine
    Gemini 3 Flash (pro tier)
    Notes
    Tier pinned by a contract test

Guardrails

  • Every file is scanned before any model sees it.
  • Safety-relevant stages run on the pro tier, enforced by tests/ai/modelTierContract.
  • Extracted values are review-required; acceptance is the only path to facts.
  • Ambiguous patient attribution blocks rather than guesses.

Rollout and status

  • ProductionFour-stage analysis
    Enabled by default
  • PlannedDocument re-attribution
    ADR 0029 accepted; implementation behind a flag that is off

Interfaces

  • Consumes
    What
    Uploads and integration documents
  • Emits
    What
    Extraction and interpretation artifacts
  • Emits
    What
    Proposed facts on acceptance

Invariants

  • Document Intelligence invariants (truth-state vocabulary, stop-the-line rule)

Known limits

  • Clinical uploads are stored on instance disk today; moving them to Cloud Storage is ADR 0015.
SOURCE OF TRUTH
  • server/routes/ai/documentAnalysisRun.ts
  • server/services/documents/
  • docs/clinical-invariants/documents.md
  • docs/adr/0029-document-reattribution.md
Svaki broj u ovoj specifikaciji generira se iz repozitorija i provjerava u CI-ju.