iNTERFACEWARE Products Manual > Installing and Using Chameleon > Tutorials and Exercises > HL7 to Application > Step 2 - Mapping Data From HL7 > Setting Up the Segment Grammar |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
The segment grammar of an HL7 message is the sequence of segments that forms the 'signature' of the message. The segment grammar specifies the order in which the segments appear, and whether the segments are optional or repeating. When you use Chameleon to process HL7 messages, you must define the segment grammar for each message type that your application will recognize. When Chameleon parses a message and recognizes its type, Chameleon then checks whether the segment grammar of the message matches the segment grammar that you have defined for that message type. When you define a segment grammar for a message type, you do not need to include all possible segments in the grammar. You do not even have to include all segments that are actually present in the message. The minimum requirements for the segment grammar are:
In our tutorial example, suppose that we want to extract information from the PID (Patient Identification) segment. In this case, the segment grammar must include the MSH and PID segments. These segments were imported into Chameleon in Importing the Segments. To set up the segment grammar:
Note that order is important in a segment grammar: segments must appear in the grammar in the order in which they appear in the message. In the sample message, the PID segment follows the MSH segment; therefore, in the segment grammar, the PID segment must be below the MSH segment.
This is very important, since it means that Chameleon will ignore any other segments found in the message but not in the segment grammar. This makes configuration much faster, since you only need to specify the segments that you are interested in. Moreover, it also ensures that the configuration will not be broken should your counterparty unexpectedly insert new segments into the messages they send to you. |