Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Retrieve pdf file off windows server to embed in HL7
- This topic has 10 replies, 6 voices, and was last updated 8 years, 8 months ago by Michael Hertel.
-
CreatorTopic
-
July 2, 2015 at 1:18 pm #54743Kenadi MooreParticipant
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.
-
CreatorTopic
-
AuthorReplies
-
-
July 2, 2015 at 3:29 pm #82796David BarrParticipant
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” class=”bbcode_url”>https://www.google.com/search?q=iis+virtual+ftp+directory -
July 5, 2015 at 12:55 am #82797Rehman MasoodParticipant
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.
-
July 6, 2015 at 4:44 pm #82798Kenadi MooreParticipant
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!
-
July 7, 2015 at 2:26 pm #82799Rehman MasoodParticipant
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.
-
July 7, 2015 at 3:17 pm #82800David BarrParticipant
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.
-
July 8, 2015 at 6:30 pm #82801Robert MilfajtParticipant
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 -
July 8, 2015 at 8:48 pm #82802Michael HertelParticipant
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:
[code]
######################################################################
# Name: pdf_cis_fix
# Purpose:
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
#
######################################################################
# Name: pdf_cis_fix
# Purpose:
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# -
January 28, 2016 at 8:03 am #82803MiDoParticipant
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
-
January 28, 2016 at 3:23 pm #82804MiDoParticipant
[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}”‘
-
January 28, 2016 at 5:52 pm #82805Michael HertelParticipant
You can get my hl7 parser utility here:
http://clovertech.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
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.