Retrieve pdf file off windows server to embed in HL7

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Retrieve pdf file off windows server to embed in HL7

  • Creator
    Topic
  • #54743
    Kenadi Moore
    Participant

      I’ve been able to write a tcl script to embed a pdf into OBX-5 of an HL7, but only if I put the local directory and file name in my script:

      set fileHandle [open /hci/kfiles/cl.pdf rb]

      set encodedPDF [base64::encode [read $fileHandle [file size /hci/kfiles/cl.pdf]]]

      The problem is that I need to retrieve the file off a windows server based on a link in the original HL7 message.

    Viewing 9 reply threads
    • Author
      Replies
      • #82796
        David Barr
        Participant

          One way that we’ve done this is to set up a third server running Windows and IIS. You can enable FTP on that server and create virtual directories that are mapped to the Windows file shares that you need to access. Cloverleaf can FTP into the IIS server and download files from the share.

          I don’t have a detailed set of instructions for configuring this, but there’s lots of information on the web.

          <a href="https://www.google.com/search?q=iis+virtual+ftp+directory&#8221; class=”bbcode_url”>https://www.google.com/search?q=iis+virtual+ftp+directory

        • #82797
          Rehman Masood
          Participant

            I think FTP is probably going to be better way to go with this like David mentioned. The other alternative would be to setup the windows share via samba so u can access it as a local folder from Cloverleaf.

          • #82798
            Kenadi Moore
            Participant

              Sorry if I’m missing the obvious.  We do have lots of scripts/cron jobs to ftp files to and from our Cloverleaf server.  However, I’m not clear how I could do this as a message is being processed.  The incoming message will have the link to the pdf file in it.  I must then retrieve the file and put it somewhere so that I can do the embedded pdf creation that gets inserted into the message.

              Thanks!

            • #82799
              Rehman Masood
              Participant

                The way I see it is,

                Option 1. Each time you get a message, you ftp to the folder, grab the file, encode it and send the message. Depending on the volume of messages, this might not be feasible for you.

                Option 2. The location where the pdf file is somehow mapped as a link to your unix file system. This will allow you to just locally open the file, encode it and send the message. If the volume is high enough, this just might be the option for you.

              • #82800
                David Barr
                Participant

                  We use a TCP/IP HL7 connection to receive the message with the link. Then we use a TPS proc to convert that to an FTP URL and retrieve the file. You can either use a TCL FTP library to get the file or shell out to a curl or wget command. After you get the message contents you can use Tcllib to base64 encode the file contents and put it in the message.

                • #82801
                  Robert Milfajt
                  Participant

                    There might be another option, but you need to confer with your UNIX admins.  You can set up a Network File Share (NFS) between UNIX and Windows, but this most likely requires third party software.  An NFS will allow you to reference a Windows directory/file with Unix commands using Unix paths.

                    Hope this helps,

                    Robert Milfajt
                    Northwestern Medicine
                    Chicago, IL

                  • #82802
                    Michael Hertel
                    Participant

                      We’ve just done what Robert has just mentioned.

                      The Windows environment is Windows Server 2008 R2.

                      The Cloverleaf environment is AIX 7.1.

                      We had to get the unix admin and windows admins together to allow the NFS mounts/umounts.

                      The unix admins want me to get in and get out with each transaction rather than mount at startup and not unmount until shutdown.

                      In my case, I have the HL7 transaction with the base64 encoded pdf in OBX-5. I am taking OBX-5 payload, decoding it into a pdf file on a local Cloverleaf sub directory, then mounting the Windows box, copy the file to the Windows directory, then unmounting the Windows box and continuing the message to our target system for processing.

                      I know this isn’t what you are looking for but it shows you the mounting and unmounting with NFS using AIX and Windows for free. No need for Samba nor IBM’s Fast connect.

                      So I basically:


                      ######################################################################
                      # Name: pdf_cis_fix
                      # Purpose:
                      # UPoC type: tps
                      # Args: tps keyedlist containing the following keys:
                      #
                      [code]
                      ######################################################################
                      # Name: pdf_cis_fix
                      # Purpose:
                      # UPoC type: tps
                      # Args: tps keyedlist containing the following keys:
                      #

                    • #82803
                      MiDo
                      Participant

                        thanks for this useful tcl , i have the same requirement to decode pdf from xml. field

                        then save the pdf and the xml to special directory.

                        also to change the base64 line in the xml to dst pathfilename

                      • #82804
                        MiDo
                        Participant

                          [0:TEST] Tcl error:

                          msgId = message0

                          proc = ‘pdf_cis_fix’

                          args = ”

                          result = ‘invalid command name “vm_getHL7″‘

                          errorInfo: ‘

                          invalid command name “vm_getHL7”

                             while executing

                          “vm_getHL7 $msg MSH 0 8 0 1”

                             (procedure “pdf_cis_fix” line 37)

                             invoked from within

                          “pdf_cis_fix {MSGID message0} {CONTEXT sms_ib_data} {ARGS {}} {MODE run} {VERSION 3.0}”‘

                        • #82805
                          Michael Hertel
                          Participant

                            You can get my hl7 parser utility here:

                            https://usspvlclovertch2.infor.com/viewtopic.php?p=19423#19423

                            Reposting from a previous thread:

                            Attached are two procs that we’ve created for doing what you want.

                            We use them all the time. They cut development time down to ‘next to nothing’.

                            Charlie probably won’t agree with this method but it works very well for us.

                            Usage is:

                            vm_getHL7

                            and

                            vm_setHL7

                            The only caveat is when dealing with the MSH segment. Adjust the field count by -1 due to the field separator counting as a field.

                            Examples:

                            set event [vm_getHL7 $msg MSH 0 8 0 1] ;(Looking for MSH-9.1, see caveat)

                            set MRN [vm_getHL7 $msg PID 0 3] ;(get MRN)

                            set MRN2 [vm_getHL7 $msg PID 1 3] ;(get MRN from 2nd instance of PID (usually A17 messages))

                            set OBX5 [vm_getHL7 $msg OBX $count 5] ;(part of a foreach that increments $count)

                            and

                            set msg [vm_setHL7 $msg [vm_getHL7 $msg PV1 0 19] PID 0 18] ;(copies value in PV1-19 to PID-1Cool

                            set msg [vm_setHL7 $msg {} PV1 0 19] ;(blank out PV1-19)

                            set msg [vm_setHL7 $msg VMMC MSH 0 3] ;(hard code VMMC in MSH-4, see caveat about MSH)

                            set msg [vm_setHL7 $msg 03 PV1 0 3 0 2] ;(hard code bed value to 03)

                            For additional info you can email me at michael.hertel@vmmc.org

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