Splitting file into multiple HL7 messages

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Splitting file into multiple HL7 messages

  • Creator
    Topic
  • #54259
    Weston Olmstead
    Participant

      I’m hoping someone could offer some advice on the best practice/preferred approach to the following. I have a file that is repeating with no delimiters. I’m using a TPS script I wrote to add the MSH, PID, PV1 segments and the CRLF on the end of the ZSEG2, and I’ve used the same TCL to format the file into having the HL7 format (instead of just ZSEG1, ZSEG2 files that repeat over and over).

      This is all occuring on my inbound TPS pre-processing, and then I have a raw route to the outbound TCP/IP HL7. However, this is being sent from cloverleaf in one large TCP/IP message. I’m trying to covert these into seperate Hl7 messages in the outbound. Its also likely that I’m going to have to a translation on this file.

      The format currently (after my TPS scripts) on the inbound thread is:

      MSH  

      PID  

      PV1  

      ZSEG1

      ZSEG2

      MSH  

      PID  

      PV1  

      ZSEG1

      ZSEG2

      I’ve read on here about splitting this up into two messages in two ways:

      1. Creating a xLate that does a “Suppress” at the start, and then iterates through each Hl7 message copying the inbound to the outbound and adding a continue inside the iterate. I’ve tried this with no success, but i may have been an issue on my part.

      2. A TCL script to do what appears to be the same thing (split the message on rn, place it in a new variable, and add that variable do a msgset using the same MSGID and then adding it to a DISPLIST that contains all the continues. I’m a bit unclear on this one, as the sample scripts I’ve seen all appear to be using the same msg ID (doing a set MSGID2 [msgcopy] $msgID), unless the msgcopy function generates a new id. Even in this case, I dont know how many iterations i’m going to get in each file, it could be 1, it could be 100 (and vary by day).

      What is the general consensus on how to approach this given the current format of my message (I’ve confirmed the message is in the above format after my TPS scripts using the TPS testing tool).

      Any guidence is appreciated.

    Viewing 1 reply thread
    • Author
      Replies
      • #80754
        Charlie Bursell
        Participant

          What’s wrong with simply splitting on the linefeed?  If you really need the linefeed, and I don’t know why, you can add it back in as you forward the messages

        • #80755
          Weston Olmstead
          Participant

            That is what I had in mind, but I’m still a bit fuzzy on how the TCL calls within cloverleaf work so I wasn’t able to get it work properly (I’ll have to revisit it as a learning exercise).

            I ended up doing it in an xLate, it turns out the issue was my structure / message format. If anyone viewing this thread later is looking for a solution, I’ve included it below.


            I ended up creating a message format/structure as one big set, as follows:

            {

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.