openEHR to FHIR Data Type Mapping, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/openehr-fhir/data-type-mapping-ig/ and changes regularly. See the Directory of published versions
| Page standards status: Informative |
Coded values are the most structurally divergent area between the two type systems, and they carry the largest share of this guide's open decisions.
openEHR uses a small CODE_PHRASE — terminology_id, code_string, and an
optional preferred_term — which DV_CODED_TEXT wraps for clinical content and
which several other types use directly to anchor a code: DV_ORDINAL.symbol,
DV_SCALE.symbol, DV_STATE.value, and null_flavour. FHIR has Coding
(system, version, code, display, userSelected), CodeableConcept
(free text plus zero or more codings), and a code primitive for simple closed
value sets.
Most coded mappings have an external source of truth that applies equally in both models. A LOINC, SNOMED CT, or UCUM code is valid and means the same thing on either side; only the way the system is named differs.
SNOMED CT is the case that most often goes wrong. The HL7 guidance on
Using SNOMED CT with HL7 Standards
describes how system identifies the edition and version, and some code systems
embed a version in the URI itself. See
Cross-Cutting Concerns for the unresolved question of how
a FHIR system plus version is combined into a single openEHR
terminology_id.
The main concern raised by the terminology group is that if a system is
specified, it must preserve the uniqueness of the meaning the originating system
assigned.
Consider a facility-local procedure code PROC123 arriving with no system. A
mapping engine:
system when the scope of the issuer is understood and the system
is unique in that context — for example
http://example.org/facility/1111-1111-111-11/local-procedure-codes;system otherwise.Where a system is added, the engine SHALL ensure it is unique both for the
concept within the facility and for the meaning of the code. If another
facility uses PROC123 for a different procedure, or its mapping to a standard
system could ever differ, it must be a different system URI.
Different FHIR elements impose different requirements on cardinality, binding
target, binding strength (required, extensible, preferred, example), and
usage context. Implementers SHOULD consult the target element's binding before
deciding how to populate system, code, and display. The same applies in
reverse: openEHR archetypes and templates may constrain coded values to specific
terminologies.
system or code, moving into openEHRCODE_PHRASE.terminology_id and code_string are both mandatory. An incoming
FHIR Coding may populate neither.
system and code are absent, display SHOULD be mapped to
DV_TEXT.value rather than to DV_CODED_TEXT.DV_TEXT, injecting a default code system where the source is known, or
treating the value as an exception. This guide does not choose between
them — see Open Items.When a FHIR CodeableConcept carries several codings, the openEHR
defining_code is selected in this priority order:
userSelected = true;coding array.The working group has converged on treating FHIR userSelected as effectively
equivalent to openEHR defining_code for round-tripping purposes, while
recognising that the semantics are not strictly identical.
The third rule is a last resort. R5 says the "ordering of codings is undefined
and SHALL NOT be used to infer meaning", so a converter that falls back to it
reports the choice. The same rule applies outbound: userSelected claims that a
user chose the code, so it cannot mark an openEHR defining_code, and once
mappings add further codings nothing but their order says which one is the
defining code. Both directions are declared on the
DV_CODED_TEXT.defining_code[with-mappings] row below. A coding-purpose code
that would mark the defining code is the subject of HTA-170 on
Open Items.
CODE_PHRASE, DV_CODED_TEXT, TERM_MAPPING, and the null_flavour
correspondences. DV_ORDINAL and DV_SCALE are coded values but are mapped in
Quantities, because their FHIR target is driven by
their ordinal magnitude and both are archetype-scope mappings.
No ConceptMap resource, local CodeSystem, or local ValueSet is defined by
this guide. Terminology stays anchored in
terminology.hl7.org or in openEHR's own published
terminology. The correspondence tables here are the input to a later
concept-map pass, not a substitute for one.
See Conventions for how to read the tables.
| openEHR type | FHIR type | → FHIR | → openEHR | Maturity | Scope |
|---|---|---|---|---|---|
CODE_PHRASE | Coding | lossy | lossy | open | datatype |
DV_CODED_TEXT | CodeableConcept | Coding | lossy | lossy | open | datatype |
TERM_MAPPING | CodeableConcept.coding | lossy | lossy | open | datatype |
NULL_FLAVOUR | data-absent-reason | lossy | lossy | open | datatype |
Sources: openEHR RM — CODE_PHRASE · FHIR R5 — Coding · openEHR RM — TERMINOLOGY_ID
| openEHR field | FHIR target | → FHIR | → openEHR | Maturity | Notes |
|---|---|---|---|---|---|
CODE_PHRASE.terminology_id 1..1 | Coding.system | lossless | lossless | open | The identifier is carried verbatim in both directions. How a FHIR system plus version is combined into one terminology_id is not decided — see Coding.version below and Cross-Cutting Concerns. The reference implementation deliberately treats terminology_id as opaque, so no candidate format is adopted by accident. |
CODE_PHRASE.code_string 1..1 | Coding.code | lossless | lossless | open | The FHIR code type forbids leading, trailing, and repeated internal whitespace. openEHR places no character restriction on code_string, so a code carrying whitespace has no valid FHIR form. A change request proposing the matching restriction on the openEHR side is open. The openEHR attribute is mandatory and the FHIR element is optional, so an incoming instance that omits it cannot be converted: the reference implementation produces nothing rather than inventing a value. See the mandatory-attribute rule. |
CODE_PHRASE.code_string[whitespace] 1..1 | — no counterpart (inventory) | unmapped | unmapped | open | → FHIR: Nothing is produced: emitting the code anyway would publish an instance no FHIR validator accepts. A change request proposing the matching whitespace restriction on the openEHR side is open. (owner: openehr-modelling) → openEHR: A FHIR code never carries such a value, so the case never arises. (owner: openehr-modelling) A sub-case of CODE_PHRASE.code_string, split out the same way magnitude_status[~] is: the parent row keeps its lossless claim for every code that is a legal FHIR code, and this row states the exception where the round-trip matrix can police it. |
CODE_PHRASE.preferred_term 0..1 | Coding.display | lossless | lossless | settled | |
| — no counterpart (inventory) | Coding.version | unmapped | unmapped | open | → FHIR: Nothing is emitted, because the format for splitting a terminology_id back into system and version has not been chosen. (owner: working-group) → openEHR: The version is not carried. Three candidate formats for combining it into terminology_id are under discussion and none has been adopted: system|version (FHIR canonical style), system (version) (parenthetical), and system#version (FHIR package style). (owner: working-group) The reference implementation exposes the join and split as helpers that take the format as a required parameter with no default, so no test, render, or build can quietly bless one candidate. Some code systems embed the version in the URI instead, which side-steps the question entirely. |
| — no counterpart (inventory) | Coding.system[absent] | unmapped | unmapped | open | → FHIR: openEHR always has both, so the absent case never arises in this direction. (owner: working-group) → openEHR: An incoming Coding may populate neither. If both system and code are absent, display SHOULD become DV_TEXT.value rather than a DV_CODED_TEXT. If only one is absent the situation is inherently unsafe and needs local clinical informatics advice; the candidates are degrading to DV_TEXT, injecting a default system where the source is known, and treating the value as an exception. No default strategy is chosen here. (owner: working-group) This row is one of the two recorded exceptions to the mandatory-attribute rule. Because the working group has explicitly refused to decide what an absent system should become, the reference implementation substitutes the placeholder terminology_id unknown and reports the substitution at Coding.system[absent], so the conversion is lossy rather than silently lossless. An absent Coding.code gets no such treatment: code_string has no defensible placeholder, so nothing is produced at all. contract.test.ts pins both behaviours. |
{
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "http://snomed.info/sct"
},
"code_string": "271737000",
"preferred_term": "Anemia"
}
{
"system": "http://snomed.info/sct",
"code": "271737000",
"display": "Anemia"
}
Sources: openEHR RM — DV_CODED_TEXT · FHIR R5 — CodeableConcept · FHIR R5 — Coding
| openEHR field | FHIR target | → FHIR | → openEHR | Maturity | Notes |
|---|---|---|---|---|---|
DV_CODED_TEXT.value 1..1 | when the value is free text, or differs from the rubric of the defining code: CodeableConcept.text when the concept is carried as a bare Coding and the value equals the rubric of the defining code in the stated language: Coding.display | lossless | lossless | settled | DV_CODED_TEXT.value is mandatory. Where an incoming FHIR value supplies neither text nor a display, the rubric SHOULD be resolved from the code through a terminology server rather than left empty. |
DV_CODED_TEXT.defining_code 1..1 | CodeableConcept.coding | lossless | lossy | settled | → openEHR: drops CodeableConcept.coding.userSelected — openEHR has no field marking which coding a user chose; the flag is consumed to select defining_code and is not carried any further; Coding.version — openEHR has no separate version field and no format for combining system and version into terminology_id has been chosen, so the version is not carried — this conversion delegates to CODE_PHRASE ↔ Coding and carries that mapping’s drop forward rather than swallowing it When several codings are present, defining_code is chosen in this order: the terminology the openEHR template defines for the slot; the coding marked userSelected = true; the first coding in the array. The working group has converged on treating userSelected as effectively equivalent to defining_code for round-tripping, while recognising the semantics are not strictly identical. Falling back to the first coding infers meaning from order, which R5 forbids, and outbound nothing but order marks the defining code — both are reported on the [with-mappings] sub-case below. Whether the coding-purpose extension should mark the defining code instead is tracked as HTA-170. The openEHR attribute is mandatory and the FHIR element is optional, so an incoming instance that omits it cannot be converted: the reference implementation produces nothing rather than inventing a value. See the mandatory-attribute rule. |
DV_CODED_TEXT.defining_code[with-mappings] 1..1 | CodeableConcept.coding[unmarked] | lossy | lossy | open | → FHIR: drops DV_CODED_TEXT.defining_code[with-mappings] — which coding is the defining code — and so which are mappings — is carried only by position: it is emitted first, and R5 says the "ordering of codings is undefined and SHALL NOT be used to infer meaning". Setting userSelected would claim that a user chose the code, and the published coding-purpose code system has no code for a defining code (HTA-170) → openEHR: drops CodeableConcept.coding[unmarked] — several codings arrive and not exactly one is marked userSelected, so nothing in the instance says which is the defining code. Without a template naming the terminology, the first coding — the first marked one, if several are — is taken, which infers meaning from order as R5 says SHALL NOT be done, so the choice is reported The sub-case is split out so the round-trip matrix can police it: the parent defining_code row keeps its claim for a value with a single coding, where there is nothing to tell apart. It is open because the marker is: the coding-purpose extension, bound extensible on Coding, would carry it once a code exists, and HTA-170 asks for one. |
DV_CODED_TEXT.mappings 0..* | CodeableConcept.coding | lossy | lossy | open | → FHIR: drops DV_CODED_TEXT.mappings.match — the degree of equivalence has no element on Coding; it is expected to be retrievable from a terminology service through a ConceptMap instead; DV_CODED_TEXT.mappings.purpose — no representation has been chosen — see the TERM_MAPPING.purpose row — so nothing is emitted rather than a candidate being blessed by default → openEHR: drops TERM_MAPPING.match — each additional coding becomes one TERM_MAPPING, whose mandatory match a Coding cannot source. The composed conversion carries the inner drop forward: ? — the Reference Model’s "the kind of mapping is unknown" — is written and reported on this result too. See the TERM_MAPPING ↔ Coding rows Each additional coding becomes one TERM_MAPPING, produced by the registered TERM_MAPPING ↔ Coding converter rather than by a second copy of it. Because TERM_MAPPING.match is mandatory and a Coding has no degree of equivalence to source it from, an incoming coding is given the Reference Model’s own ? — "the kind of mapping is unknown" — and the substitution is reported. See TERM_MAPPING below. A conversion that delegates to CODE_PHRASE ↔ Coding carries that mapping’s drops forward rather than swallowing them, so a Coding.version or an absent Coding.system is reported on the composed result too; the rows that declare those drops are on CODE_PHRASE ↔ Coding. |
{
"_type": "DV_CODED_TEXT",
"value": "Anemia",
"defining_code": {
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "http://snomed.info/sct"
},
"code_string": "271737000",
"preferred_term": "Anemia"
}
}
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "271737000",
"display": "Anemia"
}
],
"text": "Anemia"
}
A CodeableConcept carrying two codings, the second marked userSelected. The
flag chooses the defining_code and is then consumed - it has no openEHR field to
live in, which is the loss this direction declares.
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "271737000",
"display": "Anemia"
},
{
"system": "http://hl7.org/fhir/sid/icd-10",
"code": "D64.9",
"display": "Anaemia, unspecified",
"userSelected": true
}
],
"text": "Anaemia, unspecified"
}
{
"_type": "DV_CODED_TEXT",
"value": "Anaemia, unspecified",
"defining_code": {
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "http://hl7.org/fhir/sid/icd-10"
},
"code_string": "D64.9",
"preferred_term": "Anaemia, unspecified"
},
"mappings": [
{
"_type": "TERM_MAPPING",
"match": "?",
"target": {
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "http://snomed.info/sct"
},
"code_string": "271737000",
"preferred_term": "Anemia"
}
}
]
}
Sources: openEHR RM — TERM_MAPPING · FHIR R5 — CodeableConcept · FHIR R5 — Coding
| openEHR field | FHIR target | → FHIR | → openEHR | Maturity | Notes |
|---|---|---|---|---|---|
TERM_MAPPING.target 1..1 | Coding.code | lossless | lossy | settled | → openEHR: drops Coding.version — openEHR has no separate version field and no format for combining system and version into terminology_id has been chosen, so the version is not carried — this conversion delegates to CODE_PHRASE ↔ Coding and carries that mapping’s drop forward rather than swallowing it The mapped term itself, carried exactly as CODE_PHRASE ↔ Coding describes. The openEHR attribute is mandatory and the FHIR element is optional, so an incoming instance that omits it cannot be converted: the reference implementation produces nothing rather than inventing a value. See the mandatory-attribute rule. |
TERM_MAPPING.match 1..1 | — no counterpart (inventory) | unmapped | lossy | settled | → FHIR: The >, =, <, and ? relationship is not carried in the instance. The working group decided it is retrievable from a terminology service and dropped the request for an instance-level representation. → openEHR: drops TERM_MAPPING.match — Coding carries no degree of equivalence, and TERM_MAPPING.match is 1..1. The Reference Model publishes a value for exactly this case — ?, "the kind of mapping is unknown" — so ? is written and reported, and no equivalence is asserted. Substituting = would claim the two terms are equivalent on no evidence, which the mandatory-attribute rule forbids The substitution is the third and last recorded exception to the mandatory-attribute rule, and it is on the published closed list. It is not a default: ? is the RM’s designated unknown, so writing it asserts nothing about the two terms, and the conversion is lossy rather than lossless because the value came from the mapping engine and not from the source. |
TERM_MAPPING.purpose 0..1 | — no counterpart (inventory) | unmapped | unmapped | open | → FHIR: No representation has been chosen. The candidates are adding the openEHR purpose values to the FHIR coding-purpose code system, and using openEHR’s own published term_mapping_purpose code system directly. Neither is adopted here, so nothing is emitted. (owner: working-group) → openEHR: Nothing arrives to map back, and the openEHR IG currently binds purpose with required strength, which is itself considered incorrect and has an open change request to relax it. (owner: openehr-modelling) openEHR publishes the value set at https://specifications.openehr.org/fhir/valueset-term_mapping_purpose with the codes public health, reimbursement, and research study. The alternate-codes extension has also been proposed, as a way of carrying the whole group of alternate codes on the concept rather than one purpose per coding. |
{
"_type": "TERM_MAPPING",
"match": "=",
"target": {
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "http://hl7.org/fhir/sid/icd-10"
},
"code_string": "D64.9",
"preferred_term": "Anaemia, unspecified"
}
}
{
"system": "http://hl7.org/fhir/sid/icd-10",
"code": "D64.9",
"display": "Anaemia, unspecified"
}
Sources: openEHR — Support Terminology, null flavours · FHIR R5 — missing data and the data-absent-reason extension · THO — data-absent-reason · THO — v3 NullFlavor
| openEHR field | FHIR target | → FHIR | → openEHR | Maturity | Notes |
|---|---|---|---|---|---|
NULL_FLAVOUR.defining_code.terminology_id 1..1 | CodeableConcept.coding.system | lossless | lossless | settled | Fixed on each side: openEHR’s own openehr terminology, and http://terminology.hl7.org/CodeSystem/data-absent-reason. No local code system or value set is defined by this guide; both sides are cited to their own publisher. |
NULL_FLAVOUR.defining_code.code_string 1..1 | CodeableConcept.coding.code | lossy | lossy | open | → FHIR: drops NULL_FLAVOUR.defining_code.code_string — openEHR 271 (no information) has no data-absent-reason equivalent and falls back to unknown, which conflates it with 253; a request to add no information to the FHIR code system has not been made → openEHR: drops CodeableConcept.coding.code — the data-absent-reason code system is broader than openEHR’s null-flavour set, so every code but unknown, masked, and not-applicable is assigned to one of the four openEHR codes by a semantic choice, and the distinction it drew is not carried 253 (UNK, unknown) ↔ unknown, 272 (MSK, masked) ↔ masked, and 273 (NA, not applicable) ↔ not-applicable are exact. 271 (NI, no information) has no exact counterpart and is the one problematic code outbound. Inbound, the other codes are assigned by the working group’s semantic choice, not by hierarchy: asked-unknown, temp-unknown, not-asked, not-a-number, negative-infinity, positive-infinity, and not-performed → 253; asked-declined and not-permitted → 272; unsupported → 273; as-text and error → 271. THO’s hierarchy disagrees in places — asked-declined is a child of unknown; not-a-number and the two infinities are children of error, which is assigned 271; not-performed, not-permitted, and unsupported are top-level — and the choices are kept pending the re-review recorded on Open Items. |
NULL_FLAVOUR.value 1..1 | CodeableConcept.text | lossless | lossless | settled | The rubric. NULL_FLAVOUR.value is mandatory in openEHR, so where FHIR supplies no text it SHOULD be resolved from the code through a terminology server. The four openEHR rubrics are fixed by the openEHR terminology, so the reference implementation supplies the rubric of the assigned code. |
ELEMENT.null_flavour 0..1 | when the absent value is an Observation.value[x]: Observation.dataAbsentReasonwhen the absent value is any other element: Element.extension[data-absent-reason]† (extension) | lossless | lossless | settled | archetype scope: which of the two homes applies is decided by the element the value would have occupied, not by the data type. Observation.dataAbsentReason is a first-class element; everywhere else the generic extension is used. data-absent-reason is the current guidance, confirmed against national IGs. |
| — no counterpart (inventory) | Element.extension[iso21090-nullFlavor]† (extension) | unmapped | unmapped | open | → FHIR: data-absent-reason is the current guidance and is what this guide emits; no openEHR value produces the v3 NullFlavor extension. (owner: working-group) → openEHR: An incoming v3 NullFlavor extension is not read: the reference converter reads data-absent-reason, and reports the extension as not consumed. (owner: openehr-modelling) openEHR intends to support both FHIR value sets, with the back-transformation keyed on which code system is present. When it is read, the v3 hierarchy is deeper than openEHR’s: NI and INV (with its children DER, OTH, UNC, NINF, PINF) all collapse onto 271, and UNK with ASKU, NASK, NAVU, QS, TRC, and NAV all collapse onto 253. MSK → 272 and NA → 273 are direct. NP (not present) is retired and message-layer only, and is out of scope. |
{
"_type": "DV_CODED_TEXT",
"value": "masked",
"defining_code": {
"_type": "CODE_PHRASE",
"terminology_id": {
"value": "openehr"
},
"code_string": "272"
}
}
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
"code": "masked"
}
],
"text": "masked"
}