Keywords: HL7 (Health Level Seven), Data, Parsing, Encoding, ER7, XML, EDI, Parser, Encoder, Conversion, Converter, XML Schema
Overall Functionality (HL7 Parsing, Encoding, Parser, Encoder and v2 XML Conversion)
- HL7 Encoder facilitates user to handle HL7 v2 data. It allows to decode HL7 v2 coded data into XML, and encode XML into HL7 v2 coded data.
- HL7 version 2.X coded EDI data is also called ER7 encoding. It is a delimiter based encoding mechanism and delimiters are always embedded at the beginning of a message.
- The implementation of the HL7 encoder provides tools for user to define and test HL7 encoders, as well as provide runtime support for HL7 encoders.
- HL7 encoder definition, which is represented in form of annotated XSD, is used in WSDL just like normal XSDs with the convention that usually an element declaration that represents one of the HL7 v2 message types is used in the Part definition, not any of the XML types.
In composite applications, HL7 encoder is used the same way as all other encoder types are used, which is,
in the WSDL's binding section specifying the encoding style in the encoding style property of a message type.
Currently the encoding style value for using HL7 encoder is "hl7encoder-1.0".
To learn more about the HL7 specification, please visit HL7 official site.
To learn more about encoder in general, please visit An Introduction to Encoder.
High Level Requirements
The requirements of HL7 encoder fall into two categories: the design time tools and runtime support. The design time tools shall facilitate user to import and view HL7 encoder definition, as well as discover its runtime behavior at design time. HL7 encoder runtime support shall provide efficient and fast algorithms that decode HL7 v2 standard encoding encoded message into v2 XML encoding encoded message and encode v2 XML encoding encoded message into HL7 v2 standard encoding encoded message.
- Import HL7 v2xml XSDs as HL7 encoder definitions. The HL7 v2 XSDs we provided shall have HL7 encoding pre-applied. Once the XSDs are imported, they shall be at the ready-to-use state. This use case should have been covered by the NetBeans' Import external XSD wizard.
- View HL7 abstract message structure. This use case should have been cover by NetBeans XSD editor.
- View HL7 encoding rules at node level, such as HL7 data structure name etc.
- Editing HL7 encoder definition is allowed but not required. If users want to add their own Z segment, they can do that.
- Test HL7 encoder's runtime encoding/decoding behavior at design time
- Specify the HL7 encoding style for different bindings (such as HL7, FTP, FILE, JMS etc.)
- Provide HL7 decoding/encoding support at runtime
- HL7 encoder definition is stored in XSDs. We provider all HL7 v2 XSDs for version 2.1, 2.2, 2.3, 2.3.1, 2.4 and 2.5.
- The abstract message structure is defined by normal XSD constructs
- The specific HL7 encoding rules is stored in XSD's Annotation/AppInfo contructs
- HL7 encoder viewer (potentially can do editing also) is NetBeans XSD editor plus an overlay/plug-in (which is called AppInfo provider) on top of it. The plug-in shows an HL7 encoding node underneath the Annotation node.
- HL7 encoder parser uses SAX interface to return decoded data, so it can do streaming parsing.
- Unrecognized segments are governed by XSD wildcards. Unrecognized fields/components/sub-components are skipped.
A Sample HL7 Standard Encoding Message
Following is a sample HL7 standard encoding message (v2.5 ADT_A01):
NK1|1|SAMPLE^ELLEN|SPOUSE^^HL70063|171 SAMPLELIN^^ISHSAMPLE^MI^49849^""^|(900)485-5344|(900)545-1234~(900)545-1200|EC1^FIRST EMERGENCY CONTACT^HL70131
NK1|2|SAMPLE^MARYLOU|MOTHER^^HL70063|300 SAMPLELIN^^ISHSAMPLE^MI^49849^""^|(900)485-5344|(900)545-1234~(900)545-1200|EC2^SECOND EMERGENCY CONTACT^HL70131
NK1|4|||123 SAMPLERY WAY^^ISHSAMPLE^MI^49849^""^||(800)545-1200|EM^EMPLOYER^HL70131|19940605||PROGRAMMER|||SAMPLE SOFTWARE COMPANY
DG1|1|19|R63.4^LOSS OF WEIGHT^I10|||00|
GT1|1||SAMPLE^JAMES^""^""^""^""^||171 SAMPLELIN^^ISHSAMPLE^MI^49849^""^|(800)485-5344|(800)485-5344||||SE^SELF^HL70063|371-66-925||||SAMPLE AUTO PLACE|171 SAMPLELIN^^ISHSAMPLE^MI^49849^""|(800)485-5344|
IN1|0|0^HL70072|BC1|BLUE CROSS|171 SAMPLELIN^^ISHSAMPLE^M149849^""^||(900)485-5344|90||||||50 OK|
The decoded (by HL7 encoder) v2xml message can be found at ADT_A01 decoded message
See a Demo
A simple file-to-file demo that uses HL7 encoder can be viewed at HL7 Encoder Demo
HL7 Version 2 XML Schema (XSDs)
The full set of HL7 Version 2.x (2.1, 2.2, 2.3, 2.3.1, 2.4, 2.5) XSDs can be downloaded at HL7 v2 XSDs
Want To Try It Out?
Please follow the steps outlined at the Encoder Feature Installation Guide
page to proceed with the encoder feature installation.
Tips and Tricks
* Important(!!!): If you notice extremely slow performance in testing HL7 encoder, please make sure disable JVM assertion in NetBeans' conf file (netbeans.conf) under its etc folder. Please change the setting from -J-ea to -J-da.