HL7 Custom Functions

An important part of any HL7 integration project is the data mapping from one message format to another. TIBCO ActiveMatrix BusinessWorks™ offers advanced functionality in data mapping, including drag-and-drop and a comprehensive suite of built-in functions.

However, no matter how complete the built-in functions are, there is always a need to customize, especially in the healthcare industry. TIBCO ActiveMatrix BusinessWorks™ Plug-in for HL7 with FHIR includes a useful set of custom functions.

See the TIBCO ActiveMatrix BusinessWorks™ documentation for detailed information on how to write, load, and use your own custom functions.

Using HL7 Custom Functions

TIBCO ActiveMatrix BusinessWorks™ Plug-in for HL7 with FHIR includes a set of HL7-related custom functions, which are specified in the bwpluginhl7_HOME/resources/HL7CustomFunctions.class file.

To use these functions:
  1. Create or open a project in TIBCO Business Studio™.
  2. Load the pre-defined class file into the project using the Java Custom Function resource.

Custom Functions Usage

To see the HL7 specific custom functions:
  1. Click on an Activity on the process editor.
  2. In the properties pane, select the appropriate tab (usually the Input tab) and click the Functions tab in the XPath Formula Builder dialog.
  3. Expand the HL7 Functions folder. The custom HL7 functions appear.

Available HL7 Custom Functions

Function Description and Sample Usage

HL7ToDisplayable

Replaces \r with system line separator.

Sample usage:

HL7ToDisplayable($hl7Msg)

currentTimeMillis

Returns current time in milliseconds.

currentTimeStamp

Returns current timestamp in HL7 format: yyyyMMddhhmmss.

deleteSegments

Returns HL7 message after the specified segments are removed.

Sample usage:

deleteSegment($hl7Msg, "ZSH:EVN")

Sample output:

Message will have EVN and ZSH segments removed

displayableToHL7

HL7 requires that all segments end with \r . This function converts DOS/UNIX format file into HL7 ER7 format.

Sample usage:

displayableToHL7($hl7MsgInDisplayFormat)

extractField

Extracts the indexed field from HL7 Message from the first segment with a given segment name.

Sample usage:

extractField($Hl7MsgString, $segmentName,$index )

generateNewGUID

Generates Unique ID.

separateMsgsFromBatch

Returns individual messages in the batch by removing FHS/BHS/BTS/FTS segments.

trimEmptyFields

Trims empty fields from an HL7 message.