Reading HL7 messages into Cloverleaf

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Reading HL7 messages into Cloverleaf

  • Creator
    Topic
  • #50773
    Graham Hartley
    Participant

      I am new to Cloverleaf and particularly HL7.  I am trying to work out what the special character is that separates the different message segments in a HL7 message and more specifically how to generate this using the keyboard.  I.e. in a QRY^A19 message you must place a special character between the MSH and QRY segment otherwise the message cannot be read in Cloverleaf.  I thought this was a carriage return but this doesn

    Viewing 9 reply threads
    • Author
      Replies
      • #67463
        Jim Kosloskey
        Participant

          Graham,

          To make sure of what is in the file I use a provided command line utility called hcihd.

          I usually pipe the output of hcihd to less (unix).

          This will give you a hex dump and you can verify that there is a x0d between segments.

          If there is a x0d between segments and the file looks fine otherwise, what tool in Cloverleaf(R) are you using to read the file and what is it you are experiencing?

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

        • #67464
          Graham Hartley
          Participant

            Thank you very much for your response.  I have tried using the hcihd command and as you stated x0d does separate each segment.  What I would like to know then is how can I add this character to other HL7 messages?  I have been using notepad and getting my example messages from various HL7 documentation.  The problem is that when I copy them from the document the 0xd is not copied.  This results in an error when I try and send the message using the resend (New Line terminated) functionality in Network Monitor.  Once I have managed to get this to work I will do further testing using the application TCPIP Test.  Your help is much appreciated

          • #67465
            Jim Kosloskey
            Participant

              Graham,

              I would suggest using an editor that allows editing in hex.

              I use both Ultra-Edit (which has a minimal charge) and PsPad (which I believe is free.

              However, if the files are coming to you in an improper format you need to get the sender to correct that.

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

            • #67466

              I use vi (or gVim for Windows) for this sort of thing.

              The HL7 segment delimters are carriage returns (r, x0d, and in vi they appear is ^M).

              -- Max Drown (Infor)

            • #67467
              Sergey Sevastyanov
              Participant

                Another hex editor to look at – Hex Editor Neo at <a href="http://www.hhdsoftware.com/Products/home/hex-editor-free.html&#8221; class=”bbcode_url”>http://www.hhdsoftware.com/Products/home/hex-editor-free.html

                They have free version

              • #67468
                David Harrison
                Participant

                  Graham,

                  HL7 segments are separated with the hex 0d character but messages are separated with the hex 0a character.

                  If I have an HL7 test message I want to put through Cloverleaf, I use the PSPad editor http://www.pspad.com/en/download.php  as follows:

                • #67469
                  David Barr
                  Participant

                    David Harrison wrote:

                    There may be a better way, and I would be interested to hear if there is, but it works for me.

                    How about this:

                    Code:

                    perl -pe ‘s/rMSH/rnMSH/g; END { print “n”;}’ infile.msg > outfile.msg

                  • #67470
                    David Harrison
                    Participant

                      That’s great! It works on unix with MAC formatted files.

                      Not being a Perly person, how could this be modified for unix or DOS formatted files?

                      Also, what would be the syntax on Windows?

                      Thanks,

                      Dave

                    • #67471
                      David Barr
                      Participant

                        As far as I know, the same syntax would work on Windows.  I usually use the Cygwin version of Perl when I’m using Windows.

                        You’re calling the files “Mac formatted”, which I wouldn’t really agree with.  They just happen to have CR characters but no NL characters which corresponds to Mac formatted text files.  The reason that the CR’s are there is because that’s the standard character used by HL7.  You then appear to conclude from this that there would be a Unix or DOS equivalent of this format, which there isn’t.  If you’ve got a file that is using NL or CR-NL to separate segments, it’s not following the HL7 standard.  If you commonly see this type of file, I’m curious where you’re getting it from.

                        In case you really do have to deal with files in this format, there is a Perl command that you could use for translation from this format.  Something like perl -ne ‘chomp; (($. > 1 && /^MSH/) && print “n”; print “$_r”; END { print “n”; }’.

                      • #67472
                        Chris Williams
                        Participant

                          David,

                          Where you see those kinds of files is when someone has FTPd the file between different operating systems as ASCII rather than BINARY, an all too common mistake.

                          Also, you need to ask whether this is a SMAT msg file, a new-line formatted file, or someother format.

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