6. EHR and composition
Requirement prefix: E6.
Where these invariants come from#
As in §3, the rendered RM page omits its class-definition
tables. They were read from the Release 1.0.2 publication (EHR Information
Model, Rev 5.1.1, 16 Aug 2008, §4.7, §5.4, §8.3) and the EHR amendment record
checked for every change since: releases 5.1.2 through 5.2.1 changed
documentation, added EHR.folders, and added tags. None altered the invariants
below.
EHR#
- E6.1
EHRMUST holdOBJECT_REFs to its status, access settings, compositions, contributions, and folders — not the objects themselves. A composition is a versioned object, and an EHR that embedded them would embed the whole record. - E6.2
EHR.directoryMUST be the first element offolders, and setting folders from an empty list MUST be refused rather than leaving the two disagreeing.
EHR_STATUS#
- E6.3
is_modifiableandis_queryableMUST be independent flags. - E6.3a An
EHR_STATUSMUST be an archetype root (Is_archetype_root). One withoutarchetype_detailscannot say which archetype shaped it, so nothing downstream can validate it against one. - E6.4 Documentation MUST state that deactivation —
is_modifiable = false, on death, merge, migration, or opt-out — normally leaves the record queryable, because the history stays clinically and legally live. Code that treats deactivation as deletion removes a record law requires be retained. - E6.5
EHR_STATUS.subjectMUST be aPARTY_SELF, permitting an anonymous record (M5.16).
COMPOSITION#
- E6.6
categoryMUST come from the openEHRcomposition_categorygroup, and the constructor MUST take a code rather than aDV_CODED_TEXT. - E6.6a A
COMPOSITIONMUST be an archetype root (Is_archetype_root), for the reason given inE6.3a. - E6.6b A persistent composition MUST NOT carry an
EVENT_CONTEXT(Is_persistent_validity: is_persistent implies context = Void). A persistent composition is a running summary across many encounters — a problem list, a medication list — so attaching one encounter's context asserts that the whole list belongs to that visit. The specification states this twice: as a formal invariant, and in prose as "Persistent Compositions do not have an Event context." - E6.7
languageandterritoryMUST be required. A composition that does not say what language it was recorded in cannot be safely rendered or translated. - E6.7a openEHR additionally requires
languageandterritoryto be drawn from thelanguagesandcountriescode sets (Language_valid,Territory_valid). This crate does not enforce either: both are external code sets, and resolving them is out of scope (S1.10). The codes are carried opaquely and checked only forCODE_PHRASEwell-formedness. Declared here rather than left as a silent gap (C0.12). - E6.8
contentMUST admit bothSECTIONand everyENTRYsubclass, and the serialized form MUST be one flat_typedispatch rather than a nested one. A nested encoding makes a reader buffer the whole subtree per level. - E6.9 A traversal reaching every
ENTRYhowever deeply nested in sections MUST be provided. An entry three sections deep is exactly as clinically significant as one at the top. - E6.10
SECTIONMUST be documented as navigational: moving an entry between sections must not change what it says, and software deriving meaning from section membership breaks at the next template revision.
EVENT_CONTEXT#
- E6.11
settingMUST come from the openEHRsettinggroup. - E6.12
end_timeMUST be refused when it is established to be beforestart_time, and MUST be accepted when the two are not comparable (D3.14), with validation reporting rather than the constructor guessing. - E6.12a
locationMUST be absent or non-empty (location_valid). A present-but-empty location is indistinguishable from an absent one to every reader.
Entries#
- E6.13 The five entry classes —
OBSERVATION,EVALUATION,INSTRUCTION,ACTION,ADMIN_ENTRY— MUST be modelled, with theENTRYattributes shared and theCARE_ENTRYattributes shared among the four clinical ones. - E6.14 An entry's
subjectMUST be explicit at construction. An entry that is about a family member and does not say so reads as a finding about the patient, and that error is invisible in every rendering. - E6.15
ADMIN_ENTRYMUST be distinguishable from theCARE_ENTRYsubclasses, because a research extract that keeps clinical entries and drops administrative ones is making a defensible cut and one that cannot tell them apart is not. - E6.16
OBSERVATION.dataMUST be aHISTORYeven for a single reading, as openEHR requires. That is what makes a one-off blood pressure and a continuous arterial trace the same shape. - E6.17
EVALUATIONMUST NOT have aHISTORY. An evaluation is an opinion held at the moment of recording; superseding it is a new version, not a new event.
Instructions and actions#
- E6.18
INSTRUCTION.narrativeMUST be required, and MUST be documented as the human-readable order rather than a summary of the activities. A narrative generated from structured activities records what the software understood, not what the prescriber meant. - E6.19
INSTRUCTION.activitiesMUST be non-empty. - E6.20
ACTIVITY.action_archetype_idMUST be carried as a pattern, not parsed as an archetype id: openEHR writes/.*/when any action will do, and validating it as an id would reject the commonest value there is. - E6.21
ISM_TRANSITION.current_stateMUST come from the openEHRinstruction_statesgroup andtransitionfrominstruction_transitions. - E6.22 Terminal states MUST be identifiable, so that an
ACTIONrecorded against an already-completed order can be flagged. - E6.23
INSTRUCTION_DETAILS.activity_idMUST be non-empty: an action that names the instruction but not the activity cannot say which step of a three-times-daily order it fulfilled.
Folders#
- E6.24
FOLDERMUST hold references, so that more than one folder tree can classify the same composition without duplicating it.