HL7 Terser

Since Camel 2.11

HAPI provides a Terser class that provides access to fields using a commonly used terse location specification syntax. The Terser language allows to use this syntax to extract values from messages and to use them as expressions and predicates for filtering, content-based routing etc.

Sample:

import static org.apache.camel.component.hl7.HL7.terser;
...

   // extract patient ID from field QRD-8 in the QRY_A19 message above and put into message header
   from("direct:test1")
      .setHeader("PATIENT_ID",terser("QRD-8(0)-1"))
      .to("mock:test1");

   // continue processing if extracted field equals a message header
   from("direct:test2")
      .filter(terser("QRD-8(0)-1").isEqualTo(header("PATIENT_ID"))
      .to("mock:test2");

Terser Language options

The HL7 Terser language supports 1 options, which are listed below.

Name Default Java Type Description

trim

true

Boolean

Whether to trim the value to remove leading and trailing whitespaces and line breaks