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 |
Every fidelity claim in this guide is backed by runnable code. The separate reference implementation repository holds a TypeScript mapping ledger and a set of reference converters, together with the tests that substantiate what the mapping tables assert. Their source is maintained independently of this guide's committed publication inputs.
A mapping table that says lossless is an assertion. A mapping table generated
from a ledger whose lossless rows must round-trip a paired instance unchanged
— and whose lossy rows must drop exactly what they claim to drop, no more
and no less — is a checked statement.
That is the whole point of the reference implementation. It is not a product.
The same converters and the same ledger this page describes also run as a hosted single page:
Four things are worth knowing before you paste anything into it:
When a conversion leaves something behind, each dropped field links back to the mapping row that declares the loss.
The mapping tables on the category pages are generated from the external RI's ledger and committed in sentinel-delimited managed regions in the guide's markdown source. The worked examples are the test fixtures the converters are exercised against at the corresponding RI revision. These committed tables and examples are not automatically synchronized with the RI's current source or the hosted converter.
The tables on Gaps and Open Items are not generated: they are maintained by hand in this guide, and the RI neither renders nor checks their content. Page-wide presentation and link checks still apply. Conventions says how editors keep them in step.
Generated regions remain owned by the RI's ledger and renderer, not by hand edits in this repository. The RI's documented authoring and compatibility process includes rendering and drift checking; an updated guide is reviewed separately. Every guide region has an external renderer definition, and every renderer output has a guide home. Publishing the committed guide needs no RI checkout and runs none of those implementation checks.
Every converter returns a result carrying three things: the value it produced, the fidelity it actually achieved, and one issue per piece of information it could not carry across, each naming the path it came from. A converter does not throw for a mapping-level problem — an unmappable field is data, not an exception.
The issue paths are the join between the code and the ledger. A converter that drops a field the ledger does not list, or fails to drop one it does, fails the test suite.
A converter never invents a value for an attribute the target standard
declares mandatory. Where the source has nothing to fill one — a FHIR
Quantity carrying only a comparator, a Coding with no code, an
Attachment with no contentType — the converter returns unmapped, produces
no value at all, and names the absent source path. Substituting a zero, an
empty string, or a default code and reporting lossless would publish an
instance that claims to be a valid DV_QUANTITY, CODE_PHRASE, or
DV_MULTIMEDIA while carrying a value nobody sent. The rule and its two
recorded exceptions are stated in full under
the mandatory-attribute rule, and
the external RI's reference/test/contract.test.ts holds every converter to it.
A converter that composes another carries the inner result's issues forward, so a declared drop cannot vanish behind a composition boundary. The same test file pins that in both directions.
The openEHR side uses the canonical openEHR JSON form, with the _type
discriminator naming the Reference Model class. The FHIR side uses ordinary FHIR
JSON — including the places where that is not the obvious JavaScript value:
integer64 is serialised as a JSON String, because FHIR R5 says so "due to
issues with precision in floating point libraries", and this implementation
publishes the format R5 has rather than the one that would be convenient.
One limitation of this code, which is not a mapping fact. The openEHR side
of a numeric primitive is a JSON number, and a JavaScript number represents
integers exactly only up to ±(253 − 1). A FHIR integer64 beyond
that range is read as the nearest representable value. Nothing in either
standard makes that a loss — Integer64 and integer64 have the same range —
so it is stated here rather than published as a ledger row.
Citations to the FHIR extension pack cannot be verified against a local mirror of the R5 specification, because that mirror contains no extension definitions. Those citations are taken on the working group's authority, and are marked as such. Citations to openEHR RM pages and to FHIR R5 core pages are held to two separate rules. A citation sitting on a real endpoint SHALL name an anchor rather than a bare page, with one written-down exception where the specification offers no anchor at all. For the generated mapping tables that rule is part of the external RI ledger's structural validation; the hand-maintained tables on Gaps — where that one exception is stated — and Open Items are held to it by review. Resolving those anchors against local copies of both specifications is a second, mirror-dependent check in the RI's release gate, and it skips when the mirrors are not configured. The RI's documentation owns execution of both checks; neither runs automatically when the guide is published.
Implementation commands run in the separate RI checkout, not in this guide repository. Its maintained documentation supplies setup, invocation, and release requirements:
Citation resolution needs local mirrors of both specifications: every
spec-local citation is resolved to a real anchor on a real page, not merely
to a file. The separate vocabulary check needs the openEHR mirror alone. It
resolves the openEHR vocabulary literals the converters write and the fixtures
carry — code-set identifiers, DV_TEXT.formatting values, and the ISO 8601
lexical forms the guide flags as openEHR-accepted — against the published
openEHR specification. Missing mirrors cause those tests to skip rather than
prove their claims; the external RI documentation defines the configured,
zero-skipped release gate. Guide publication consumes committed inputs and
does not execute these suites or require their mirrors.
lossless row round-trips: the value at that row's path survives
conversion out and back unchanged, and the converter reports no issue at that
path.lossy row neither over-claims nor under-claims: every issue the
converter reports is one the ledger declared for that direction, and the union
of reported issues across all of a mapping's fixtures equals the declared set
exactly.unmapped row reports its source path and produces no value at its target.Two scoping rules are deliberate, and both are narrower than they were. Rows at
archetype scope are outside the matrix, because their FHIR home is a resource
element and a data-type converter never sees a resource — and a row that claims
that exemption while targeting an ordinary data-type element is now rejected,
so the exempt set cannot grow by inattention. And a row whose source side
has no counterpart in the direction under test is skipped, because there is
nothing to convert from; its target side is not skipped, and a conversion
that produces nothing at all has to name a path the ledger declares unmapped.