HL7: Split up batch file

Introduction

This channel uses the the hl7.batch module to split an HL7 batch file into a table of HL7 messages, and pushes each separate message to the Iguana queue. This enables you to process each of the messages independently using Filter and/or Destination components.

If you have any questions please contact us at support@interfaceware.com.

Using the Code [top]

  • Import the HL7: Split up batch file channel from the Builtin: Iguana Protocols repository
  • Experiment with the code to find out how it works
  • Then add the module(s) to your Translator project
  • Copy the require statement from the channel and add it at the top of your script
    Note: This module uses require to return a single function
  • Adapt the code to your own requirements
  • Use batch.split() to split the HL7 batch into separate messages
  • Interactive scripting help is included for this module

This is the github code for the main module:

How it works [top]

The code is very simple:

  • First it uses a local function ConvertTerminators() to convert any non-HL7-standard terminators
  • Then it uses batch.split() to split the HL7 batch into separate messages
  • And finally it pushes the messages onto the queue with queue.push()

The most importation operation is using batch.split() to split the HL7 batch into separate messages. This function simply ignores the batch header messages (BHS and FHS segments), splits up the payload of HL7 messages, and returns them as entries in a table.

More information [top]