Skip to main content

Terminology Service — Domain Model

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD


1. Aggregate: Concept

Root entity. A Concept represents a single coded clinical term within a terminology system (LOINC, SNOMED CT, RxNorm, ICD-10-CM, or a tenant-scoped custom system). It is the fundamental unit of meaning throughout the platform.

Attributes

AttributeTypeNotes
idstringULID, prefix CON_
systemstringURI of the code system (e.g., http://loinc.org)
codestringThe code value within the system
displaystringHuman-readable name
definitionstring | nullFull definition text
activebooleanFalse for retired/deprecated codes
tenantIdstring | nullnull = global (all tenants); non-null = tenant-scoped
versionnumberOptimistic lock
createdAtDateImmutable
updatedAtDateUpdated on deactivation or display correction

Invariants

  • (system, code) is unique when tenantId IS NULL (global concepts)
  • (tenantId, system, code) is unique when tenantId IS NOT NULL (tenant-scoped)
  • Only platform admins may create/update/deactivate global concepts
  • Tenant admins may only manage concepts scoped to their own tenant
  • Only active = true concepts are returned by search, lookup, expand, and validate operations (BR-TERM-001)
  • code and system are immutable after creation; only display, definition, and active may be updated

State Machine

active = true → active = false (deactivation only; no re-activation via API)

Deactivation is a one-way transition. Concepts are never deleted; deactivated concepts are retained for audit and backward reference.


2. Aggregate: DrugInteraction

Encodes a pairwise drug-drug interaction relationship between two RxNorm drug codes.

Attributes

AttributeTypeNotes
idstringULID, prefix DI_
drug1CodestringRxNorm code
drug2CodestringRxNorm code
severityInteractionSeverityCONTRAINDICATED | HIGH | MODERATE | LOW
descriptionstringClinical explanation of the interaction
sourcestringKnowledge source identifier (e.g., multum, drugbank)
activebooleanAllows disabling specific interaction records
versionnumberOptimistic lock
createdAtDateImmutable

Invariants

  • The pair (drug1Code, drug2Code) is symmetric in search (querying A+B returns interactions for A-B and B-A)
  • severity must be one of: CONTRAINDICATED, HIGH, MODERATE, LOW (ordered highest to lowest risk)
  • source must reference a known licensed data source identifier (validated at import time)
  • Pairwise interactions with active = false are excluded from interaction-check responses

3. Read Model: DrugClass

A read-only reference table mapping RxNorm drug codes to their pharmacological class(es).

Attributes

AttributeTypeNotes
idstringULID, prefix DC_
rxnormCodestringRxNorm code
classNamestringDrug class name (e.g., beta-blocker, ACE inhibitor)
classSystemstringSource classification system (e.g., NDF-RT, MED-RT)
activeboolean

Used by FR-TERM-005 (drug class lookup) and FR-TERM-011 (duplicate therapy detection: two drugs sharing at least one className are flagged as potential duplicates).


4. Read Model: DrugContraindication

A read-only reference table mapping RxNorm drug codes to contraindicated ICD-10-CM conditions.

Attributes

AttributeTypeNotes
idstringULID, prefix DCI_
rxnormCodestringRxNorm code of the drug
icd10CodestringICD-10-CM code of the contraindicated condition
severityContraindicationSeverityABSOLUTE | RELATIVE
descriptionstringClinical rationale
activeboolean

Used by FR-TERM-012 (drug-condition contraindication checks).


5. Read Model: ValueSet

A named collection of concept codes, used for FHIR ValueSet/$expand operations.

Attributes

AttributeTypeNotes
idstringULID, prefix VS_
urlstringCanonical ValueSet URL
namestringHuman-readable name
statusstringactive | retired
tenantIdstring | nullScope; null = global
conceptIncludesValueSetInclude[]{system, concepts[]} or {system, filter}
versionstringSemantic version

6. Domain Events

EventTriggerPayload summary
TerminologyConcept.CreatedAdmin creates a conceptconceptId, system, code, display, tenantId
TerminologyConcept.DeactivatedAdmin deactivates a conceptconceptId, system, code, reason
TerminologyDataset.UpdatedBulk terminology import completesimportJobId, systemsUpdated[], conceptsAdded, conceptsDeactivated

7. Value Objects

Value ObjectDescription
CodingSystemValidated URI for a known terminology system
ConceptCodeTrimmed, non-empty string; max 50 chars
InteractionSeverityEnum: CONTRAINDICATED | HIGH | MODERATE | LOW
ContraindicationSeverityEnum: ABSOLUTE | RELATIVE

8. Ubiquitous Language

TermDefinition
ConceptA single coded term with a system, code, display, and active flag
Global conceptA concept with tenantId = null; visible to all tenants
Tenant conceptA concept scoped to a specific tenant; not visible to other tenants
Active conceptactive = true; returned by all public query operations
Deactivated conceptactive = false; retired from use but retained for audit
ValueSet expansionThe resolved list of active concept codes matching a ValueSet URL
Drug classA pharmacological classification for a drug (e.g., beta-blocker)
Drug interactionA pairwise CDS signal between two drug codes with a severity level
Duplicate therapyTwo or more prescribed drugs sharing at least one drug class
ContraindicationA drug-condition pair where the drug is unsafe given the patient's condition
LOINCLogical Observation Identifiers Names and Codes — standard for lab tests and observations
SNOMED CTSystematized Nomenclature of Medicine — Clinical Terms
RxNormNLM standard for medication codes
ICD-10-CMInternational Classification of Diseases, 10th revision
$lookupFHIR operation: exact code lookup returning display and status
$validate-codeFHIR operation: confirms a code is active in a system
$expandFHIR operation: returns the concept list for a ValueSet URL
$translateFHIR operation: maps a code from one system to another via ConceptMap
ETL pipelineThe data operations process that loads licensed terminology files into the database
Offline snapshotA pre-loaded, self-contained terminology database included in facility-node deployments