openEHR to FHIR Data Type Mapping
0.1.0 - ci-build International flag

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

Cross-Cutting Concerns

Page standards status: Informative

Cross-cutting concerns

Some questions are not about any one data type. They apply across the whole mapping, and answering them once here keeps the per-type tables from repeating themselves — or, worse, from answering them inconsistently.

Handling empty values

One aspect that does not appear to completely align, is the handling of empty values.

openEHR

In openEHR the ELEMENT class always contains Null_flavour and null_reason attributes

ELEMENT value : DATA_VALUE [0..1] null_flavour : DV_CODED_TEXT [0..1] null_reason : DV_TEXT [0..1]

Where an ELEMENT is made mandatory, the value remains optional, but with the rule that if `value' is empty, 'null_flavour must be populated.

Invariant: Inv_null_flavour_valid: is_null() implies null_flavour /= Void

Some openEHR formats like FLAT, do allow empty values like

FLAT: .../smoker|value = '' but the CDR strips out the whole node and does not persist it at all.

FHIR

In FHIR the data value itself is optional and the reason for absence is handled by an extension optional

"_flag": {
  "extension": [{
    "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
    "valueCode": "unknown"
  }]
}

Some resources have explicit dataAbsentReason elements For example, Observation.value[x] is 0..1, and missing values go in Observation.dataAbsentReason. Invariant obs-6 says it is present only if value[x] is absent. So for an Observation you would normally use this instead of the extension.

There are 15 codes from FHIR R4 (4.0.1) onwards. In R4B and R5 the code system is published in HL7 Terminology (THO), which currently lists CodeSystem version 2.0.0 (THO release 7.4.0) with the same 15 codes and none deprecated.

Canonical URL: http://terminology.hl7.org/CodeSystem/data-absent-reason

Code Display Parent
unknown Unknown —
asked-unknown Asked But Unknown unknown
temp-unknown Temporarily Unknown unknown
not-asked Not Asked unknown
asked-declined Asked But Declined unknown
masked Masked —
not-applicable Not Applicable —
unsupported Unsupported —
as-text As Text (value is only in the narrative) —
error Error —
not-a-number Not a Number (NaN) error
negative-infinity Negative Infinity (NINF) error
positive-infinity Positive Infinity (PINF) error
not-performed Not Performed —
not-permitted Not Permitted —

That's 9 top-level codes and 6 child codes. The hierarchy matters for mapping, because each child rolls up to its parent.

STU3 (3.0.x) was different. It had only 10 codes with different spellings, under the old canonical http://hl7.org/fhir/data-absent-reason:

  • unknown, asked, temp, not-asked, masked, unsupported, astext, error, NaN, not-performed
  • asked-declined, not-applicable, the infinity codes and not-permitted didn't exist yet.
  • If you have STU3-era data, map asked→asked-unknown, temp→temp-unknown, astext→as-text and NaN→not-a-number.

A rough mapping to the 4 openEHR null flavours:

  • 253 unknown: unknown and its children asked-unknown, temp-unknown, not-asked and asked-declined.
  • 272 masked: masked.
  • 273 not applicable: not-applicable.
  • 271 no information: the rest (unsupported, as-text, error and its children, not-performed, not-permitted).

Some codes are borderline: asked-declined arguably fits 271 better than 253. To keep the original detail, carry the DAR code as a mapping on null_flavour or put it in null_reason.

Summary

Although there are some subtle structural differences, the FHIR and openEHR approach to empty values/ nulls is very similar.

THe main difference is FHIR's more extensive DAR and list and nested terms (not supported in openEHR) and that openEHR has an additonal null_reason Text/CodedText attribute, though this is almost certainly largely unused.

Both FHIR and openEHR commonly add terms like 'unknown' or 'not applicable' to Valuesets, so the use of DAR/null_flavours is intended for situations where

openEHR options for discussion.

  1. Maintain the existing openEHR Codeset binding and map incoming FHIR codes to the more limited codes, carrying the original FHIR terms as TERM_MAPPINGS.

  2. Allow the FHIR Valueset to be used directly as an extensible binding. Use the opportunity to revisit how we handle some 'null' situations e.g. Observation exclusions e.g Observation absentReason in OBSERVATION.event..data RECOMMENDED Option.

  3. Is null_reason used, should it be deprecated or better used in openEHR.

FHIR options for discussion

  1. ? Add a Data absent reasonText CodeableConcept to DataAbsentReason for situations like

"_flag": { "extension": [{ "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason", "valueCode": "not-performed" "reasonText: "Too unwell to complete the test" }] }

Terminology URI and terminology_id

FHIR names a terminology system with a full URI — http://snomed.info/sct. openEHR names one with a shorter identifier string in CODE_PHRASE.terminology_id. A URI maps to an identifier and back without difficulty; what does not yet have an answer is what to do with a version.

FHIR carries Coding.version as a separate element. openEHR has no separate version field, so a version has to be folded into terminology_id — and three formats are under discussion:

Option Form Example
A — pipe system|version http://hl7.org/fhir/encounter-status|5.0.0
B — parenthetical system (version) http://hl7.org/fhir/encounter-status (5.0.0)
C — hash system#version http://hl7.org/fhir/encounter-status#5.0.0

The trade-offs, as the working group stated them:

  • The pipe is the FHIR canonical convention and is what search parameters use, which makes it familiar. Against it: the pipe is also used, variably, to separate a code from its text rubric, so a reader may misread it.
  • The parenthetical is unambiguous to a human and is unlikely to collide with anything else in a system URI. Against it: it is not a convention either standard already uses, and the space makes it fiddly to parse.
  • The hash is what FHIR implementation guides use for package versions, which is a closer analogy than the search syntax. Against it: # already has a meaning in a URI, as a fragment separator.

No option is adopted here. The reference implementation exposes the join and the split as helpers that take the format as a required parameter with no default value, and the registered converters do not call them at all — they treat terminology_id as opaque. That is deliberate: no test, render, or build can quietly bless a candidate the working group has not chosen.

Some code systems side-step the question entirely by embedding the version in the URI itself, as SNOMED CT does with http://snomed.info/sct/900000000000207008/version/20240101. The HL7 guidance on using SNOMED CT describes how a system identifies the edition and version.

Character encoding

FHIR mandates UTF-8 throughout and has no element recording the character set of a value, because there is only one.

openEHR permits several through its character_sets code system — UTF-8, UTF-16, US-ASCII, the ISO-8859 family, and UTF-7 among them.

The rule is therefore one-directional and settled: the sender converts. Non-UTF-8 content SHALL be converted to UTF-8 before mapping, and the original encoding is not preserved on the FHIR side. DV_TEXT.encoding is unmapped for this reason, and the row says so. Where a charset applies to attached binary content rather than to text — DV_MULTIMEDIA.charset — it is carried as the MIME type's charset parameter, which R5's contentType includes — see Other Data.

The DV_AMOUNT pattern

The name is a convenience: the six attributes below are not all declared on DV_AMOUNT. They arrive along an inheritance chain — DV_ORDERED → DV_QUANTIFIED → DV_AMOUNT → DV_QUANTITY — and the table names the class that actually declares each one, because that is where a citation has to point. DV_QUANTITY, DV_COUNT, DV_PROPORTION, and DV_DURATION all inherit them, and they follow one mapping pattern regardless of the concrete subtype:

Inherited property Declared on FHIR counterpart Scope
magnitude_status DV_QUANTIFIED Quantity.comparator, or the per-type equivalent datatype
accuracy DV_AMOUNT The quantity-accuracy extension, whose value[x] is a Quantity datatype
accuracy_is_percent DV_AMOUNT The unit of that accuracy Quantity — UCUM % when true, except where the magnitude's own unit is % datatype
normal_range DV_ORDERED Observation.referenceRange with type = normal archetype
other_reference_ranges DV_ORDERED Observation.referenceRange with type ≠ normal archetype
normal_status DV_ORDERED Observation.interpretation archetype

The last three are only meaningful at the FHIR resource level, not on the data type. Anything carrying a normal_range or a normal_status in openEHR maps to an Observation in FHIR, and this guide marks those rows archetype scope rather than pretending they are data-type mappings.

Two consequences follow. accuracy is rarely used in practice, and where it is, accuracy_is_percent is carried as the unit of the accuracy Quantity: UCUM % when the flag is true, and the magnitude's own unit when it is false. That rule has exactly one blind spot, and it is an ordinary clinical one — a magnitude whose own unit is already %, such as an SpO₂ or a haematocrit. Both readings then produce the identical instance, so a conversion SHALL NOT derive accuracy_is_percent from an incoming accuracy on a %-unit quantity, and SHALL leave the flag absent instead: reading ±2 percentage points as ±2 % of 45 gives ±0.9, a different number stated as though it were the same one. The accuracy magnitude still carries; the flag does not, and the sub-case is published as a gap on Quantities. And openEHR binds normal_status to its own normal_statuses code system with required strength, which is narrower than FHIR's extensible binding on Observation.interpretation; a change request to relax the openEHR binding is open.

The two ISO 8601 subsets

Both standards use ISO 8601. They do not use the same subset of it.

The table below is generated directly from the capability table in the reference implementation that the converters themselves consult, so the guide and the code cannot disagree about it. A ✓ means the standard accepts the form; a — means it does not.

FormExampleopenEHRFHIRMapping rule
Full date, extended form
(date)
2026-03-01✓✓Carried unchanged.
Full date, compact form
(date)
20260301✓—SHALL be expanded to the extended form before mapping to FHIR.
Year and month only
(date)
2026-03✓✓Carried unchanged. The FHIR lexical form is truncated to match the source precision, never padded — padding invents a day the source did not record.
Year and month, compact form
(date)
202603✓—SHALL be expanded to 2026-03.
Year only
(date)
2026✓✓Carried unchanged.
Full time, extended form
(time)
14:30:00✓✓Carried unchanged.
Full time, compact form
(time)
143000✓—SHALL be expanded to 14:30:00. openEHR writes a compact time as hhmmss, with no T designator — T separates the date from the time in a date-time and nowhere else — and FHIR time accepts only the extended form.
Hours and minutes only
(time)
14:30✓—FHIR time requires seconds. The value SHALL be completed to 14:30:00, which adds a precision the source did not state and is a named drop.
Compact time, hours and minutes only
(time)
1430✓—SHALL be expanded to 14:30 and then completed to 14:30:00. Neither the compact form nor a seconds-less time is a FHIR time, and the completion adds a precision the source did not state, so it is a named drop.
Hours only, compact form
(time)
14✓—SHALL be completed to 14:00:00. valid_iso8601_time publishes hh as a partial form and FHIR time requires both minutes and seconds, so the completion adds two levels of precision the source did not state and is a named drop of its own.
Fractional seconds, 3 digits
(time)
14:30:00.123✓✓Carried unchanged.
Fractional seconds, up to 9 digits
(time)
14:30:00.123456789—✓openEHR restricts fractional seconds to 3 digits. Excess precision SHALL be truncated when mapping FHIR → openEHR, and that is a named drop.
Time with a UTC offset
(time)
14:30:00+01:00✓—FHIR time cannot carry a time zone, and no extension rescues it: the timezone extension is a code required-bound to the IANA zone names, and a UTC offset is neither a zone name nor derivable from one. The time of day is carried and the offset is a named drop. Where the offset matters, the value SHOULD be mapped to a dateTime, which carries one directly.
Compact time with a compact UTC offset
(time)
143000+0100✓—SHALL be expanded to 14:30:00+01:00 before the offset is separated from the time; FHIR accepts neither the compact time nor the compact offset, and then has no home for the offset at all.
Compact time with an hours-only UTC offset
(time)
143000+01✓—valid_iso8601_time writes the compact offset as ±hh[mm], so the minutes are optional. The value SHALL be expanded to 14:30:00+01:00 before the offset is separated; the offset then has no home on a FHIR time and is a named drop.
Full date and time in UTC
(dateTime)
2026-03-01T14:30:00Z✓✓Carried unchanged. A fully precise UTC value MAY use FHIR instant.
Full date and time, compact form
(dateTime)
20260301T143000Z✓—SHALL be expanded to the extended form before mapping to FHIR.
Full date and time with a UTC offset
(dateTime)
2026-03-01T14:30:00+01:00✓✓Carried unchanged. Unlike time, dateTime does carry an offset.
Date and time without seconds
(dateTime)
2026-03-01T14:30✓—FHIR dateTime requires seconds once a time is present. The value SHALL be completed to 2026-03-01T14:30:00, which adds a precision the source did not state and is a named drop. FHIR additionally requires a UTC offset alongside the time: that offset SHALL come from the source or its context and is never invented by a data-type conversion.
Compact date and time without seconds
(dateTime)
20260301T1430✓—SHALL be expanded to 2026-03-01T14:30 and then completed to 2026-03-01T14:30:00, which is a named drop. This form also states no UTC offset, which FHIR requires once hours and minutes are present and which a data-type conversion never invents, so nothing is produced from it.
Date and time to the hour only
(dateTime)
2026-03-01T14✓—valid_iso8601_date_time publishes YYYY-MM-DDThh as a partial form. FHIR requires seconds once a time is present, so the value SHALL be completed to 2026-03-01T14:00:00 and that completion is a named drop. The completed value states hours and minutes and no UTC offset, which FHIR also requires and which a data-type conversion never invents, so nothing is produced from it.
Compact date and time to the hour only
(dateTime)
20260301T14✓—SHALL be expanded to 2026-03-01T14 and then completed to 2026-03-01T14:00:00, which is a named drop. As with the extended form, the completed value states no UTC offset and nothing is produced from it.

Three rules carry most of the weight:

  • Compact forms SHALL be expanded before mapping to FHIR. openEHR permits 20250301 and T143000; FHIR requires 2025-03-01 and 14:30:00.
  • Partial precision SHALL be preserved by truncating, never by padding. 202604 becomes 2026-04. Padding it to 2026-04-01 invents a day the source did not record. The one place the rule cannot apply is a time stated to the minute: FHIR time requires seconds, and dateTime requires them once a time is present, so 14:30 SHALL be completed to 14:30:00 and the added precision is a named loss rather than a silent one.
  • Fractional seconds truncate from nine digits to three when mapping FHIR → openEHR. That is a named drop, not a rounding decision.

Validation expectations

Validation is not mapping. Validating an instance against an archetype, a template, a profile, or a terminology binding is the responsibility of the receiving system, not of the mapping engine.

Consider a DV_INTERVAL whose upper bound is below its lower bound. Three things could happen: the openEHR system could reject it before mapping, the mapping engine could reject it, or the mapping engine could faithfully produce the equally invalid FHIR instance. The working group's resolution is the third: validation is out of scope entirely, data is mapped as it is found, and systems should validate before mapping where they can.

A mapping engine SHOULD report what it could not carry — that is what the Issue list in the reference implementation is for — and SHOULD NOT be expected to enforce the target model's constraints.

This guide therefore describes information loss, not conformance failure. The two are different, and conflating them would make every mapping table an assertion about systems this guide has no view of.

Bindings and expectations, moving into FHIR

Different FHIR elements impose different requirements on cardinality, binding target, binding strength (required, extensible, preferred, example), and usage context, including conditional bindings and jurisdictional rules. Implementers SHOULD consult the target element's binding before deciding how to populate system, code, and display.

Where a core FHIR element carries a required binding that an openEHR value cannot satisfy, the mapping fails at that element rather than degrading silently. Identifying which elements those are needs an archetype-by-archetype review, and this guide recommends that the core-specification cases be published with guidance for implementation-guide authors and jurisdictions.

Bindings and expectations, moving into openEHR

The same applies in reverse, and is easy to overlook because openEHR expresses its constraints somewhere else. Archetypes and operational templates constrain coded values to specific terminologies, constrain units, and constrain cardinalities — the equivalents of a FHIR profile's bindings and slicing.

Two consequences matter for mapping:

  • The template decides the defining_code. Where an openEHR template names the terminology for a slot, that terminology takes precedence over userSelected in choosing which incoming coding becomes the defining_code. A data-type converter cannot see the template, so it can only apply the second and third rules; a template-aware engine SHOULD apply the first.
  • A required binding on the openEHR side can be narrower than its FHIR counterpart. normal_status is the worked example: openEHR's binding is required and FHIR's Observation.interpretation is extensible, so a legitimate FHIR value can have nowhere to land. Where that happens, the guide records it as a lossy direction and names the change request, rather than quietly widening the openEHR binding on paper.

Process and recommendations

Moving content into FHIR, the recommended order of work is: identify the target element and read its binding; decide the target type from the element definition rather than from the openEHR source type; map the value; and report everything that could not be carried, naming the source path. Do not produce an extension for a field this guide records as unmapped — an invented extension is worse than a recorded gap, because it looks like conformance.

Moving content into openEHR, the recommended order is: establish which archetype and template the value is destined for, because they decide the terminology and the units; map the value; supply the mandatory openEHR fields that FHIR leaves optional, and record which ones were supplied rather than carried; and treat an inference — a defaulted TERM_MAPPING.match or an inferred DV_PROPORTION.type — as exactly that.

In both directions, the guide's fidelity columns are the contract: a lossless row round-trips, and a lossy row drops exactly what it says it drops.

See Conventions for the fidelity and maturity vocabulary, and Open Items for who owns each unresolved question.