Health Level Seven International better known by its acronym HL7 is a set of international standards for clinical management, practice, health services evaluation and delivery. It is one of the several not-for-profit American National Standards Institute (ANSI) accredited Standards Developing Organizations (SDOs) in healthcare. Most SDOs create rules or standards (sometimes called specifications or protocols) for a healthcare domain such as pharmacy, medical devices, imaging or insurance (claims processing) transactions. HL7 in particular, is specific to the clinical and administrative data domain and transfers these two kinds of data between disparate software applications.

In other words, HL7 is a comprehensive framework and a set of standards for the exchange, transmission, integration, sharing and retrieval of electronic health information (EHI) or Electronic Medical Records (EMR) which refers to exchange of medical data in real-time.

The standard version is Version 2.3 which states that “HL7 provides a common framework for implementing interfaces between disparate vendors”. Newer versions include V3. Each message in a HL7 file comprises a group of segments in a defined sequence and these segments (or groups of segments) are optional, required, and/or repeatable.

Sample HL7 file

A sample HL7 file, saved with .hl7 extension, is as follows:

MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000|
OBX|1|NM|GLU^Glucose Lvl|59|mg/dL|65-99^65^99|L|||F|||20061122154733

SmartHl7 viewer

At CyByte, we use the SmartHl7 viewer to to better understand the file. To view the segment in the Message Viewer, simply click Load and browse the location of the HL7 file. The screenshot below shows the segments of HL7 file through the Smart Viewer:

HL7 integration
 Fig 1:Viewing the segments of HL7 File through Smart Viewer

 

Processing the HL7 file for Data Integration using Talend Open Studio

Talend Open Studio supports HL7 data integration and this blog takes you on a step-by-step journey of how to process the HL7 file for data integration using Talend Open Studio.

Step 1: Move the HL7 message to a CSV file by one of the following methods:

Drag and drop the following components to the workspace:

  1. tFileInputFullRow
  2. tfileOuputdelimited

Fig 2

Fig 2: Reading Hl7 File to CSV File

tfileInputFullRow opens a file and reads it row by row and sends complete rows as defined in the Schema to the next Job component, via a Row link. In tFileInputMSDelimited provide the path(D:\Blog\Sample.hl7) of HL7 file as shown below:

HL7 integration

Fig 3: Providing Source file Path in HL7 Basic Settings

tfileOutputDelimited writes a delimited file that holds data organized according to the defined schema. In tfileOutputDelimited specify the path with name(“D:/Blog/hl7.csv”) where you want to create the output file

Fig 4

Fig 4: Providing Target FilePath in TFileOutPutDelimited

The hl7.csv now has the hl7 message as seen below:

Fig 5

Fig 5: CSV File

Step 2: Next, the data stored in the CSV file has to be read using the appropriate component.

This type of data is called a Complex Structure data, where each row in the file displays a specific group of information which has to be moved to different csv files with respect to segment (MSH, PID,PD1,OBR,OBX). Each row has to be read separately, and to read the data, a component called tFileInputMSDelimited is used.

tFileInputMSDelimited opens a complex, multi-structured file, reads its data structures (schemas) and uses Row links to send fields as defined in the different schemas to the next Job components.

Fig 6 

Fig 6: tFileInputMSDelimited Basic Settings

Drag and drop the following components to the workspace:

  1. tFileInputMSDelimited
  2. tfileOuputdelimited

In tFileInputMSDelimted, click on browse to get the CSV file(“D:/Blog/Sample.hl7.txt”). In the Field Separator section provide “|”.  Click on Preview and the FetchCode tab

Fig 7

Fig 7: FetchCode Section in tFileInputMSDelimited

The Sections can be clearly seen. In Schemas, change the name according to the section, then drag and drop tLogRow from palette/canvas to the workspace and connect to tLogRow using row_MSH_1 to check the fields as shown below:

Fig 8 

Fig 8: Connecting tFileInputMSDelimited to tLogRow using row_MSH_1 link

Fig 9

Fig 9: Result for row_MSH_1 link

For the MSH section, the data is as follows:

  1. There are 11 fields in the MSH section
  2. Data is being populated in Column 2,4,8,9,10,11
  3. In the 8th field there are two subfields which have to be separated

Similarly for PID_1 section, the data is as follows:

  1. There are 19 fields in this section
  2. In 5th field the data shows FirstName and Last Name separated by the “^” symbol

Fig 10

Fig 10: Result for row_PV1_1

The next step is to separate this data and give the appropriate column name.  To split the string data based on separator there is a component called tExtractDelimitedFields which generates multiple columns from a given column in a delimited file.

Drag and drop tExtactDelimitedFields from the palette to the workspace, next connect tfileInputMSDdelimted to tExtractDelimitedFields.

Edit Schema to name the columns where the data is being populated by referring to the HL7 file in Smart Viewer as shown below:

Fig 11 

Fig 11: Filtering Columns in tExtractDelimitedFeilds

The field Patient_Name now contains two subfields which need to be split using tExtactDelimitedFeilds. Edit Schema and add one more column and rename it as follows:

Fig 12

Fig 12: Splitting Patient_Name to First_Name and Last_Name

Connect to tLogRow for verification. The result is as shown below:

Fig 13 

Fig 13: Result to check patient name after splitting the coloumns

After verifying result connect to tfileouputdelimited to generate the file in sections. The final job looks like the image below:

Fig 14

Fig 14: Final Job Design

Conclusion

By diligently following the steps explained above, it is possible to divide the HL7 file with several segments into files containing a single segment. These files can be read and stored in their respective tables.

At CyByte we have been actively working to perform HL7 integration using Talend for some of our renowned healthcare clients and have developed several solutions with regard to HL7 interface design, development and customization.