VistA Community

HL7 Framework is a set of routines and APIs developed by EHS (Electronic Health Solutions) to provide the needed infrastructure for integration projects needed while implementing Hakeem program in Jordan. The integration target was back-office (mainly Patient Billing and Stock Management).

Therefore EHS has developed HL7 Framework to make it possible to exchange HL7 messages back and forth between VistA and Mirth (IE) or any other system that supports HL7 V2.

The Framework minimizes the need to do lots of development as it gives the user the ability to configure the HL7 message structure, fields, segments and fields order. There is no need to open the code to do such changes, all of it can be done by configuration.

Also, there is a parser that receives the HL7 message and splits it in a way that can be then processed and handled as required.

Notice that HL7 framework uses UJO7 namespace (UJO is the namespace assigned to Jordan by VistA DBA), so supposedly it will not conflict with any of the routines or files already existing on your system. However, it is better that you install it in a testing environment.

This is one of the major projects that EHS has worked on for the past years of implementing the Hakeem program in Jordan and is used in different integration projects and evolved over the years. However, if you find any bugs or you want to add any enhancements please do inform EHS via email.

Please share any modifications with us so we can add them to the main code.

Finally, EHS is providing the HL7 framework (under GPL license) to the open source community of VistA and more will be released once they are ready.

To download the routines/patches please click this link.

The following is an example of how the HL7 parser works:

;Defined ENCODING CHARACTERS from the received message
 S HDR("ENCODING CHARACTERS")=VALUE
 S HDR("COMPONENT SEPARATOR")=$E(VALUE,1)
 S HDR("REPETITION SEPARATOR")=$E(VALUE,2)
 S HDR("ESCAPE CHARACTER")=$E(VALUE,3)
 S HDR("SUBCOMPONENT SEPARATOR")=$E(VALUE,4)

    ;Do the parsing of message component per segment per field
    
S HDR("SENDING FACILTY",3)=$$GET^HLOPRS(.TO,4,3)
     S HDR("RECEIVING APPLICATION")=$$GET^HLOPRS(.TO,5)

The following is another example of to configure HL7 message:

NUMBER: 4                               NAME: UJO7 A04
  HL7 MESSAGE TYPE: ADT                 HL7 VERSION: 2.4
  HL7 EVENT TYPE CODE: A04              DESCRIPTION: Add person information

HL7 SEGMENT TYPE: PID  //HL7 segment name
HL7 FIELD: SET ID - PATIENT ID  //HL7 field name used in PID segment
  PROCESSING ROUTINE: DO GFLDPRTN^UJO7FPUT("UJO7 A04","PID","SET ID - PATIENT ID","1",1,1,1)//HL7 field value

HL7 FIELD: PATIENT NAME
  PROCESSING ROUTINE: DO GFLDPRTN^UJO7FPUT("UJO7 A04","PID","PATIENT NAME",$TR($TR($$GET1^DIQ(2,PIEN,400000011),"","~"),",","~"),1,1,1)  //HL7 field value by calling GET1 function in the DIQ routine

HL7 SEGMENT TYPE: EVN
HL7 FIELD: EVENT REASON CODE
  PROCESSING ROUTINE: DO GFLDPRTN^UJO7FPUT("UJO7 A04","EVN","EVENT REASON CODE",
"01",1,1,1)

VARIABLE NAME: PIEN                     VARIABLE TYPE: NUMERIC
  WORK ARRAY: RMSREG