Informatics, digital & computational pathology
Laboratory information systems
HL7 V2

Editor-in-Chief: Debra L. Zynger, M.D.
Jerome Cheng, M.D.

Topic Completed: 6 August 2019

Minor changes: 12 August 2019

Copyright: 2019,, Inc.

PubMed Search: HL7 V2

Jerome Cheng, M.D.
Page views in 2019: 281
Page views in 2020 to date: 465
Cite this page: Cheng J. HL7 V2. website. Accessed November 26th, 2020.
Definition / general
  • Developed by Health Level Seven International (, 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
  • 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 hospital record)
    • An 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
Essential features
  • Within health institutions, HL7 v2.x 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 two medical institutions requires sharing of HL7 specifications, either an HL7 interface engine or custom built software and numerous steps of testing and validation
  • 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)
  • 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 (it is "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
    • A component of ORU (unsolicited observation result) and ORM (order message)
  • OBX (observation / result segment): contains test result data
  • NTE (notes and comments segment)
  • 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
  • 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
  • Test codes may not match between two 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, as two places may also use different LOINC codes for the same test (Clin Chem 2003;49:624)
  • Before two parties start building an interface, an interface specification has to be shared, which 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
    • The 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 it is working properly and to uncover any interface defects
  • Acknowledgement message (ACK)
    • 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 gaining minimal adoption, 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)
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
Board review answer #1
A. HL7, specifically HL7 V2, is currently the most commonly used messaging standard for transmission of data between health information systems.

Reference: HL7 V2

Comment Here
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 answer #2
D. PID: patient identifier segment

Reference: HL7 V2

Comment Here
Back to top
Image 01 Image 02