Sunday, August 19, 2012


|| - When nothing is present between the field  or sub-field, it is called Empty. This means, sending application did not value the element. 

|""| - When two double quotes are present in succession, it is called Null. This means, sending application has no data for the element. If agreed between sender and recipient, recipient can even delete the value for  that specific element.

Friday, December 4, 2009

HL7 - Message Sequencing

When it is required to send a messages in sequence, Application typically follow any of the below mentioned approach.

1.Standard methodology(Sequence protocol):
User can make use of MSH.13 (sequence number) to send the messages in sequence.

For every message, a sending system sends the sequence number and incriments the number by one for successive messages.

For every message received, the receiving application has to store the sequence number of the most recently received message and it has to send an acknowledgment by echoing the sequence number in MSA.4 - expected sequence number.

Using a 0 (zero) indicates that the link is started or restarted.
When the receiving system receives a sequence number in the MSH 13, it should respond with an ack with MSA.4 containing the sequence number one greater than the last message received.

If the receiving system is not having the sequence number, it sends -1 in the MSA.4. Which indicate that the receiving system will use the sequence number of the first transaction it accepts as its initial sequence number.

" -1" is used for re-synchronize the link. When sending system sends -1, Receiving system
should send the acknowledgment with "- 1" in the expected sequence number in the field. With this, the receiving system then resets its sequence number to sequence number of the next transaction it accepts.

2: One-to-One acknowledgment.
simple one-to-one acknowledgment scheme can be used to send the message in sequence. In this method duplicate transactions cannot be prevented.

Friday, April 17, 2009

Sending HL7 Messages using MLLP

What is MLLP ?
The Minimal Lower Layer Protocol (MLLP) is the most common mechanism for exchanging the HL7 data. MLLP uses the TCP/IP protocol to transfer the data in continuous stream of bytes. MLLP delimiters is used to recognize the start and the end of message,

The structure of an MLLP message is given below
<SB> + <Message> + <EB> + <CR>

<SB> = Start Block. Messages are prefixed with start byte
<Message> = HL7 Message
<EB> = End Block. Messages are terminated with end byte
<CR> = Carriage Return

Default hexadecimal values of MLLP delimiters
<SB> = 0x0B (VT)
<EB> = 0x1C (FS)
<CR> =Carriage Return

Types of MLLP connection
There are two types of MLLP connection
1. Permanent Connection : In this case, only one connection is used to exchange all the messages between two endpoints.

2. Transient Connection : In this mode a new socket is created for each message. When a message is sent the sender waits for the ACK and once it is received socket is closed.

Monday, January 26, 2009


ACK - Acknowledgment
In HL7, when an receiving application receives
a business message, it is expected to send the ack back to sending application.

The acknowledgment generation is dependent on the value in the MSH.15 of the incoming business message. The standard values are

NE : Never
AL : Always
SU : Successfully processed
ER : Only during Error

Structure of HL7 ACK
MSH - Message header, Mandatory Segment
MSA - ACK Segment, Mandatory Segment
ERR - Error Segment, Optional

Anatomy of ACK
MSH - Details about the message such as Message Type, Sending, receiving application, date.

MSA - Contains the summary of issues or processing details
  • MSA.1 - Code explaining Accept(AA, CA), error(AE, CE) or Reject(AR, CR)
  • MSA.2 - Contains the control number of incoming business message. i.e., MSH.10 of business message
  • MSA.3 - Optional field containing the error description.
ERR - Optional segment containing erroneous segment detials

MSH|^~\&|HIS|System|Hosp|HL7 Genie|20071016055244||ACK^A01|A234242|P|2.3.1|
234242|Message Received Successfully|

Wednesday, December 31, 2008

About HL7

What is HL7

HL7 (Health Level Seven) Is one of several American National Standards Institute (ANSI) -accredited Standards Developing Organizations (SDOs) operating in the health care arena for exchanging clinical and administrative data between medical applications.

"7" refers to the seventh laye
r in the OSI model. This standard defines the format and the content of the messages that medical applications must use when exchanging data with each other and does not explains the the technical details on how the data should be exchanged.

Structure of HL7 message.

HL7 message is consists of segments and they are represented by 3 letter word. each segment consists of field which consists of components and then the sub-components.

The default message delimiters are

component separator
: repetition separator
: Escape character
& : Sub component separator

What is Trigger Event:
Each HL7 message contains a message type and trigger event. Each message message type is triggered by HL7 events. The message type and trigger event information is found in the first segment i.e. MSH.

ADT A01: Patient Admit

MSH|^~\&|System|HIS|HL7Genie|Hosp|20050804162010||ADT^A01|Message Control ID|P|2.3.1|||AL|AL
PID|1||191919^ABC~110-86-9016|3253763|Name^NAME^A||19560129|M|||007 BANAGALORE^^KARNATAKA^560001
PV1||O|||||018^DrPeaceAttending|0018^DrPeaceReferring|018^DrPeaceConsulting|CAR Hostpital service

MSH: Details about the message such as Message Type, Sending, receiving application, date, Acknowledgment required or not
EVN: Used to communicate necessary trigger event information to receiving applications. Tells about the person triggering the event patient/doctor
PID: Contains permanent patient information identifying and demographic information that is not likely to change frequently.
PV1: Details of the patient’s visit to hospital,such as Bed, Inpatient/out patient/emergency,visit id, doctor with whom patient is consulting.
PV2: Is a continuation of visit-specific information contained on the PV1 segment.