8.11 Domain model¶
The case and what happens to it in the terms of domain-driven design: the subdomains, the bounded
contexts and how they relate, the aggregates and value objects each context keeps, and the domain
events within and between them. The same things as entities with their keys and relations, and the
tables the case is stored in, are the entity model; a business model's concrete
attributes are its business data model in docs/model/feecheck/data-model.md, which is not published.
What AI may and may not do in this model is 8.1.
8.11.1 Subdomains¶
FeeCheck's parts sorted by how much each matters.
| Kind | Meaning |
|---|---|
| core | what makes FeeCheck worth building: its own model, and most of the effort |
| supporting | needed and specific to FeeCheck, but not what sets it apart |
| generic | a solved problem, taken as it comes or bought |
| Subdomain | Kind | Bounded context or system |
|---|---|---|
| Data extraction — the values a document states, each with the passage it was read from | core | extraction |
| Reconciliation — a document's values against master data, references and other documents, every deviation classified | core | reconciliation |
| Document intake — a received document made readable and checked | supporting | intake |
| Case management and review — the case, its stages and the decisions a person takes | supporting | cases |
| Document conversion | generic | docling-serve |
| Language models | generic | the model provider |
| Sign-in | generic | signin and the identity provider |
| Assistance — questions and answers about the application and a case | generic | assistance |
8.11.2 Context map¶
Each module with a domain ring of its own is a bounded context: its own model and its own language, published to the others only through its named interfaces (8.16.2). An arrow points from upstream to downstream, the direction the model flows, not the data; its label names the relationship pattern, upstream's side first, as in the DDD Crew's context mapping cheat sheet. A line without an arrow is the shared kernel, which has no direction.
flowchart LR
docling["docling-serve<br/>[External system]"]:::external
model["Model provider<br/>[External system]"]:::external
master["Master-data system<br/>[External system]"]:::external
registers["External registers<br/>[External system]"]:::external
intake["intake<br/>[Bounded context]"]:::built
extraction["extraction<br/>[Bounded context]"]:::built
cases["cases<br/>[Bounded context]"]:::built
reconciliation["reconciliation<br/>[Bounded context]"]:::planned
assistance["assistance<br/>[Bounded context]"]:::planned
kernel["kernel<br/>[Shared kernel]"]:::built
docling -->|ACL| intake
model -->|ACL| extraction
intake -->|PL / CF| extraction
intake -->|PL / ACL| cases
extraction -->|PL / ACL| cases
reconciliation -.->|PL / CF| cases
master -.->|ACL| reconciliation
registers -.->|ACL| reconciliation
cases -.->|PL / CF| assistance
extraction -. SK .- kernel
kernel -. SK .- reconciliation
classDef person fill:#ffe8b0,stroke:#9a6b00,color:#000
classDef built fill:#b7e4c7,stroke:#2d6a4f,color:#000
classDef planned fill:#c6dcff,stroke:#1168bd,stroke-dasharray:4 3,color:#000
classDef external fill:#e6e6e6,stroke:#6b6b6b,color:#000
| Colour | Meaning |
|---|---|
| green | built |
| blue, dashed | planned |
| grey | external |
| Label | Pattern | Meaning |
|---|---|---|
| arrow | upstream → downstream | the upstream's model shapes the downstream's, not the other way round |
| PL | published language | the upstream publishes its model as documented types others may use |
| CF | conformist | the downstream takes the upstream's model as it is, without translating it |
| ACL | anticorruption layer | the downstream translates the upstream's model into its own at the border |
| SK | shared kernel | a small model two contexts share and change only together |
| Name | Kind | Responsibility | Status |
|---|---|---|---|
intake |
bounded context | makes a received document readable and checks that it may be processed (5.2.1) | built |
extraction |
bounded context | reads a document's data out of its rendition, each value with its passage (5.2.1) | built |
cases |
bounded context | owns the case, its state, its results and its history (5.2.1); the queue's consumer runs its stages and has no model of its own | built |
reconciliation |
bounded context | checks a document's recorded values against master data, references and other documents and turns the result into findings (5.2.1) | planned |
assistance |
bounded context | answers questions about the application and a case, from evidence only (ADR-0002 (docs/adr/adr-0002-assistance.md)) |
planned |
kernel |
shared kernel | small value types more than one module uses (ADR-0007 (docs/adr/adr-0007-shared-kernel-of-value-types.md)) |
built, empty so far |
| docling-serve, model provider, master-data system, external registers | external systems | 5.2.1, 3.2 | external |
mcp, signin and webapp are adapters with no model of their own
(8.15.7) and are not drawn.
| Upstream → downstream | Pattern | What it rests on | Status |
|---|---|---|---|
docling-serve → intake |
ACL | the converter port and the docling adapter turn docling's document into the rendition (8.15.4, ADR-0004 (docs/adr/adr-0004-document-conversion-docling.md)) |
built |
model provider → extraction |
ACL | one parser for every model adapter; an answer is validated against the schema and its citations checked before it reaches the domain (8.7, 8.17) | built |
intake → extraction |
PL, CF | extraction reads intake's published rendition as it is (8.16.2) | built |
intake → cases |
PL, ACL | the case translates intake's rendition into its own CaseDocument and the gate's verdict on the case (8.11.3) |
built as a conformist: today's case keeps intake's rendition and verdict as they are; the translation planned |
extraction → cases |
PL, ACL | the case translates the extraction's result into its own Extraction, one ExtractedValue per value (8.11.3) |
built as a conformist: today's case keeps the extraction's result as it is; the translation planned |
reconciliation → cases |
PL, CF | reconciliation defines what a finding is; the case requests the check and takes the findings as they are, through the stage's request and reply events (8.16.3) | planned |
master-data system, external registers → reconciliation |
ACL | a system is an adapter behind a port and appears in the model only as a source value (8.19.5, ADR-0001 (docs/adr/adr-0001-verification-modules-and-adapters.md)) |
planned |
cases → assistance |
PL, CF | the assistance reads the case file in the case's own terms, filtered by permission, and writes nothing (8.19.4) | planned |
extraction, reconciliation |
SK | the page reference moves into the kernel when verification uses it (ADR-0007 (docs/adr/adr-0007-shared-kernel-of-value-types.md)) |
planned |
8.11.3 The case's aggregates¶
The case and what belongs to it as DDD building blocks, with optimistic locking for people and a
change history (spec 653 (docs/specs/653-case-persistence-milestone.md), MAC-1, MAC-3, MAC-4).
Each aggregate is what the store loads and saves as a whole; the tables they are stored in are
8.19.6. Intake and extraction keep no aggregate of their
own: they are pipelines of value objects (8.11.4),
and what they produce is kept by the case.
A case holds one main document and the documents it incorporates — terms and conditions, annexes, schedules: together one business document, extracted and reviewed as a whole. A document that stands on its own, such as an addendum signed later or an invoice, is a case of its own in the dossier (8.19.1). Documents come with the upload or are added later, until the extraction is requested; each passes the integrity check and the conversion itself, and an added document takes the case back to conversion. The document-type gate classifies the main document only, and its verdict decides the case's kind. The case knows its documents by reference, so that it can hold the rule of one main document and refuse a document once the case is extracted; each document's converted content is an aggregate of its own.
Four rules hold for the aggregates:
- One aggregate, one repository, one transaction. An aggregate is loaded and saved whole by its own repository; another aggregate refers to it by its ID, never by an object reference. A transaction writes one aggregate, and another aggregate catches up through a domain event in a transaction of its own; the case's history, which is not an aggregate, is the one exception (8.3).
- The case is versioned. Every change to a case raises its version. A person's action carries the version the person saw and is refused when the case has moved on since; the screen warns before that. The pipeline keeps its lease and its row lock, which order the stages among themselves; the version orders people against the pipeline and against each other.
- What is written once is not part of the case. A document's pages and the extraction's values are aggregates of their own, written whole and never changed in place; the history's entries are the case's change log beside it. A transition of the case neither rewrites nor reloads any of them.
- Each transition the table of the case's own events names raises its domain event (8.11.6), published in the transaction that saves the aggregate (8.16.3). The case collects its events, and the case store writes one history entry per event in the transaction that saves the case (8.3). Beside it, the case itself carries who changed it last and when, set on every save, so the overview shows it without reading the history.
classDiagram
direction LR
class Case {
<<aggregate root>>
CaseId id
long version
Instant createdAt
Actor lastChangedBy
Instant lastChangedAt
CaseStage stage
int attempts
Lease lease
boolean delivered
Failure failure
Steps steps
PersonId uploader
List~DocumentRef~ documents
GateVerdict gate
Confirmation confirmation
ClassificationReport report
Deletion deletion
}
class DocumentRef {
<<value object>>
DocumentId id
DocumentRole role
String label
FileName fileName
Instant receivedAt
boolean converted
}
class CaseDocument {
<<aggregate root>>
DocumentId id
long version
CaseId caseId
DocumentLanguage language
String producedBy
String structure
List~Page~ pages
translated() boolean
}
class Page {
<<entity>>
int index
String markdown
String translation
}
class Extraction {
<<aggregate root>>
CaseId caseId
long version
String packId
String packVersion
String extractedBy
Instant extractedAt
ExtractionFailure failure
List~ExtractedValue~ values
complete() boolean
}
class ExtractedValue {
<<value object>>
String attributePath
String qualifier
String value
FieldConfidence verdict
DocumentId document
Integer page
String passage
int competingValues
}
class CaseChange {
<<change log entry>>
CaseChangeId id
CaseId caseId
long version
Actor actor
String event
Instant at
}
class Lease {
<<value object>>
Instant until
}
class Failure {
<<value object>>
FailureCause cause
String reason
}
class GateVerdict {
<<value object>>
Decision decision
String label
int contractIndicators
int invoiceIndicators
TokenUsage usage
}
class DocumentLanguage {
<<value object>>
String code
boolean mixed
Warning warning
}
class Deletion {
<<value object>>
PersonId by
Instant at
}
class Actor {
<<value object>>
PersonId person
boolean system
}
Case *-- "0..1" Lease
Case *-- "0..1" Failure
Case *-- "1..*" DocumentRef
Case *-- "0..1" GateVerdict
Case *-- "0..1" Deletion
CaseDocument *-- DocumentLanguage
CaseDocument *-- "*" Page
Extraction *-- "*" ExtractedValue
CaseChange *-- Actor
CaseDocument ..> Case : caseId
DocumentRef ..> CaseDocument : id
Extraction ..> Case : caseId
CaseChange ..> Case : caseId
| Name | Module | Building block | Responsibility | Status |
|---|---|---|---|---|
Case |
cases |
aggregate root | one business document — a main document and its attachments — on its way through the stages: its stage, the attempts and the lease of the stage running, whether the queue has delivered its waiting stage, why it failed or was blocked, the step strip, who opened it, its documents by reference, the document-type gate's verdict on its main document, a person's confirmation or report, and its deletion; its version for optimistic locking, and who changed it last and when. It holds only its own state; the full view of a case, with its documents' pages and its extraction, is assembled in the application layer from the aggregates, and no transition reloads the pages | built in part: today one record holds the case's state — with the converted rendition and the extraction's result inside it — its steps, its uploader and file name, a confirmation and a report; the aggregate's shape planned |
CaseStage |
cases |
value object (enumeration) | where the document work stands — queued, converting, converted, extraction queued, extracting, extracted, extraction failed, failed or blocked — as one column the overview filters on | planned |
FailureCause |
cases |
value object (enumeration) | why a case failed or was blocked, in a form a person can act on and never document content: the file is not a PDF or has too many pages, the converter or the queue failed, the document is gone, the document is of a kind FeeCheck does not handle, or the model call failed, spent its budget or gave no usable answer | built |
Confirmation, ClassificationReport |
cases |
value objects | a person's confirmation of a document's kind where the document-type gate could not settle it; a reviewer's report, with a reason, that a document the gate blocked is of a kind FeeCheck handles after all | built, the person named by e-mail; as a PersonId planned |
Lease, Failure, Steps, FileName, Deletion |
cases |
value objects | the lease of the running stage; a failure's cause and reason; the step strip, kept whole as one text value, its step names an enumeration; a safe file name; who deleted the case and when (ADR-0016 (docs/adr/adr-0016-case-retention.md)) |
built in part: the lease, the failure and the step strip, inside today's case; FileName and Deletion as values planned |
DocumentRef |
cases |
value object | one document of the case: its ID, its role, a label for an attachment ("terms and conditions", "annex 2"), its safe file name, when it was received, and whether it is converted — so the case itself decides when all its documents are | planned |
DocumentRole |
cases |
value object (enumeration) | MAIN, exactly one per case, or ATTACHMENT, any number |
planned |
GateVerdict |
cases |
value object | the document-type gate's verdict on the main document's first pages — its decision, label and indicator counts and the tokens the call used — kept on the case because the overview filters on it, and kept for a blocked case, which has no CaseDocument |
built in part: today the case keeps intake's published verdict inside its state; as the case's own value planned |
CaseId, DocumentId, PersonId, CaseChangeId |
cases |
value objects (identifiers) | the case's random ID, assigned when its first PDF is received; a document's random ID, assigned when its PDF is received; a person by the verified e-mail of the session; a history entry's ID | planned |
CaseDocument |
cases |
aggregate root, written once | one converted document of the case: its language, its pages, the converter that produced it and the document's structure as the converter found it, until the document database holds that (ADR-0018 (docs/adr/adr-0018-postgresql-authoritative-document-database-derived.md)); keyed by the document's ID and written when that document is converted. The language decides the translation: every page carries its English translation when the language is neither en nor und, otherwise none, and never only some (spec 377 (docs/specs/377-document-language.md), spec 368 (docs/specs/368-translation-port.md)); translated says which. With the case's DocumentRef and, for the main document, the case's GateVerdict, it holds what intake's Rendition carries |
planned |
Page |
cases |
entity of CaseDocument |
one page, by its index: its markdown and, when the document is translated, its English translation | planned |
DocumentLanguage |
cases |
value object of CaseDocument |
the document's dominant language as a code, whether the text is mixed, and the warning a reviewer sees — none for English, not English, or not supported (spec 377 (docs/specs/377-document-language.md)) |
planned |
Extraction |
cases |
aggregate root | the case's current extraction, read over all its documents: the business model and version it was read for, who read it and when, a failure when the model answer was not usable, and one ExtractedValue per value; replaced whole when the case is extracted again; a value read from an attachment counts like one from the main document, and different values for one attribute across documents leave it AMBIGUOUS (8.7); complete derived as every value GROUNDED (8.19.5) |
planned |
ExtractedValue |
cases |
value object | one value as 8.19.5 defines it, with its attribute path, qualifier, verdict and evidence — the document, the page and the passage; the case API's flat list of datums reads these (spec 339 (docs/specs/339-case-api.md)) |
planned |
CaseChange |
cases |
entry of the case's change log, not an aggregate; written once | one entry of the case's change history: which version of the case, who — a person, or the system for a pipeline step — what happened, by the domain event's name, and when; what changed in detail is not kept. It references its case by ID and is inserted by the case store, through an insert-only repository of its own, in the transaction that saves the case (8.3) | planned |
Actor |
cases |
value object | a person, or the system; the actor of a history entry and of the case's last change | planned |
CaseStore |
cases |
repository port | the case's store: the only way to save a case, writing its history with it; the overview's list and count become a query port of their own | built in part: the port the PostgreSQL and the stub store implement, with the overview's list and count still on it; the history and the query port planned |
8.11.4 The intake's and the extraction's value objects¶
Intake and extraction keep no aggregate of their own (8.11.3): each takes a value and returns one, and what it returns is kept by the case. What they return is their published language — value objects the module publishes to the others (8.16.2). The claim is what the model may say; the result is what survived the citation check against the rendition (8.7).
classDiagram
direction LR
namespace intake {
class Rendition {
<<value object>>
List~String~ pages
String producedBy
String structure
DocumentLanguage language
GateVerdict gate
Translation translation
}
class DocumentLanguage {
<<value object>>
}
class GateVerdict {
<<value object>>
}
class Translation {
<<value object>>
}
}
namespace extraction {
class ExtractionClaim {
<<value object>>
candidates per attribute
}
class ExtractionCandidate {
<<value object>>
String value
String evidence
}
class ExtractionResult {
<<value object>>
one field per attribute
ExtractionFailure failure
}
class ExtractedField {
<<value object>>
String value
FieldConfidence confidence
PageReference page
String passage
int competingValues
}
}
Rendition *-- DocumentLanguage
Rendition *-- GateVerdict
Rendition *-- Translation
ExtractionClaim *-- "*" ExtractionCandidate
ExtractionClaim ..> Rendition : checked against
ExtractionResult *-- "*" ExtractedField
| Name | Context | Building block | Responsibility | Status |
|---|---|---|---|---|
Rendition |
intake |
value object, published | the converter's page-anchored markdown, one string per page, with the language found, the document-type gate's verdict and the English translation made at intake | built |
GateVerdict |
intake |
value object, published | the first-pages document-type gate: pass, soft block or hard block — or unchecked, or failed when the gate's call could not run — the label, the indicator counts and the tokens the call used | built |
DocumentLanguage, Translation |
intake |
value objects, published | the language found and the warning a reviewer sees; the English translation made at intake | built |
ExtractionClaim, ExtractionCandidate |
extraction |
value objects, published | what the model may answer: per attribute a list of candidates, each with the passage it was read from; the schema the answer is validated against is generated from it (8.17) | built for a contract's attributes |
ExtractionResult, ExtractedField |
extraction |
value objects, published | what survived the check: per attribute one value or none, its derived FieldConfidence, and the page and passage when the document confirms it (8.19.5); which attributes a kind of document has, and how they group, is the business data model's |
built for a contract's attributes |
8.11.5 The review's and the assistance's aggregates¶
The records of the review (8.19.3), of the verification (8.19.5) and of the assistance (8.19.4) cut by the rules of the case's aggregates (8.11.3): what a person changes in one transaction is one aggregate, what is written once is its own, and an aggregate refers to another only by its ID. Their attributes are in the entity model; the diagram draws only the IDs between them.
classDiagram
direction LR
class ReviewCase {
<<aggregate root>>
ReviewCaseId id
long version
CaseId caseId
DossierId dossierId
ReviewState state
}
class Finding {
<<entity>>
FindingId id
String attributePath
Severity severity
FindingReason reason
List~VerificationOutcomeId~ outcomes
}
class Correction {
<<entity>>
CorrectionId id
String correctedValue
PersonId correctedBy
}
class Decision {
<<entity>>
DecisionOutcome outcome
PersonId decidedBy
PersonId fourEyesBy
}
class Dossier {
<<aggregate root>>
DossierId id
}
class VerificationOutcome {
<<aggregate root>>
VerificationOutcomeId id
CaseId caseId
String attributePath
String qualifier
String checkedValue
Source comparedTo
}
class MasterDataValue {
<<aggregate root>>
MasterDataValueId id
}
class ReferenceSnapshot {
<<aggregate root>>
ReferenceSnapshotId id
}
class MatchAssessment {
<<aggregate root>>
MatchAssessmentId id
ReviewCaseId reviewCaseId
FindingId finding "or none, for the whole review"
}
class AssessmentRationale {
<<value object>>
}
class AuditEntry {
<<aggregate root>>
CaseId caseId
ReviewCaseId reviewCaseId "or none"
}
class ComparisonReport {
<<aggregate root>>
ReviewCaseId reviewCaseId
}
class AssistantInteraction {
<<aggregate root>>
CaseId caseId
List~KnowledgeSourceId~ cited
}
class KnowledgeSource {
<<aggregate root>>
KnowledgeSourceId id
}
ReviewCase *-- "*" Finding
Finding *-- "*" Correction
ReviewCase *-- "0..1" Decision
MatchAssessment *-- "0..1" AssessmentRationale
ReviewCase ..> Dossier : dossierId
Finding ..> VerificationOutcome : outcomes
VerificationOutcome ..> MasterDataValue : comparedTo
VerificationOutcome ..> ReferenceSnapshot : comparedTo
MatchAssessment ..> ReviewCase : reviewCaseId
AuditEntry ..> ReviewCase : reviewCaseId
ComparisonReport ..> ReviewCase : reviewCaseId
AssistantInteraction ..> KnowledgeSource : cited
| Name | Context | Building block | Responsibility | Status |
|---|---|---|---|---|
ReviewCase |
reconciliation |
aggregate root, versioned | one review of a case, from reconciliation to release: what a reviewer works on and releases together; versioned like the case, so a person's change made on an outdated view is refused | planned |
Finding, Correction |
reconciliation |
entities of ReviewCase |
one reason for a person to look, per attribute; a person's corrected value for it; each with an ID, because an assessment and the assistance refer to a finding | planned |
Decision |
reconciliation |
entity of ReviewCase |
the release or rejection, by a person, with the four-eyes approver; none until the review is decided | planned |
Dossier |
cases |
aggregate root | the business case; bundles cases and review cases, which refer to it by its ID | planned |
VerificationOutcome |
reconciliation |
aggregate root, written once | one check of one extracted value against one source; it names the value by its case, attribute path and qualifier and keeps the value as checked, so a new extraction, which replaces the values, leaves it intact | planned |
MasterDataValue, ReferenceSnapshot |
reconciliation |
aggregate roots, written once | a value of the system of record, an external register's answer, each as retrieved and never changed | planned |
MatchAssessment |
reconciliation, or the module that makes the findings' model calls (open) |
aggregate root, written once | the advisory level for a finding or the whole review, with the AssessmentRationale that explains it |
planned |
AuditEntry |
cases |
aggregate root, written once | one entry of the append-only audit trail of a case — intake checks, triage, admission, review, assistance — keyed by its case, and by its review case when it belongs to one | planned |
ComparisonReport |
reconciliation |
aggregate root, written once | a report a review produces | planned |
AssistantInteraction |
assistance |
aggregate root, written once | one question and its answer, with what it cites | planned |
KnowledgeSource |
assistance |
aggregate root, versioned with its pack | one entry of the knowledge base | planned |
AttributeDefinition and ReferenceBinding are a pack's configuration
(8.10), not aggregates of a case.
8.11.6 Domain events¶
Two kinds. The stage requests, replies and facts between the bounded contexts are the event catalogue of 8.16.3; the diagram draws them along the context map. The case's own events name what happened to one case and feed its change history, in the same transaction that saves the case (8.11.3, rule 4); the table below lists them.
flowchart LR
channel["Another intake channel<br/>[External system]"]:::external
intake["intake<br/>[Bounded context]"]:::built
extraction["extraction<br/>[Bounded context]"]:::built
cases["cases<br/>[Bounded context]"]:::built
reconciliation["reconciliation<br/>[Bounded context]"]:::planned
assessment["The module that makes the model calls<br/>[Bounded context]"]:::planned
downstream["Downstream systems<br/>[External system]"]:::external
channel -.->|DocumentReceived| cases
cases -.->|"DocumentCheckRequested<br/>ClassificationRequested<br/>ConversionRequested"| intake
intake -.->|"DocumentChecked, DocumentBlocked<br/>DocumentClassified<br/>DocumentConverted, ConversionRejected"| cases
cases -.->|ExtractionRequested| extraction
extraction -.->|"AttributesExtracted<br/>ExtractionRejected"| cases
cases -.->|ReconciliationRequested| reconciliation
reconciliation -.->|"FindingsCreated<br/>ReconciliationRejected"| cases
cases -.->|AssessmentRequested| assessment
assessment -.->|FindingsCommented| cases
cases -.->|"ContractRecorded<br/>FindingsPublished"| downstream
classDef person fill:#ffe8b0,stroke:#9a6b00,color:#000
classDef built fill:#b7e4c7,stroke:#2d6a4f,color:#000
classDef planned fill:#c6dcff,stroke:#1168bd,stroke-dasharray:4 3,color:#000
classDef external fill:#e6e6e6,stroke:#6b6b6b,color:#000
| Colour | Meaning |
|---|---|
| green | built |
| blue, dashed | planned |
| grey | external |
| Name | Role in the flow | Status |
|---|---|---|
cases |
requests each stage's work and receives its reply; the only context that publishes facts out of a case | built; its events planned |
intake, extraction, reconciliation, the module that makes the model calls |
answer a stage's request with a reply or a rejection | intake, extraction built, their events planned; the others planned |
| another intake channel, downstream systems | bring a document in as a fact; receive a recorded document — ContractRecorded for a contract — and the published findings |
external |
Each event's kind, publisher, consumer and status are in the catalogue of
8.16.3; a dotted edge is an event not yet published. The edge from
extraction to cases shows the case engine's target; as built, cases publishes the reply.
The case's own events. Each names what happened to a case; its actor is what the history records.
| Event | Raised when | Actor in the history | Status |
|---|---|---|---|
CaseOpened |
a PDF is received and its case created | the uploader | planned |
DocumentAdded |
a person added a document to a case not yet extracted | the person | planned |
CaseConverted |
the converter delivered the pages of every document | system | planned |
CaseBlocked |
the page limit, the queue or the document-type gate stopped the case | system | planned |
CaseFailed |
a stage gave up | system | planned |
DocumentTypeConfirmed |
a person confirmed the kind of a main document the gate could not settle | the person | planned |
CaseReleased |
a person released a blocked case, with a reason — the document is of a kind FeeCheck handles after all | the person | planned |
ExtractionRequested |
a person asked for the extraction; the same event is the stage request to extraction |
the person | planned |
CaseExtracted |
the extraction delivered its values: the case advanced on the extraction's AttributesExtracted |
system | planned |
ExtractionFailed |
the extraction gave up: the case advanced on the extraction's ExtractionRejected |
system | planned |
CaseDeleted |
a reviewer or an approver deleted the case, or its uploader cancelled the intake | the person | planned |
A stage taking its lease, giving the case back to the queue, or a step starting changes the case and raises its version, so a person's open screen is warned; the history keeps the events above and leaves those out. The screen learns of a new version by asking for the case again; a channel that pushes the change to the screen is not part of this model.
Events also carry the work between the case's own aggregates, because a transaction writes only one
of them: a document's converted content is saved with its event, and the case marks that document
converted on the event in a transaction of its own; the extraction is saved with its
AttributesExtracted or ExtractionRejected, and the case advances on it the same way. How that is made reliable and safe to repeat is
8.3.