Handling Trailing Delimiters in HL7 Messages
Posted
by Thomas Canter
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Thomas Canter
Published on Wed, 20 Jun 2012 17:27:06 GMT
Indexed on
2012/06/21
3:17 UTC
Read the original article
Hit count: 615
Applies to: BizTalk Server 2006 with the HL7 1.3 Accelerator
- Outline of the problem
- Trailing Delimiters are empty values at the end of an object in a HL7 ER7 formatted message.
- Examples:
- Empty Field
- NTE|P|
- NTE|P||
- Empty component
- ORC|1|725^
- Empty Subcomponent
- ORC|1|||||27&
- Empty repeat
- OBR|1||||||||027~
- Trailing delimiters indicate the following object exists and is empty, which is quite different from null, null is an explicit value indicated by a pair of double quotes -> "".
- The BizTalk HL7 Accelerator by default does not allow trailing delimiters.
- There are three methods to allow trailing delimiters.
NOTE: All Schemas always allow trailing delimiters in the MSH Segment
- Using party identifiers
- MSH3.1 – Receive/inbound processing, using this value as a party allows you to configure the system to allow inbound trailing delimiters.
- MSH5.1 – Send/outbound processing, using this value as a party allows you to configure the system to allow outbound trailing delimiters.
- Generally, if you allow inbound trailing delimiters, unless you are willing to programmatically remove all trailing delimiters, then you need to configure the send to allow trailing delimiters.
- Add the appropriate parties to the BizTalk Parties list from these two fields in your message stream.
- Open the BizTalk HL7 Configuration tool and for each party check the "Allow trailing delimiters (separators)" check box on the Validation tab.
Disadvantage – Each MSH3.1 and MSH5.1 value must be represented in the parties list and configured.
Advantage – granular control over system behavior for each inbound/outbound system.
- Using instance properties of a pipeline used in a send port or receive location.
- Open the BizTalk Server Administration console
- locate the send port or receive location that contains the BTAHL72XReceivePipeline or BTAHL72XSendPipeline pipeline.
- Open the properties
- To the right of the pipeline selected locate the […] ellipses button
- In the property list, locate the "TrailingDelimiterAllowed" property and set it to True.
Advantage – All messages through a particular Send Port or Receive Location will allow trailing delimiters.
Disadvantage – Must configure each Send Port or Receive Location. No granular control over which remote parties will send or receive messages with trailing delimiters.
- Using a custom pipeline that uses a pre-configured BTA HL7 Pipeline component.
- Use Visual Studio to construct a custom receive and send pipeline using the appropriate assembler or dissasembler.
- Set the component property to "TrailingDelimitersAllowed" to True
- Compile and deploy the custom pipeline
- Use the custom pipeline instead of the standard pipeline for all HL7 message processing
Advantage – All messages using the custom pipeline will automatically allow trailing delimiters.
Disadvantage – Requires custom coding and development to create and deploy the custom pipeline. No granular control over which remote parties will send or receive messages with trailing delimiters.
- What does a Trailing Delimiter do to the XML Schema?
Allowing trailing delimiters does not have the impact often expected in the actual XML Schema.
The Schema reproduces the message with no data loss.
Thus, the message when represented in XML must contain the extra fields, in order to reproduce the outbound message.
Thus, a trialing delimiter results in an empty XML field.
Trailing Delmiters are not stripped from the inbound message.Example:
<PID_21>44172</PID_21>
<PID_21>9257</PID_21> -> the original maximum number of repeats
<PID_21></PID_21> -> The empty repeated field - Allowing trailing delimiters not remove the trailing delimiters from the message, it simply suppresses the check that will cause the message to fail parse with trailing delimiters.
- When can you not fix the problem by enabling trailing delimiters
- Each object in a message must have a location in the target BTAHL7 schema for its content to reside.
If you have more objects in the message than are contained at that location, then enabling trailing delimiters will not resolve the problem. The schema must be extended to accommodate the empty message content.
Examples:- Extra Field
NTE|P||||
Only 4 fields in NTE Segment, the 4th field exists, but is empty. - Extra component
PID|1|1523|47^^^^^^^
Only 5 components in a CX data type, the 5th component exists, but is empty - Extra subcomponent
ORC|1|||||27&&
Only 2 subcomponents in a CQ data type, the 3rd subcomponent is empty, but exists. - Extra Repeat
PID|1||||||||||||||||||||4419~5217~
Only 2 repeats allowed for the field "Mother's identifier", the repeat is empty, but exists.
- In each of these cases, you must locate the failing object and extend the type to allow an additional object of that type.
- Field
Add a field of ST to the end of the segment with a suitable name in the segments_nnn.xsd - Component
Create a new Custom CX data type (i.e. CX_XtraComp) in the datatypes_nnn.xsd and add a new component to the custom CX data type. Update the field in the segments_nnn.xsd file to use the custom data type instead of the standard datatype.
- Subcomponent
Create a new Custom CQ data type that accepts an additional TS value at the end of the data type. Create a custom TQ data type that uses the new custom CQ data type as the first subcomponent. Modify the ORC segment to use the new CQ data type at ORC.7 instead of the standard CQ data type.
- Repeat
Modify the Field definition for PID.21 in the segments_nnn.xsd to allow more repeats in the field.
© Geeks with Blogs or respective owner