Stark
Try free
  1. Stark
  2. Answers
  3. What is an HL7 v2 message

What is an HL7 v2 message

Do not be afraid.

An HL7 v2 message is a block of plain text made of segments, one per line, that carries health information between systems. Each segment starts with a short code and holds fields separated by a delimiter, usually the pipe character. The first segment, MSH, is the header and says which characters the rest of the message uses.

Stark Covenant is not a certified EHR or medical device; your compliance review is required before real patient data.

Leer en espaƱol

Steps

  • Start with the header segment, MSH. It names the sending and receiving applications, the time, the message type and the version.
  • Read the other segments by their codes. PID carries patient identity and OBX an observation result, for example. Each code marks one kind of information.
  • Split a segment at the pipe character to get its fields, then split a field at the caret to get its components. Other characters mark repeats and sub-parts.
  • Look in the header for the full list of delimiter characters. They are declared there, so a receiver should read them rather than assume them.
  • Keep empty fields in place. A field that is left blank still keeps its delimiter, so every later field stays in its position.
  • Expect an acknowledgement, called an ACK. It repeats the control identifier of the original message so the sender can match the reply.

What it can't do

  • This is general information, not legal, medical or security advice.
  • Two systems that both use HL7 v2 may still disagree on local fields and codes, so an interface needs testing with each partner.
  • This page does not cover security, privacy or consent for sending health data, which differ by country and state.

Questions people ask

Can HL7 v2 carry images?

Not as part of the segment layout itself. An image is usually referenced, or encoded as text inside a field, which makes a message large.

Is the pipe always the field separator?

It is the usual one, but the header declares the characters in use, so read them from there.

How are errors reported?

In an acknowledgement message, whose status code tells the sender whether the receiver accepted it, hit an error or rejected it.

Do I need a special program to read one?

No. It is text, so a text editor opens it. A parser that understands the delimiters, many of them open-source, saves a lot of work.

Who made this page?

Made by Stark, who also make Stark Covenant, clinic record software that keeps records on a practice's own computers. It can export one patient's chart as an HL7 v2.5.1 ADT^A08 message; the export is checked structurally, not by the official HL7 validator, and Covenant makes no conformance claim. Not a certified EHR or medical device; your compliance review is required before real patient data. Details: https://starkforall.com/covenant.html

Try it

Local-first electronic health records for small practices. Exports HL7 v2 and FHIR R4. A clinician signs off every suggestion before it counts. No cloud dependency, no per-seat subscription. $200 one-time.

More answers