HL7 Mule Expression Language Support

This feature is part of the Mule Healthcare Toolkit, which also includes transformers and components for receiving, processing and sending HL7 messages. For details and a full list of available tools, consult the Toolkit’s documentation main page.

The Mule Healthcare toolkit includes two Mule Expression Language (MEL) functions:

  • hl7segment() allows access to a segment in an HL7 message

  • hl7() allows access to values within a segment

The functions use the HAPI (HL7 Application Programming Interface) Terser to provide access to HL7 fields. You can use MEL to access HL7 message contents in any message processor that supports MEL.


Table 1. Obtaining values
---- hl7('/PID-5-1') ----

Returns the value of the PID-5-1 field of the current message

---- hl7segment('AL1') ----

Returns the value of the Al1 segment of the current message

Table 2. Modifying values
---- hl7('/PID-5-1', 'Polly') ----

Sets the value of the PID-5-1 field of the current message to Polly

---- hl7segment('AL1','AL1|1||^Penicillin||Produces hives') ----

Sets the value of the AL1 segment of the current message

Usage Examples

Use a Variable Transformer to initialize the variable HL7event with the value of the EVN segment of the HL7 message:

<set-variable variableName="HL7event" value="#[hl7segment('EVN')]"/>

Use a Set Payload Transformer to obtain a string composed of the fields PID-5-1 and PID-5-2:

<set-payload value="#[hl7('/PID-5-1') + ' ' + hl7('/PID-5-2')]"/>

Use an Expression Component to set modify fields PID-5-1 and PID-5-2:

        hl7('/PID-5-1', 'Polly');
        hl7('/PID-5-2', 'Hedra');

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub