HL7 Custom Functions
An important part of any HL7 integration project is the data mapping from one message format to another. 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. ActiveMatrix BusinessWorks Plug-in for HL7 with FHIR includes a useful set of custom functions.
For more information about writing, loading, and using your own custom functions, see the ActiveMatrix BusinessWorks documentation .
Using HL7 Custom Functions
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.
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: The EVN and ZSH segments are removed from the message. |
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 a unique ID. |
generateHash | Generates a hash for a file based on mandatory input parameter
<file> and an optional input parameter
<algorithm>. If an algorithm is not specified, the hash is generated by using the "SHA-1" algorithm as default. The function is flexible to generate hash using different algorithms such as MD5.
Sample usage: Can be used to generate the hash of a file that you want to attach to a resource. For more information, see Attachments for Resources. Sample output: 3F1364458FDDEC2C6B8ECBE8459B87CB1163F488 |
separateMsgsFromBatch | Returns individual messages in the batch by removing FHS/BHS/BTS/FTS segments. |
trimEmptyFields | Trims empty fields from an HL7 message. |