Skip to content

8.19 Entity model

The case and what happens to it — intake, conversion and extraction, review, decision, audit and assistance — as entities with their identities, keys and relations, the records that hold any business model's extracted values and their checks, and the tables the case is stored in (8.19.6). The same things in the terms of domain-driven design — the bounded contexts, the aggregates and the domain events — are the domain model. The concrete attributes of a business model — FeeCheck's fee agreement, its parties, fees and bank details — are its business data model in docs/model/feecheck/data-model.md, which is not published.

8.19.1 Overview

erDiagram
    Dossier ||--o{ Case : "bundles"
    Case ||--|{ SourceDocument : "holds"
    Case ||--o| Extraction : "extracted into"
    Case ||--o{ ReviewCase : "runs"
    Dossier {
        UUID id PK
        String packId
        JSON businessKey "pack-dependent"
        String externalReference "a contract or order number, if any"
        Enum state "OPEN, CLOSED"
        Instant openedAt
        Instant closedAt
    }
    SourceDocument ||--|| IntegrityCheck : "is checked by"
    SourceDocument ||--o| DocumentClassification : "is classified by"
    SourceDocument ||--o| IntakeDecision : "is admitted by"
    SourceDocument ||--o{ DocumentRendition : "is rendered to"
    ReviewCase ||--o{ Finding : "bundles"
    VerificationOutcome }o--|| Finding : "justifies"
    Finding ||--o| MatchAssessment : "is assessed by"
    ReviewCase ||--o| MatchAssessment : "overall assessment"
    MatchAssessment ||--o| AssessmentRationale : "is explained by"
    Finding ||--o{ Correction : "is corrected by"
    ReviewCase ||--o| Decision : "ends in"
    ReviewCase ||--o{ ComparisonReport : "produces"
    ReviewCase ||--o{ AuditEntry : "logs"
    Case |o--o{ AssistantInteraction : "asked about"
    KnowledgeSource }o--o{ AssistantInteraction : "evidences"
Name Holds Status
Dossier the business case: every document of one partner relationship — a contract, its addenda, its invoices — under one pack-dependent business key planned
Case one business document — a main document and its attachments — on its way through the stages (8.11.3) built for one document per case; several planned
SourceDocument one received document as intake records it — the case's main document or an attachment: role, hash, channel, declared and recognised kind, admission state (8.19.2) built in part: the uploader and the file name, on the case; one per case
IntegrityCheck the deterministic first gate (8.19.2) built in part: a file that is not a PDF or over the size limit is refused without a case; a document over the page limit is a blocked case
DocumentClassification the second gate's triage (8.19.2) built in part: the document-type gate's verdict on the first pages
IntakeDecision how a document was admitted, rerouted or discarded, and by whom (8.19.2) built in part: a person's confirmation of an unclear verdict, a reviewer's report on a blocked case
DocumentRendition the converted document, page-anchored markdown built in part: the markdown kind
Extraction, VerificationOutcome the values read from the document and the checks on them (8.19.5) Extraction built in part: a fixed set of fields; VerificationOutcome planned
ReviewCase one use case run on an extracted case, from reconciliation to release (8.19.3) planned
Finding, MatchAssessment, AssessmentRationale, Correction what the review works on (8.19.3) planned
Decision, AuditEntry, ComparisonReport the release, the trail and the report (8.19.3) planned
KnowledgeSource, AssistantInteraction the assistance's knowledge base and its log (8.19.4) planned

The case and the dossier. The case is the Case of the workflow module (docs/specs/15-workflow-module.md) §2 — one business document: a main document and what it incorporates, such as its terms and conditions or its annexes. Its key is a random ID assigned when its first PDF is received, never derived from the document. It carries the document work, convert and extract; the use cases then run on it as review cases, spec 15's child cases. The dossier bundles cases: it is keyed by the partner relationship, which is an output of a case's extraction, so a case is opened before anyone knows which dossier it belongs to. A document that stands on its own — an addendum signed later, an invoice — is a case of its own, bundled into the dossier; one that only completes another belongs to that document's case.

8.19.2 Intake

A received document passes two separate gates before it is admitted: integrity first, deterministically, then its type and the verification pack that handles it.

erDiagram
    SourceDocument ||--|| IntegrityCheck : "is checked by"
    SourceDocument ||--o| DocumentClassification : "is classified by"
    SourceDocument ||--o| IntakeDecision : "is admitted by"
    SourceDocument ||--o{ DocumentRendition : "is rendered to"
    SourceDocument |o--o| SourceDocument : "supersedes (addendum)"
    SourceDocument {
        UUID id PK
        UUID caseId FK
        UUID dossierId FK
        Enum role "MAIN, ATTACHMENT"
        String label "for an attachment"
        UUID supersedesDocumentId FK "for addenda"
        String contentHash "SHA-256, duplicate detection"
        String mediaType
        Enum sourceChannel "WEB_UPLOAD, SHAREPOINT, DMS, ARCHIVE, API"
        String sourceReference
        Enum declaredKind "asserted"
        Enum classifiedKind "recognised"
        Enum intakeState "RECEIVED to ADMITTED, REROUTED, DISCARDED"
        Date validFrom "domain validity"
        Date validTo
        Instant receivedAt
        JSON importMetadata "from the adapter, never parsed from the file name"
    }
    IntegrityCheck {
        UUID id PK
        UUID documentId FK
        Boolean passed
        List violations "see the table below"
        String checkedBy
        Instant checkedAt
    }
    DocumentClassification {
        UUID id PK
        UUID documentId FK
        String label
        Decimal confidence
        Enum basis "TEXT_LAYER, OCR_FIRST_PAGE, METADATA_ONLY"
        List injectionSignals
        List candidatePacks
        String modelId
        String modelVersion
        String promptVersion
        Instant classifiedAt
    }
    IntakeDecision {
        UUID id PK
        UUID documentId FK
        Enum outcome "IntakeOutcome"
        String selectedPackId
        String decidedBy
        String rerouteTarget
        Text rationale
        Instant decidedAt
    }
    DocumentRendition {
        UUID id PK
        UUID documentId FK
        Enum kind "TEXT_LAYER, OCR_PARTIAL, OCR, MARKDOWN"
        Text content
        String producedBy
        Decimal qualityScore
    }
Name Responsibility Status
SourceDocument the received document; intakeState runs RECEIVED, INTEGRITY_PASSED or INTEGRITY_REJECTED, TRIAGED, AWAITING_CONFIRMATION, then ADMITTED, REROUTED or DISCARDED; a rejected document is kept with its state and rationale built in part: the uploader and the file name, on the case; one per case
IntegrityCheck gate 1: format, encryption, active content, embedded files, page and size limits, well-formedness, media type, suspected malware; no model, no pack, a hard rejection; append-only built in part: a file that is not a PDF or over the size limit is refused without a case; a document over the page limit is a blocked case
DocumentClassification gate 2's triage: the label, the basis it was read from — the text layer where there is one, otherwise page 1, before the full conversion — the candidate packs and any passage that reads like an instruction; append-only built in part: the document-type gate on the first pages, for contracts
IntakeDecision the admission: the outcome, the pack chosen, who decided and why built in part: a person confirms an unclear verdict; a reviewer reports a blocked document as one of a kind FeeCheck handles, with a reason
DocumentRendition the converted document; the markdown kind is page-anchored, which is what lets an extracted value name its page (spec 8 (docs/specs/8-intake-into-extraction.md)) built in part: the markdown kind

Gate 1 — integrity. A classifier asked "what kind of document is this?" answers correctly for a manipulated document at best by chance; that is not a security control, so the first gate uses no model.

Gate 2 — type and pack. Only after gate 1 has passed. Unambiguous and expected → ADMITTED; unambiguous but a different type → REROUTED; uncertain, several packs possible, or an injection signal set → AWAITING_CONFIRMATION, presented to a person, whose confirmation is an IntakeDecision with user and rationale.

Enumeration Values
IntegrityCheck.violations ENCRYPTED, ACTIVE_CONTENT, EMBEDDED_FILE, PAGE_LIMIT_EXCEEDED, SIZE_LIMIT_EXCEEDED, MALFORMED, UNSUPPORTED_MEDIA_TYPE, MALWARE_SUSPECTED
IntakeOutcome Meaning
ADMITTED the expected type, unambiguous
ADMITTED_AFTER_CONFIRMATION admitted by a person's confirmation
REROUTED a different type, handed to its own intake
DISCARDED not processed
BLOCKED failed the integrity check; arises only there and cannot be overridden

Prompt injection. Document text is passed as data, never as an instruction, with an enforced output format and without tool access (8.2, G-1). Triage reports suspicious passages in injectionSignals. The structural safeguard is that no model grants a release: a successful injection can at most distort a classification, not suppress a finding — and that holds for the assistance too.

8.19.3 Review, decision and audit

The review case is the use case that runs on an extracted case, spec 15's child case: it carries the findings from reconciliation through release.

erDiagram
    Case ||--o{ ReviewCase : "runs"
    ReviewCase ||--o{ Finding : "bundles"
    VerificationOutcome }o--|| Finding : "justifies"
    Finding ||--o| MatchAssessment : "is assessed by"
    ReviewCase ||--o| MatchAssessment : "overall assessment"
    MatchAssessment ||--o| AssessmentRationale : "is explained by"
    Finding ||--o{ Correction : "is corrected by"
    ReviewCase ||--o| Decision : "ends in"
    ReviewCase ||--o{ ComparisonReport : "produces"
    ReviewCase ||--o{ AuditEntry : "logs"
    ReviewCase {
        UUID id PK
        UUID caseId FK
        UUID dossierId FK
        UUID triggeringDocumentId FK
        String packId
        String packVersion
        Enum state "EXTRACTED, RECONCILED, ASSESSED, IN_REVIEW, APPROVED, REJECTED"
        String assignee
        Instant openedAt
        Instant closedAt
    }
    Finding {
        UUID id PK
        UUID reviewCaseId FK
        String attributePath
        Enum severity "INFO, REVIEW, BLOCKING"
        Enum reason "see the table below"
        List outcomeIds
    }
    MatchAssessment {
        UUID id PK
        Enum scope "FINDING, CASE"
        UUID targetId FK
        Enum level "AssessmentLevel"
        Integer score "0..100, derived deterministically"
        Enum suspectedCause
        List secondaryCauses
        String packId
        String rubricVersion
        String modelId
        String modelVersion
        String promptVersion
        String inputHash
        Instant assessedAt
        Boolean advisory "always true"
    }
    AssessmentRationale {
        UUID id PK
        UUID assessmentId FK
        Text text
        String language
        List citedOutcomeIds
        String modelId
        String modelVersion
        String promptVersion
        Instant generatedAt
    }
    Correction {
        UUID id PK
        UUID findingId FK
        String correctedValue
        String correctedBy
        Text rationale
        Enum channel "IN_APP, EXCEL_ROUNDTRIP"
        Boolean draftedByAssistant
        Instant correctedAt
    }
    Decision {
        UUID decisionId PK
        UUID reviewCaseId FK
        Enum outcome "APPROVED, REJECTED"
        String decidedBy
        String fourEyesBy "optional"
        Enum assessmentAgreement "AGREED, OVERRULED, NOT_SHOWN"
        Instant decidedAt
    }
    ComparisonReport {
        UUID id PK
        UUID reviewCaseId FK
        Enum format "XLSX, PDF, JSON, CSV"
        String templateId
        Instant generatedAt
        String contentHash
    }
Name Responsibility Status
ReviewCase one use case on an extracted case; RECONCILED follows the step Reconcile against master data of spec 15 and SPEC.md FR-3 planned
Finding one reason for a person to look, per attribute; severity and reason arise deterministically from the verification outcomes, and no model sets them planned
MatchAssessment the classification AI's advisory level, for one finding or the whole case; it sees structured features, never the raw document; append-only planned
AssessmentRationale the generated comment that explains a level — it justifies the level, it does not determine it; append-only planned
Correction a person's corrected value; draftedByAssistant records that the text was proposed by the assistance and adopted by a person planned
Decision the release or rejection, by a person, with the four-eyes approver; assessmentAgreement is the ground truth for the evaluation planned
AuditEntry the append-only trail of every state transition — intake checks, triage, admission, case-related assistance — with the snapshot, policy, rule, rubric, model and pack versions in effect planned
ComparisonReport the report a review case produces planned

AI assessment and decision. The release decision is made on severity and reason, deterministically. Three rules: the assessment is no gate — a high score does not hide a BLOCKING finding; the screen orders the hard facts first and the assessment after; and a person's disagreement is recorded in assessmentAgreement. The level is an ordinal classification against a rubric, and the score is derived from it, because a freely chosen value from 1 to 10 is an uncalibrated score — unstable and clustered. The pattern is LLM-as-a-judge; document triage, by contrast, is a multi-class classification with a reject option.

Enumeration Values
Finding.severity INFO, REVIEW, BLOCKING
Finding.reason DEVIATION, LOW_CONFIDENCE, NOT_VERIFIABLE, NO_REFERENCE, SELF_INCONSISTENT (a repetition whose places disagree), AMBIGUOUS_MAPPING, UNMATCHED_LINE
AssessmentLevel Criterion Score
FULL_MATCH all attributes confirmed, confidence high 95–100
MATCH_WITH_NOTES agreement, individual values uncertain or not checkable 80–94
MINOR_DEVIATION deviations without material effect 60–79
MATERIAL_DEVIATION a deviation on an attribute of high materiality 25–59
UNRESOLVED too little basis for a statement 0–24

8.19.4 Assistance

Questions and answers about the application and a case, evidenced from the knowledge base and the case file (ADR-0002 (docs/adr/adr-0002-assistance.md)).

erDiagram
    Case |o--o{ AssistantInteraction : "asked about"
    KnowledgeSource }o--o{ AssistantInteraction : "evidences"
    AssistantInteraction }o--o{ Finding : "cites"
    KnowledgeSource {
        UUID id PK
        String packId "null for core-wide knowledge"
        Enum kind "PRODUCT_DOC, GLOSSARY, RULEBOOK, FAQ"
        Text title
        Text content
        String version
        Vector embedding
    }
    AssistantInteraction {
        UUID id PK
        UUID caseId FK "null for application questions"
        String userId
        Text question
        Text answer
        List citedRefs "Finding, extracted value with its evidence, KnowledgeSource"
        JSON retrievalScope "the permissions the search applied"
        List readToolsUsed
        Boolean refused
        Enum refusalReason "OUT_OF_SCOPE, NO_EVIDENCE, NOT_AUTHORIZED"
        String packId
        String modelId
        String modelVersion
        String promptVersion
        Instant createdAt
    }
Name Responsibility Status
KnowledgeSource the knowledge base: product documentation from the core, glossary, rulebook and example questions from a verification pack planned
AssistantInteraction one question and its answer, about a case or about the application; a case-related one is part of the audit trail; append-only planned
Kind of question Example Basis Behaviour
Application help "What does not checkable mean?" KnowledgeSource answer, citing the documentation
Case enquiry "Why does this value deviate?" the case file, filtered by permission answer, with evidence only
Professional advice "What value is customary in the market?" none refuse with OUT_OF_SCOPE

The case enquiry is the valuable kind. Professional advice is where a language model sounds convincing and knows nothing, so it is refused explicitly rather than answered as well as possible.

  1. No write access, no release. The assistance can navigate, explain, filter, summarise and draft text. It cannot set a value and cannot release a case.
  2. An answer only with evidence. Without citedRefs the answer is "I don't know".
  3. Permission-filtered search. The retrieval set is restricted by the user's permissions, not only by relevance: a relationship manager must not reach other partners' documents through the chat. retrievalScope records what applied.
  4. Logging. Every case-related interaction is an AssistantInteraction in the audit trail; without it a decision could be influenced by a statement nobody can reproduce.
  5. Failure without consequence. Where no model is available — an on-premise profile without a local model — the assistance is missing and nothing else changes.
  6. Read tools only. findCases, explainFinding, showProvenance, searchDocument, summarizeCase, draftCorrectionRationale. A drafted rationale lands in the review as a proposal and is adopted through the normal path.

It is called assistance, not adviser: in a financial context advice has a regulatory meaning, and a chat about the application and the case should not promise it.

8.19.5 Attributes, values and verification

What a case's extraction reads and how each value is checked, independent of the business model it is read for. A business model — FeeCheck's fee agreement first — supplies its attributes as the content of a verification pack (8.10); the records below hold any model's values.

Six rules hold for these records:

  1. The evidence is part of the datum. An extracted value carries its verdict and, when the document confirms it, the page and the passage it was read from.
  2. Verification outcomes are immutable. A new run produces a new record.
  3. The attribute path carries the meaning, not the name.
  4. Confidence and deviation are two axes. Confidence is derived from a citation check, never reported by the model (8.7); deviation is the verification outcome.
  5. Systems are adapters. A master-data system appears as a sourceSystem value, not as a type.
  6. Domain content is configuration. Attribute definitions, derivation rules, reference bindings, tolerance policies, assessment rubrics, report templates, the knowledge base and the triage labels belong to a pack, and every record of a run carries packId and packVersion (ADR-0001 (docs/adr/adr-0001-verification-modules-and-adapters.md)).

The key. An attribute is identified by three parts: its category, its name and its reference in the master-data system. The pack writes the three as one canonical attribute path — a root per master-data object, then the attribute. Two kinds of duplication follow from that key: a homonym is one name on different paths, two attributes with their own check rules; a repetition is one path at several places in the document, and when the places disagree the finding's reason is SELF_INCONSISTENT (8.19.3) before master data or a register is consulted. Where several document attributes map onto one master-data attribute, a versioned DerivationRule of the pack says how, and the audit trail records which version applied.

erDiagram
    Case ||--o| Extraction : "extracted into"
    Extraction ||--o{ ExtractedValue : "one per attribute"
    AttributeDefinition ||--o{ ExtractedValue : "types"
    SourceDocument ||--o{ LineItem : "contains"
    LineItem |o--o{ ExtractedValue : "locates"
    LineItem ||--o{ LineMatch : "source of"
    LineItem ||--o{ LineMatch : "target of"
    AttributeDefinition ||--o{ ReferenceBinding : "is bound by"
    AttributeDefinition ||--o{ MasterDataValue : "types"
    ExtractedValue ||--o{ VerificationOutcome : "checked by path and qualifier"
    MasterDataValue ||--o{ VerificationOutcome : "comparison value"
    ReferenceSnapshot ||--o{ VerificationOutcome : "evidence"
    VerificationOutcome }o--|| Finding : "justifies"
    AttributeDefinition {
        String packId PK
        String packVersion PK
        String path PK "canonical attribute path"
        String category
        String displayName
        String masterDataReference "or null"
        Enum dataType "see the table below"
        Enum referenceability "INTERNAL_ONLY, EXTERNALLY_VERIFIABLE, COMPUTABLE, NO_REFERENCE"
        Enum materiality "HIGH, MEDIUM, LOW"
        List validationRules
    }
    Extraction {
        UUID caseId PK "one current extraction per case"
        String packId
        String packVersion
        Boolean complete "derived: every value GROUNDED"
        String extractedBy
        Instant extractedAt
    }
    ExtractedValue {
        UUID caseId PK
        Integer valueIndex PK
        String attributePath
        String qualifier "or null; tells apart values that are not competing answers"
        String value "null when NOT_FOUND or AMBIGUOUS"
        String normalizedValue "in the dataType of its attribute"
        Enum verdict "FieldConfidence"
        JSON evidence "document, page and passage, only when GROUNDED"
        Integer competingValues "with AMBIGUOUS, the count only"
        UUID lineItemId FK "a value read from an invoice line"
        String extractedBy "model and prompt version"
        Instant extractedAt
    }
    ReferenceBinding {
        String packId
        String packVersion
        String attributePath
        Enum providerKind "ReferenceProviderKind"
        String providerId "logical, e.g. SYSTEM_OF_RECORD, COMPANY_REGISTRY"
        Enum authority "AUTHORITATIVE, CORROBORATING"
        JSON tolerance
        Boolean required
    }
    MasterDataValue {
        UUID id PK
        String attributePath
        String value
        String sourceSystem
        JSON businessKey
        Date validFrom
        Date validTo
        Instant retrievedAt
        JSON rawResponse
    }
    ReferenceSnapshot {
        UUID id PK
        Enum providerKind
        String providerId
        Enum sourceId "OPENFIGI, FIRDS, GLEIF, ZEFIX, UID, SIRENE, VIES, BAN, MARKET_DATA"
        String queryKey
        Date asOf
        JSON rawResponse
        String sourceVersion
        Instant retrievedAt
    }
    LineItem {
        UUID id PK
        UUID documentId FK
        Integer ordinal
        String articleReference
        String description
        Decimal quantity
        Decimal unitPrice
        Decimal amount
        String currency
        JSON provenance
    }
    LineMatch {
        UUID id PK
        UUID sourceLineItemId FK
        UUID targetLineItemId FK
        String strategyId
        Decimal confidence
        Enum matchKind "EXACT, FUZZY, SPLIT, MERGED, UNMATCHED"
        String confirmedBy
    }
    VerificationOutcome {
        UUID id PK
        String caseId
        String attributePath "with the qualifier, the value checked"
        String qualifier
        String checkedValue
        Enum checkKind "see the table below"
        Enum status "VerificationStatus"
        JSON comparedTo "MasterDataValue, ReferenceSnapshot or another ExtractedValue"
        JSON deviation
        JSON toleranceApplied
        String packId
        String packVersion
        String policyVersion
        Instant evaluatedAt
    }
Name Responsibility Status
AttributeDefinition one attribute of a pack: its path, type, master-data reference, whether and how it can be checked, its materiality planned
Extraction what the extraction leaves on a case: one value per attribute path and qualifier of the pack, and whether all are GROUNDED; an attribute the document does not carry is present as NOT_FOUND, never missing. Keyed by its case: a case has one current extraction, replaced whole when it is extracted again (8.19.6) built in part: the extraction result for a fixed set of fields (8.11.4); one row per value planned
ExtractedValue one datum: the value as it stands in the document, its derived verdict, and the page and passage, at most 300 characters, that confirm it. Two values of one path with different qualifiers are two data; with the same qualifier, one field answered twice. Keyed by its case and its position in the extraction, not by path and qualifier, since the qualifier may be empty (8.19.6) built in part: per fixed field, without normalizedValue
ReferenceBinding which source an attribute is checked against, how authoritative it is and with what tolerance planned
MasterDataValue a value of the system of record, as retrieved planned
ReferenceSnapshot an external register's answer, never overwritten and never queried again planned
LineItem, LineMatch an invoice's lines and their match against another document's; the match is a proposal the review confirms planned
VerificationOutcome one check of one value against one source; append-only planned
Case, DocumentRendition, SourceDocument, Finding drawn for their relations only; defined in 8.19.1 to 8.19.3 —

The rules that produce a datum — how candidates collapse, how the citation check grades them, when a field is empty — are the extraction rules (8.7). The case API carries an extraction as a flat list of datums keyed by attribute path (spec 339 (docs/specs/339-case-api.md)): the screen groups by the path's root, a new attribute is a new element rather than a new field of the payload, and the four verdicts are the same four strings on every element. The competing values behind AMBIGUOUS and the model's raw answer are never in it.

FieldConfidence Meaning
GROUNDED the cited passage is in the document, and the value is in the passage
UNSUPPORTED a value without a verifiable citation — kept, flagged, never counted as found
AMBIGUOUS more than one value; the field is empty, the count is kept
NOT_FOUND no value
VerificationStatus Meaning
CONFIRMED the source confirms within tolerance
CONTRADICTED the source contradicts
NOT_FOUND the source does not know the subject
UNAVAILABLE the source was not reachable — an operating state
NO_REFERENCE there is no comparison source at all — a property of the attribute
INCONCLUSIVE sources contradict one another

The two NOT_FOUNDs are different words in different vocabularies, kept apart in the glossary.

Enumeration Values Meaning
AttributeDefinition.dataType STRING, DECIMAL, PERCENT, BASIS_POINTS, DATE, CURRENCY_CODE, COUNTRY_CODE, IBAN, BIC, ISIN, EMAIL, BOOLEAN, ENUM how a value is normalised and checked
VerificationOutcome.checkKind MASTER_DATA_COMPARISON, EXTERNAL_REFERENCE, COMPUTATIONAL, CODE_LIST, CROSS_ATTRIBUTE, SELF_CONSISTENCY, PRIOR_DOCUMENT_COMPARISON what kind of check produced the outcome
ReferenceProviderKind MASTER_DATA, REGISTRY, COMPUTED, SELF, PRIOR_DOCUMENT where a comparison value comes from; PRIOR_DOCUMENT makes quotation against invoice, contract against addendum and contract against invoice one mechanism
DeviationCause FORMATTING, UNIT_OR_SCALE, ROUNDING, OUTDATED_MASTER_DATA, AMENDMENT_NOT_APPLIED, EXTRACTION_ERROR, AMBIGUOUS_WORDING, HOMONYM_MISMAPPED, AMBIGUOUS_MAPPING, TRANSPOSITION_OR_TYPO, LEGITIMATE_DIFFERENCE, UNKNOWN why a value deviates, as the assessment suspects it; a pack may add its own values
ConfidenceBand HIGH, MEDIUM, LOW how certain a reconciliation result is, against thresholds in the policy; never produced by the extraction, whose confidence is the verdict above; which record carries it is open

How a value is checked. A value can be checked in several ways at once, and each check is a VerificationOutcome of its own, with its own checkKind: a value that has a master-data counterpart and is also kept in a public register gets two outcomes, MASTER_DATA_COMPARISON and EXTERNAL_REFERENCE; a value the document repeats gets a SELF_CONSISTENCY outcome beside any other. The kinds of check are read off the enumerations above, none is added for them:

Kind of check AttributeDefinition.referenceability VerificationOutcome.checkKind ReferenceProviderKind
against master data INTERNAL_ONLY MASTER_DATA_COMPARISON MASTER_DATA
against an external source or by calculation EXTERNALLY_VERIFIABLE, COMPUTABLE EXTERNAL_REFERENCE, COMPUTATIONAL, CODE_LIST REGISTRY, COMPUTED
against the document itself — SELF_CONSISTENCY, CROSS_ATTRIBUTE SELF
against another document — PRIOR_DOCUMENT_COMPARISON PRIOR_DOCUMENT
no check against a source outside the document NO_REFERENCE — —

NO_REFERENCE means that no source outside the document applies — no master data, register or calculation — not merely that master data has no counterpart; a check against the document itself can still apply. An independent check beside the master-data one can show which side of a deviation is right; master data alone only shows that the two differ. The release stays a person's (8.19.3). Whether referenceability stays one value per attribute is open. Source: FeeCheck's check classes (docs/model/feecheck/attribute-list-verifiability.md §5, not published).

Extension points. Invoices add a document kind for invoices with populated LineItems, a snapshot of market data, a recalculation as a further checkKind, and an export adapter for the EMT/EET formats; none of these is in the model above. Further packs rely on packId and packVersion on every record of a run, ReferenceBinding with a logical providerId, ReferenceProviderKind with PRIOR_DOCUMENT, the Dossier, LineItem, LineMatch and a pack-scoped KnowledgeSource. Pack management, a load procedure with schema validation, a pack selector and layout variants in the review are not in the model.

8.19.6 The case's tables

The tables the aggregates of 8.11.3 are stored in: one table, or one table with its child tables, per aggregate, and the case's change log in a table of its own beside them; the overview's list and count read across them (MAC-5). How the case is locked, how its history is written and how migrations work is in 8.3.

erDiagram
    cases ||--|{ case_document_refs : "holds"
    case_document_refs ||--o| case_documents : "converted to"
    case_documents ||--o{ case_pages : "holds"
    cases ||--o| extractions : "extracted into"
    extractions ||--o{ extracted_values : "holds"
    cases ||--o{ case_changes : "changed by"
    cases {
        varchar id PK
        bigint version "optimistic locking"
        timestamptz created_at
        text last_changed_by "auditing: a person, or system"
        timestamptz last_changed_at "auditing"
        varchar stage
        integer attempts
        timestamptz lease_until
        boolean delivered
        varchar failure_cause
        text failure_reason
        text steps "the step strip, kept whole"
        text uploader
        varchar gate_decision
        varchar gate_label
        integer gate_contract
        integer gate_invoice
        integer gate_input_tokens
        integer gate_output_tokens
        text confirmed_by
        timestamptz confirmed_at
        text reported_by
        timestamptz reported_at
        text report_reason
        text deleted_by
        timestamptz deleted_at
    }
    case_document_refs {
        varchar case_id PK
        integer ref_index PK
        varchar document_id
        varchar role "MAIN, ATTACHMENT"
        text label
        text file_name
        timestamptz received_at
        boolean converted
    }
    case_documents {
        varchar id PK
        bigint version "tells save() a new row from a stored one"
        varchar case_id
        varchar language
        boolean language_mixed
        varchar language_warning
        text produced_by
        text structure "until the document database holds it"
    }
    case_pages {
        varchar document_id PK
        integer page_index PK
        text markdown
        text translation "all pages or none"
    }
    extractions {
        varchar case_id PK
        bigint version "tells save() a new row from a stored one"
        varchar pack_id
        varchar pack_version
        text extracted_by
        timestamptz extracted_at
        varchar failure
    }
    extracted_values {
        varchar case_id PK
        integer value_index PK
        varchar attribute_path
        varchar qualifier
        text value
        varchar verdict
        varchar document_id
        integer page
        text passage
        integer competing_values
    }
    case_changes {
        varchar id PK
        varchar case_id
        bigint version
        text actor "a person, or system"
        varchar event
        timestamptz at
    }
Table Aggregate Holds Status
cases Case the case's columns, one per property of the root and of its embedded value objects; version raised by every update, and an update whose version does not match changes nothing and is refused; last_changed_by and last_changed_at set on every save, for the overview built in another shape (the case database); this shape planned
case_document_refs Case one row per document of the case, its role, label and file name, and whether it is converted; written with the case, so the rule of one main document and the refusal after extraction hold in the case's transaction; converted is set in the case's own transaction once the document's conversion has been published (8.3) planned
case_documents, case_pages CaseDocument one row per converted document of a case: its version, the document's language, the converter's facts and the converter's structure, and one row per page with its translation, present on every page or on none; inserted once, when that document is converted case_pages built, keyed to the case rather than to a document; case_documents planned
extractions, extracted_values Extraction the case's current extraction, with its version, and one row per extracted value, replaced together when the case is extracted again planned
case_changes — (the case's change log) the change history, one row per domain event of a case, referencing the case by its ID; inserted by the case store in the transaction that saves the case and never updated, and not part of the case's aggregate (8.3) planned
event_publication — the outbox (8.16.3) built