Informatics, digital & computational pathology

Laboratory information systems

HL7 V2


Editorial Board Member: Debra L. Zynger, M.D.
Deputy Editor-in-Chief: Andrey Bychkov, M.D., Ph.D.
Jerome Cheng, M.D.

Last author update: 8 June 2022
Last staff update: 8 June 2022

Copyright: 2019-2024, PathologyOutlines.com, Inc.

PubMed Search: HL7 V2

Jerome Cheng, M.D.
Page views in 2023: 414
Page views in 2024 to date: 85
Cite this page: Cheng J. HL7 V2. PathologyOutlines.com website. https://www.pathologyoutlines.com/topic/informaticsHL7V2.html. Accessed March 28th, 2024.
Definition / general
  • Developed by Health Level Seven International (HL7.org); HL7 version 2.x (V2) is currently the most widely used messaging standard for electronic transmission of information across health enterprises and health information systems
Background
  • HL7 V2 has been in use for over 3 decades due to its simplicity and ease of understanding (relative to HL7 V3)
  • When an order or result is transmitted electronically from one hospital to another institution or clinic, the receiving institution interprets the message and loads the data into its own laboratory information system or EHR (electronic health record)
    • Acknowledgement message (ACK) is sent back to the originating institution to inform that the message was sent successfully; in cases where there was a problem in processing the message, a negative acknowledgement is sent back instead (NACK)
  • HL7 V2 has several message types, e.g., ADT (admit discharge transfer), ORM (order), ORU (observation result - unsolicited)
  • Each message is composed of several segments, e.g., MSH (message header), ORC (common order), OBR (observation request) or NTE (notes and comments)
    • Different types of messages contain a different combination of message segments
  • Complete HL7 specifications can be downloaded from HL7.org
  • Middleware solutions can serve as a translator between 2 incompatible HL7 messaging systems (J Med Syst 2013;37:9986)
Essential features
  • Within health institutions, HL7 V2 is the most common interface messaging standard used for electronic transmission of orders, results and other types of patient data
  • There are several HL7 message types, e.g., ADT (patient administration), ORU (results), ORM (orders)
  • Setting up an interface between 2 medical institutions requires sharing of HL7 specifications, either an HL7 interface engine or custom built software and numerous steps of testing and validation
Terminology
  • Interface: connection that enables transfer of data between instruments or computer systems; in healthcare, this usually involves HL7 messages but the data can be formatted in other ways
  • HL7 interface engine: computer program dedicated to monitoring, translating and transmitting HL7 messages between health information systems
Message types
  • ADT (admit discharge transfer / patient administration) does more than its name implies; it is also used for changing and merging records
    • The following are some types of ADT messages:
      • A01: admit patient
      • A02: patient transfer
      • A03: patient discharge
      • A04: register patient
      • A05: preadmit patient
      • A06: change outpatient to inpatient
      • A07: change inpatient to outpatient
      • A08: update patient information
  • ORU (unsolicited observation result)
  • ORM (order message)
  • ACK (acknowledgement)
  • NACK (negative acknowledgement)
  • HL7.org has a comprehensive list of all message types
Message segments
  • The first 3 characters identify the type of segment, e.g., MSH (message header), PID (patient identifier), OBR (observation request)
  • Data elements are separated by the pipe character "|" and each element is referred to by the 3 character name of the segment, followed by a dash and the numerical order in which the data element occurs
  • Example of a PID (patient identifier) segment
    • PID|1||MEDICALRECORDNUMBER||LASTNAME^FIRSTNAME||19550922|F|999888004|||||||||A55555||||||||||||||||
      • PID-5 pertains to the patient's name ("LASTNAME^FIRSTNAME" in the example)
      • PID-6 is empty
      • PID-7 refers to the patient's birthday ("19550922" in the example)
  • MSH (message header): included in every message and describes the contents of the message, including the time it was sent, the sender and recipient and the purpose of the message, e.g., order, result or a type of ADT (admit discharge transfer) message
    • Example: MSH|^~\\&|SENDAPP|SENDFACILITY|RECEIVEAPP|RECFACILITY|201906140836||ORM^O01|586 60050-20190614083|D|2.4
      • The value for MSH-9 "ORM^O01" tells us it is the header for an ORM (order message)
      • MSH-1 defines the field separator "|", which technically can be any character but "|" is normally used in practice
  • MSA (message acknowledgement)
  • OBR (observation request)
    • Contains information about a test being ordered or resulted
    • Component of ORU (unsolicited observation result) and ORM (order message)
  • OBX (observation / result segment): contains test result data
  • NTE (notes and comments segment)
  • Reference: HL7: Data Definition Tables [Accessed 26 May 2022]
Implementation
  • Each interface project presents its own unique set of challenges; oftentimes, a large amount of effort is needed to set up the interface due to unique requirements on each side
  • If properly implemented, interfaces reduce errors, repetition and provide considerable work and time savings over a manual workflow (Stud Health Technol Inform 2017;234:188)
  • Not every HL7 message is formatted exactly the same way
  • Escape sequences - certain characters within message fields, such as the field separator (usually "|") - have to be replaced by a set of characters ("\F\") for an HL7 parser to interpret the message correctly (HL7 V2+: Control [Accessed 17 May 2022])
    • \F\    |
    • \S\    ^
    • \T\    &
    • \R\    ~
    • \E\    \
  • Test codes may not match between 2 places; dictionaries are created to map the test codes of one institution to another
    • LOINC (Logical Observation Identifiers Names and Codes), which has standardized codes for laboratory and clinical observations, is one solution to this problem but presents its own set of challenges, since 2 places may also use different LOINC codes for the same test (Clin Chem 2003;49:624)
      • Example LOINC code: 2339-0 for blood glucose
  • Before 2 parties start building an interface, an interface specification has to be shared; this specifies what each field in the message contains
    • Minor differences, such as the location of a particular field, must be taken into account and either the sender or receiver must perform the necessary transformations to the message to maintain compatibility
  • Messages are reformatted to meet specifications by using an HL7 interface engine or through custom programming development
    • GUI (graphical user interface) based interface engines are helpful to people with no programming background; these can be used to map equivalent data elements from multiple sources (Healthc Inform Res 2011;17:214)
  • Transmitting PDFs: it is possible to transmit files such as PDFs within an HL7 message
    • File will have to be converted to Base64 format and inserted into a message segment location specified by the receiving party
  • Testing: a lot of testing will have to be done using different scenarios and types of tests to make sure the interface is working properly and to uncover any interface defects
Examples
  • Acknowledgement message (ACK)
    • MSH|^~\\&|SENDAPP|SENDFACILITY|RECEIVEAPP|RECFACILITY|||ACK|18659670-2019061408 
    • MSA|AA|18659670-20190614083
      • AA in the MSA (message acknowledgement) segment stands for application accept; other potential values are AE (application error) and AR (application reject)
      • 18659670-20190614083 is the ID of the message that was received, which can be found in the MSH (message header) segment of every message
  • Order message (ORM)
    • MSH|^~\\&|SENDAPP|SENDFACILITY|RECEIVEAPP|RECFACILITY|201906140836||ORM^O01|586 60050-20190614083|D|2.4
    • PID|1||MEDICALRECORDNUMBER||LASTNAME^FIRSTNAME||19550922|F|999888004|||||||||A55555||||||||||||||||PV1||C|TEST||||ATTENDINGDOCTOR |||||||||||||||||||||||||||||||||||||201906140534
    • ORC|SC|00235501|51400000|61500000^LAB|||^^^201906140834^^R||201906140824|ENTEREDBYNAME||^2552^ORDERING^PROVIDER^MD| LOCATION
    • OBR|1|00235501|51400000|GLUC^GlucoseLevel^^23457|||201906140824|||ENTEREDBYNAME||||||^2552^ORDERING^PROVIDER^MD|||||||| DXSECID|||1^^^201906140824
      • An order for a glucose level test
      • Made up of 4 segments: MSH (message header), PID (patient identifier), ORC (common order), OBR (observation request)
Other HL7 interface standards
  • HL7 V3
  • FHIR (Fast Healthcare Interoperability Resources)
    • In 2011, it was recognized that HL7 version 3 was being minimally adopted, which led to the creation of a new task force and eventually the development of FHIR, HL7's latest approach to interoperability (J Am Med Inform Assoc 2016;23:899)
    • Uses RESTful methods to transmit data, which are made up of resources
      • Components of resources:
        • Human readable narrative
        • Specified data types
        • Metadata
    • Formatted in XML or JSON (JavaScript Object Notation), both of which are human readable
Board review style question #1

What is the standard most commonly used to transmit data between health information systems?

  1. HL7
  2. LOINC
  3. RxNorm
  4. SNOMED
Board review style answer #1
A. HL7, specifically HL7 V2, is currently the most commonly used messaging standard for transmission of data between health information systems.

Comment Here

Reference: HL7 V2
Board review style question #2
Which HL7 message segment contains patient related information, such as name and birthday?

  1. MSH
  2. NTE
  3. OBX
  4. PID
Board review style answer #2
D. PID: patient identifier segment

Comment Here

Reference: HL7 V2
Back to top
Image 01 Image 02