HL7 File w/ no terminators

Clovertech Forums Cloverleaf HL7 File w/ no terminators

  • Creator
    Topic
  • #117686
    Matthew Brophy
    Participant

      We are tasked with digesting an HL7 flat file with multiple messages, but no message terminators or line breaks are apparent in the file.

      Running the message through the engine / testing tool as an EOF message will find the first message entirely, but not recognize subsequent messages. If there were message terminators, we could loop through and reset the message header, repeat…

       

      With no delimiting formatting in the file, is the best solution just to (proc) open and regsub all “MSH” to “\rMSH” and/or add carriage returns for each field?

      Attachments:
      You must be logged in to view attached files.
    Viewing 0 reply threads
    • Author
      Replies
      • #117693
        Charlie Bursell
        Participant

          The only way I know of is a simple proc to split on.  I would use string map.

          set newfile [string trimleft  [string map

            $oldfile]]

            $ I use MSH| in case the term MSH in within a message

            The trimleft is to get rid of the newline created in front of first message.

            This assumes the file is terminated with a linefeed so no newline need be inserted after the last message.

            Read it in a full file then something like:

            keylget ARGS MSGID mh

            set hl7msgs  [string trimleft  [string map

                [msgget $mh]]]

              # In case very large file no need of wasting memory
              msgset $mh “”

              # Kill original
              set dispList

                #loop through and send one at a time
                foreach msg $hl7msgs {

                set nmh {msgcopy $mh]
                msgset $nmh $msg
                lappend dispList “CONTINUE $nmh”

                }

                return $dispList

                 

                Make sure I did not fat-finger something 🙂

            Viewing 0 reply threads
            • You must be logged in to reply to this topic.