Laboratory Service — Domain Model
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD
1. Aggregates
1.1 Accession
The root aggregate for a single laboratory work order. Groups specimens and results under one accession number.
| Invariant | Rule |
|---|---|
| Unique accession number | Generated at creation; {tenantShortCode}-{YYYYMMDD}-{seq6} format |
| Cannot release without verification | At least one result must be in verified status before release |
| Cancellation preserves history | Status → canceled; sub-entities retain full audit chain |
| Critical ack required | Any result with criticalFlag=true must have a recorded acknowledgment before chart release |
State machine:
1.2 LabResult
A single analyte result within an Accession. Owned by the Accession aggregate.
| Invariant | Rule |
|---|---|
| Immutable once released | Any change creates a new version; prior version status = superseded |
| Critical flag enforcement | Value crossing threshold sets criticalFlag=true; requires ack before release |
| Unit/code required | testCode + unit mandatory for numeric results |
| Correction chain | Each correction references priorResultId and supplies correctionReason |
State machine:
1.3 ResultAcknowledgment
Clinician acknowledgment of a released result. Lives in the results sub-domain.
| Invariant | Rule |
|---|---|
| One ack per clinician per result version | Idempotent on duplicate submission |
| Ack types | reviewed, forwarded, plan-documented, patient-notified |
| Escalation trigger | Critical unacked results escalate after configurable timeout per site policy |
2. Entities
| Entity | Key attributes | Aggregate |
|---|---|---|
Specimen | id, accessionId, type, status, collectedAt, receivedAt, collectorId, condition | Accession |
TestCatalogItem | id, name, loincCode?, specimenType, panel?, components[], referenceRanges[], tenantId? | Catalog (independent) |
CriticalValuePolicy | id, testCode, lowCritical?, highCritical?, facilityId?, tenantId | Config (independent) |
3. Value Objects
| Value Object | Fields | Rules |
|---|---|---|
AccessionNumber | value: string | Unique per tenant per day |
ResultValue | quantity?: number, unit?: string, text?: string, boolean?: boolean | One of quantity/text/boolean required |
ReferenceRange | low?, high?, unit?, ageRange?, sex?, text? | At least one bound or text |
AbnormalFlag | enum N | L | H | LL | HH | A | AA | Maps to FHIR ObservationInterpretation |
SpecimenCondition | enum satisfactory | unsatisfactory | hemolyzed | lipemic | clotted | Drives processing path |
LabPriority | enum routine | urgent | stat | Drives worklist sort order |
4. Domain Events
| Event name | Trigger | Key payload fields |
|---|---|---|
LabAccessionCreated | Accession opened | accessionId, patientId, orderId?, priority, tenantId |
LabSpecimenCollected | Collection recorded | accessionId, specimenId, collectedAt, collectorId, tenantId |
LabSpecimenReceived | Lab receipt confirmed | accessionId, specimenId, receivedAt, tenantId |
LabResultEntered | Value entered | accessionId, resultId, testCode, tenantId |
LabResultVerified | Tech verified | accessionId, resultId, verifiedBy, tenantId |
LabResultReleased | Released to chart | accessionId, resultId, patientId, fhirObservationId, tenantId |
LabCriticalValueTriggered | Critical threshold crossed | accessionId, resultId, patientId, testCode, value, tenantId |
LabResultAcknowledged | Clinician ack | resultId, ackType, ackBy, tenantId |
LabResultCorrected | Correction applied | resultId, priorResultId, correctionReason, tenantId |
LabAccessionCanceled | Accession canceled | accessionId, reason, tenantId |
5. Ubiquitous Language
| Term | Definition |
|---|---|
| Accession | A laboratory work order grouping specimens and tests for one patient visit |
| Accession number | Unique ID printed on specimen labels; traceable from collection through release |
| Bench | Physical or logical grouping of analyzers/technologists (Chemistry, Hematology, etc.) |
| Critical value | A result outside a threshold indicating immediate patient risk; requires urgent notification |
| Panel | A set of related tests ordered and reported together |
| Reference range | Expected value interval for an analyte, potentially age/sex/location adjusted |
| TAT | Turnaround time — interval from accession creation to result release |
| Verification | Technologist review and sign-off making a result eligible for release |
| Release | Making verified results available to the clinical chart |
| Correction | Revision to a verified/released result creating a new version |
| Worklist | Prioritized queue of pending tests for a bench or technologist |
| LOINC | Logical Observation Identifiers Names and Codes — standard lab test coding |
| UCUM | Unified Code for Units of Measure |