No announcement yet.

hl7 batch protocol xml

  • Filter
  • Time
  • Show
Clear All
new posts

  • hl7 batch protocol xml

    Has anyone successfully processed HL7 XML batches yet? I noticed there's an option for "process batch files" but it doesn't seem to apply to a file that contains a batch of hl7 messages. I've successfully extracted the batch's payload:

    var oru = msg['MESSAGEBATCH']['MESSAGES'].toString();
    var hl7 = SerializerFactory.getHL7Serializer(false, false).fromXML(oru);

    but I don't know how to split the files and process each message individually. The second line in the script will always fail because the batch contents (the stuff in the CDATA block) isn't going to be valid XML because there's no document root.

    Any suggestions on how to implement this would be appreciated. Particularly if there's some feature of Mirth that can do this automatically without a lot of custom transformer javascript programming.


  • #2
    Re: hl7 batch protocol xml

    AFAIK, when Mirth reads a batch file, it split it into its messages, and generate an output for each one.


    • #3
      Re: hl7 batch protocol xml

      Mirth will only process HL7 batch files. If you would like to split up XML batch files, you should do the following:

      1. Create an XML channel
      2. Make your destination a Channel Writer, None
      3. In your source transformer, loop through each "message" group (repeating tags for each message). Something like:

      for each (message in msg['MESSAGEBATCH']['MESSAGES']){
      router.routeMessage("New XML Channel", message);

      (Just to be clear - the batch contains HL7 as XML, not formatted with Pipes, right?)
      4. Create a new channel called "New XML Channel" (or whatever you'd like) and set it to receive XML.

      What will happen is the original channel will get the batch, split it in the source and route each individual message to another channel that does the actual processing of the messages.

      Chris Lang