› Clovertech Forums › Cloverleaf › PDF to Embedded PDF
I’m looking to take a PDF file dropped to a file path and embed that PDF in an outbound HL7 message going from Cloverleaf to Athena. Is this workflow feasible? What would be the best way to set this up? Any help is appreciated.
This is fairly straight-forward. Use a result message (ex ORU) as the base HL7 and populate it as required. The OBR segment should be coded as usual. The PDF will be inserted into an OBX segment, in OBX.5. The PDF must be encoded in base64 before inserting into OBX.5.
package require base64
set code [catch {base64::encode -maxlen 0 “$msg”} encoded_data]
if {$debug > 1} {echo “$module – base64 encode code: $code”}
if {$code} {
echo “$module error code $code for base64 encoding PDF document”
lappend dispList “ERROR $mh”
msgmetaset $mh USERDATA “base64 decoding error – MUSE EKG PDF mrn: $ekgmrn date: $ekgdate”
return $dispList
}
if {$debug > 2} {echo “$module – encoded_data: $encoded_data”}
Determine if your vendor needs more metadata on the PDF. For instance, Cerner Soarian Clinicals wants to see ‘ED’ in OBX.2, ‘AP’ in OBX.5[1], ‘PDF’ in OBX.5[2], ‘Base64’ in OBX.5[3] and the base64-encoded data in OBX.5[4].
It is helpful to have a temporary second destination thread that has an outbound tcl proc which reads the message, extracts the encoded PDF, decodes the PDF back into binary, and then writes the binary output to a windows file with a PDF extension. You should be able to open up the PDF successfully, to verify that you encoded it correctly. Don’t forget to set your inbound thread protocol encoding to binary and use a fileset read option of ‘single’ or ‘EOF’ (same for your temporary outbound thread).
Peter Heggie
PeterHeggie@crouse.org
Peter:
Thank you! I’m still newer to Cloverleaf so how would you build the threads for this in NetConfig. Should the tcl be attached to a upoc? Sorry for the novice questions.
Tim,
There are a few things I will mention:
Just keep in mind always that PDFs can be large (really large) and ever time a new copy exists, the engine is impacted.
It would be good if you can get some information regarding what the average PDF size might be and also what the largest might be so you can pro-actively evaluate the best architecture to use in Cloverleaf.
I may not have covered everything and given your current novice situation (that will change quickly) you may have questions regarding what I have presented or other questions.
Please feel free to post your questions here. We all were novices once – no one is born knowing Integration or Cloverleaf.
This forum is here to help you.
If you want to you can email me directly and I will try to assist you.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Oh and you will probably need to specify a VRL for the IB message if using an Xlate.
The VRL defined with one field of unlimited length.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
There’s also the issue of populating the rest of the message.
Where will you get the patient’s name/DOB/gender/MRN/encounter/etc ? Does the message need to contain order codes/descriptions, order numbers, document IDs ?
The system that’s producing the PDF files either has to encode all required info into the file names, generate an auxiliary file with that info, or better, a trigger message that carries all of that stuff.
Jeff Dinsmore
Chesapeake Regional Healthcare
This thread is a few months old, but hoping people are still active. I am working on this exact issue, but not needing to actually imbed the PDF as it’s already been done. My issue is I use a 3rd party tool to FTP down the file into a folder, Cloverleaf grabs the file but its not processing. The file just disappears. Nothing in the error log, and nothing other than notes that a file was found, opened & found EOF regarding the actual file being processed.
Attached are the log & the file in question.
I have run it through the Testing Tool and attached that as well.
This is just a pass-through interface at this point, no TCL processing going on. Its just picking up the file, and sending it through to its destination.
Any help would be appreciated. Thanks.