Import/Read csv file

Clovertech Forums Cloverleaf Import/Read csv file

  • Creator
    Topic
  • #118218
    Alison Benecchi
    Participant

      How do I import an HL7 .csv file?  When I look at it in the smat DB, each line is a separate HL7 message.

    Viewing 2 reply threads
    • Author
      Replies
      • #118219
        Matthew Brophy
        Participant

          is your protocol inbound style set to ‘eof’ or ‘hl7’?

          does your hl7.csv file have message terminators included before the start of each message?

          • #118224
            Alison Benecchi
            Participant

              Each line is separated by cr/lf.  No there are no terminators before the start of each message.  Where would I see the inbound protocol?  I have the Protocol set to File with CR to CRNL

            • #118227
              Matthew Brophy
              Participant

                if it helps, we ran into this issue a while back, as well

                HL7 File w/ no terminators

                attached pic is the inbound protocol

                 

                Attachments:
                You must be logged in to view attached files.
            • #118225
              Jim Kosloskey
              Participant

                If you cannot get the source file changed to a more proper construct, I think you will need some Tcl and use the Style of EOF so the entire file is treated as one physical ‘message’. Then in the IB UPoC your Tcl would break that physical ‘message’ into logical messages releasing each logical message to the engine.

                A properly constructed file would likely have cr after each segment and cr/lf after the last segment of each HL/7 message. The source system should be able to do that.

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #118226
                Charlie Bursell
                Participant

                  Are there several messages in a file?  If not a simple fix would be a one line Tcl proc, assuming each line is a segment,  to substitute newline with the empty string:
                  msgset $mh [string map “\n {}” [msgget $mh]]
                  return “{CONTINUE $mh}”

                  Leaving each segment terminated with the CR as it should be

                  If multiple messages in the file a little more is needed.  Do same as above except
                  set msgs [string map “\n {}” [msgget $mh]]
                  set msgs [string trimleft [string map “MSH| \nMSH|” $msgs]] ;# all but last has LF

                  msgsset $mh “”    ;# save time copying if large file
                  set dispList

                       ;# Kill original

                    Then in a loop:

                    foreach msg [split $msgs \n] {
                    set newmh [msgcopy $mh]
                    msgset $newmh $msg
                    lappend dispList “CONTINUE $newmh”
                    }

                    return $dispList

                     

                    This is off the top of my pointed head so may be some fat finger errors but that is the gist of it.

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