0

I was trying to generate an ADT A03 message using HAPI API’s. I am sharing the code below. I am getting the HL7 Message generated but the message type segment looks like “ADT^A03^ADT_A03” instead of “ADT^A03”.

Please help me to generate a proper message.

ADT_A03 adt = new ADT_A03();                           
adt.initQuickstart("ADT", "A03", "abcd”);                                                                         
MSH mshSegment = adt.getMSH(); 
mshSegment.getSendingApplication().getNamespaceID().setValue(“our app name”);
.
.
.
HapiContext context = new DefaultHapiContext(); 
Parser parser = context.getPipeParser();
String encodedMessage = parser.encode(adt); 
LOGGER.info(encodedMessage);

1 Answers1

1

The message type field you mention is just fine.

The MSH-9 field is defined as follow in chapter 2 of the HL7 standard:

<Message Code (ID)> ^ <Trigger Event (ID)> ^ <Message Structure (ID)>

The 3rd component indicates the message structure, the valid values are defined in Table 0354 (defined in chapter 2C). The short version is that this indicates which segments are allowed and required for a specific event/message type.

A number of different events share the same structure, for example messages of type A01, A04, A08 and A13 share the same structure ADT_A01. So for a generic A08 update message, the message type is actually ADT^A08^ADT_A01. Seems weird at first, but you'll get used to it ;)

Emilien
  • 2,971
  • 2
  • 22
  • 32