HL7 Version 2 to FHIR, published by HL7 International / Orders and Observations. This guide is not an authorized publication; it is the continuous build for version 1.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/v2-to-fhir/ and changes regularly. See the Directory of published versions
This section outlines implementation specific considerations that will have to be addressed during the implementation of a v2-to-FHIR transformation project. Not all of these issues will apply to every implementation, but each implementation should review and consider the entire list to assess whether or not they are relevant for the project at hand. This list is not comprehensive and other implementation considerations may emerge as transforms are developed, tested, and implemented in a Production environment.
In older versions (e.g., v2.3.1), the message structure in MSH-9, specifically MSH-9.3, may have been omitted as the standard did not always include it in the message structure definition. For example, the message definition for RDE^O01 in v2.3.1 does not include the message structure, thus implementers omitted that, even though in Table 0354 there was a structure defined for RDE_O01. When MSH-9.3 is empty, we suggest to derive the message structure to get to the proper map by using the message code and trigger event. For example, when the message code and trigger event is ABC^Nnn then use ABC_Nnn. For RDE^O01 that would be RDE_O01. Exceptions to this approach will be more common for certain domains, for example Admission, Discharge and Transfer (ADT) messaging often reuses an existing message type for new message code/trigger event pairs.
Some v2 implementations may adhere to constraints made on the base standard by an implementation guide. Where this happens, it may be necessary to extend or constrain the standard mappings provided by this project. For example, in the US the v2.5.1 immunization messaging implementation guide describes how to use OBX segments to convey information related patient eligibility, distribution of educational materials and vaccine funding source. While these concepts are part of the FHIR Immunization resource, the VXU mappings from this project do not include these transformations as they are defined by the implementation guide, not the base standard. Implementers should consider local variations from the base standard when developing their transformations.
In v2, it often happens that singular organization, person, or other entity may be referenced multiple places in a message. For example, the Attending Doctor in PV1-7 of a laboratory order message may also be the ordering provider referenced in ORC-12 and OBR-16 (or in newer versions a PRT segment). When converting a v2 message to a set of FHIR resources, it may be ideal to create a single instance of a resource for that entity and reference it from multiple Resource elements. In this case, a single Practitioner resource may be present in the newly created FHIR bundle but references from both Encounter.participant.individual and ServiceRequest.requester in a bundle of R4 FHIR resources. Since these references may occur in different segments and a given message may not always have enough data in the data type components to unambiguously identify multiple references to a singular entity, this may be a challenge for some implementations. This guide therefore does not attempt to provide guidance in the mappings where different message data elements may potentially reference a common entity. However, we do encourage to re-use resources for reference where the mapper and receiving system can establish such re-use. Deduplication logic based on data including identifiers, name and credentials should be employed as part of the transformation strategy to identify potentially reusable resources.
In some instances, a single segment may be mapped to multiple FHIR resources, for example MSH is mapped to MessageHeader and one or more Provenance resources. In this case, the mapper is strongly encouraged to reuse resulting FHIR resources where possible. For example, the mapping for MSH-4 Sending Facility yields an Organization resource which can be referenced from the respective MessageHeader and Provenance resources resulting from individual segment maps.
In several maps, the v2 field or element has a larger maximum cardinality than the mapped FHIR attributes. That is, some v2 elements are allowed to repeat while the cognate FHIR element is not allowed to repeat. We still provide these mappings, but if your implementation allows these v2 elements to repeat, data may be lost. Implementers should evaluate the likelihood of this happening. The project team welcomes examples where this occurs in existing implementations so that we can discuss possible solutions.
When the v2 message is mapped into a FHIR Bundle, resources need to have a Resource.id. The FHIR base standard defines Resource.id as “The logical id of the resource, as used in the URL for the resource.”. Typically, this is the “the ‘logical id’ of the resource assigned by the server responsible for storing it” however in the case of a v2 message conversion this definition is not applicable, Additional discussion of the use of Resource.id when resources are created transiently for transfer between systems is available in the base standard. The description of resolving references in Bundles is particularly important for the v2 transformation process. Implementers should ensure that all resources within the Bundle resulting from the transformation have a unique id so that references within the bundle can be resolved. Different options may include assigning an id based on information with the message (such as a patient or order identifier) or system assigned number generated at the time of transformation. The receiver of the Bundle should not read any meaning into the value of the id.
Depending on the nature of the implementation, the Bundle may be used by the recipient in any number of ways including being forwarded in a FHIR message, persisting the content as FHIR resources, or translating content into local data structures. Persistence of Resource.id cannot be guaranteed.
This implementation guide recognizes the distinction between stand-alone and contained resources but does not provide guidance in the mappings as the appropriate usage of contained resources. Implementers should consider the appropriateness of using contained resources during the transformation process where insufficient data is available in the v2 message to create a stand-alone FHIR resource. For example, if an ROL segment is transformed into a PractitionerRole resource including the address of the provider office in ROL-11 but the segment lacks the provider's location in ROL-13 there may not be enough information to warrant creating a stand-alone Location resource, but rather a contained Location resource (including the address) may be included in the PractitionerRole resource.
The FHIR standard includes extensive content related to workflow management and task management. While many v2 message types don't infer tasks (eg, they report on a previously completed event), some message types (e.g., order messages) may imply the need for an external system to complete a task (e.g., fulfill the order being requested). This implementation does include some mappings to the Task resource but it is up to implementers to determine if it is appropriate to create Task resources during the transformation process based on the business requirements and workflows associated with the integration. For example, an order message may be directed to a system with the intent of notifying the system of the existence of the order without any expectation that the receiving system will fulfill the order. In this case, the creation of a Task resource is likely to be inappropriate. Implementers must understand the workflows associated with the data exchange to implement tasks correctly.
Most Hl7 v2 messages are sent using snapshot mode. However, where segment action codes (typically – add, update, or delete) are used it is up to the implementers to determine the appropriate actions on the FHIR side as the data may already exist. That may or may not be known by the mapping engine and lead to the application of different techniques to interpret and manage the action codes. A future version of this guide may include further guidance and best practices on mapping segment action codes.
The concept of data provenance is typically only indirectly addressed within the v2 standard; however provenance can often be inferred by the data in various fields of the v2 message. For example, provenance may be inferred from data in the MSH segment (e.g., the responsible sending organization), the EVN segment (e.g., the event it represents), the ORC segment (e.g., the entering user) or TXA segment (e.g., the authenticator). This implementation guide does include some mapping to the Provenance resource, but it is up to implementors to determine the level of data provenance that should be captured during the transformation process. At a minimum, the authors of this document feel that it is appropriate to capture the provenance of the message source and the v2-to-FHIR transformation process. Additional provenance may be captured from additional fields as appropriate for the implementation. To enable provenance, it is important to have the responsible organization or individual included in the MSH, EVN, ORC, TXA, and other applicable segment as identified in the mapping.
Identity management and patient merging/unmerging are complex processes at the best of times. Implementers should carefully consider how these activities will be impacted by a v2-to-FHIR transformation project. In particular, the workflow chosen (e.g., messaging versus RESTful actions) and how Patient.id is populated may significantly impact how Patient resources are created, updated and deleted by the receiving system.
Clinically focused v2 messages (e.g., ORM/OML, ORU, MDM) may contain limited data regarding an associated patient encounter. This data content may or may not be sufficient to unambiguously identify a matching encounter in the receiving system. The creation of Encounter resources should be carefully considered during the implementation process. The use of contained Encounter resources may be appropriate.
In most FHIR resources, elements which allow a reference to a Practitioner resource also allow a reference to a PractitionerRole resource. In most scenarios, a v2 field using the XCN data type will typically be mapped to the Practitioner resource, but implementers may choose to map to the PractitionerRole resource instead. In a few places, an XCN field will be mapped to a PractitionerRole resource when other fields in the segment can contribute content to the PractitionerRole resource to create a more robust resource. For example, the ORC segment when mapped to ServiceRequest maps the Ordering Provider (ORC-12) field to PractitionerRole because the Ordering Facility fields in ORC (ORC-21 through -23) can also contribute to the PractitionerRole resource to create a more robust resource.
Depending on context and content an OBX segment in a v2 message may represent a wide variety of different types of data. Typically, the OBX segment will map to an Observation resource which in turn is referenced in some other resource (eg, the result containing OBX segments in an ORU message will typically be transformed into Observation resources which are referenced in DiagnosticReport.result). Even when an OBX segment clearly maps to an Observation resource, complications may arise when the contents of multiple OBX segments must be considered as a whole in order to be fully understood or when there are multiple parts to a single result (that is each OBX segment is a component of an Observation (e.g., Observation.component). It is critical that implementers fully understand the type of content that may be presented in an OBX segment so that an appropriate transformation approach can be developed.
OBX-5 (Observation Value) is allowed to repeat in the v2 base standard however Observation.value[x] is constrained to a cardinality of 0..1. In this case, the transform may take a number of forms:
The values of OBX-3 and/or OBX-4 in multiple OBX segments may indicate a relationship between individual observations that must be maintain during the transformation process in order for the data to remain accurate and of use. For example, when two OBX segments contain the systolic and diastolic values of a blood pressure reading, the relationship between the two observations must be maintained. Observation.component can be used to maintain the relationship between related results. Implementers are encouraged to read the base standard documentation available describing the use of Observation.component as well as think about how related observations will be identified during the transformation process.
Various HL7 v2 types enable the use of codes, e.g., CWE, CNE, CE, as well as ID and IS. Real-world implementations of v2 messaging are diverse and use a variety of coded values to convey meaning between systems. Because of this diversity, implementers of v2-to-FHIR transformations will need to develop and apply processes for terminology review and mapping. These processes will need to accommodate the nature of the HL7 v2 table used to populate the v2 message and the value set contents and binding strength of the target FHIR data elements. Some general guidance for a variety of situations is provided below, however transformation implementers must evaluate all value sets that may be used to populate the v2 message to ensure that any coded data contained in the v2 message is appropriately transformed into the resulting FHIR resources even when different sets of values are used by the two standards.
HL7 v2 uses the concept of tables to describe the coded values used in a v2 message. A coded data element in the message (e.g., Patient administrative sex in PID-8 or the order control code in ORC-1) is assigned a specific table which documents valid values. While the v2 base standard includes tables in Chapter 2C, local implementations may constrain or extend the base standard values. It is critical that transformation implementers understand the full range of values that a sender may include in a v2 message and the values that a message recipient can consume. HL7 v2 defines a number of types of tables:
Rather than using tables, FHIR defines value sets which contain codes from specific coding systems (see the FHIR Terminology page for further information on this topic). Coded data elements in the FHIR base standard are typically bound to a value set with a particular binding strength which has implications for the ability of the recipient of a FHIR bundle to process coded values. The FHIR binding strengths are defined as:
Furthermore, FHIR employs several coded data types including:
This v2-to-FHIR Implementation Guide provides basic mappings from the v2 tables used by the mapped message types to the cognate FHIR value sets. However, the complexity of the terminology approaches used by both v2 and FHIR combined with the inherent flexibility of both standards makes it impossible for this document to provide definitive mappings for all possible values for all coded data elements. When possible this document provides mappings where both HL7 defined values (in both HL7 Defined and User Defined tables) and FHIR value sets (off all binding strengths) are available. However, as noted above, implementers of v2-to-FHIR transformations must review every terminology mapping supported by the transformation process to ensure that all locally used codes are accounted for. Below are a few considerations when doing local terminology review.
Translations may be particularly problematic when the FHIR value set is rigidlyfixed (a binding strength of "Required") and cannot be extended locally. A v2 value may not have a cognate FHIR value or the FHIR value may be less granular than the v2 code, either situation can potentially result in the loss of information as the concept is translated. In these situations we recommend the following:
Tool behavior should be driven by the configuration of the vocabulary mapping files rather can coding within the transformation tool itself. Using the CWE data type as the example, the following section describes how vocabulary mapping is achieved between HL7 v2 and FHIR vocabulary.
The CWE data type can contain up to 3 “coding triplets” each of which may contain unique codes from different codes sets, however all codes must represent the same concept. At a high level, these correspond to multiple occurrences of CodeableConcept.coding for the cognate FHIR element. In an ideal world, each HL7 v2 CWE triplet will consist of a code, a display name and a coding system. The combination of the code and the coding system should provide a unique key for mapping purposes.
For the CWE field, the translator should perform the following steps for each of the three possible triplets.
If the implementers know that the v2 CWE field will not be fully populated (e.g., there will be a code but not a code system), the vocabulary map will need to be updated accordingly to include a row where Column A is populated but not Column C is not populated. Note that in this case, column J should remain populated so that the FHIR resource that is created contains both a code and a system If the triplet does not contain a code but does contain text (in either the text field of the triplet (e.g., CWE.2 or CWE.5) or the original text (CWE.9)) then it is unsuitable for discrete mapping and the text should be used to populate CodeableConcept.text