SIIM 2008 PlugFest - Mirth on Stage
Ron Sweeney on 2008-05-21 14:58:00 UTC
We got our Plugfest on! For awhile now I have wanted a “booth” like atmosphere for powerful OSS products… and this year, thanks to Paul Nagy, we got it. I got a chance to show off Mirth who played the integration role in the demonostration. I have to thank Jeff Peters from Webreach for providing the cool swag and everything I needed to represent this outside of his organization. Of course, I need to thank Spectrum Health for letting me have some professional hack time at these venues, and would like to thank SIIM for letting Paul’s brain child come of fruition, I hope it gets a chance next year and a shot a refinement. With that being said, it was the first Plugfest. I immediately would like to say that the tables should NOT have been in the center of the room, but rather against the walls, or in aisleways, much like a vendor show. We could have been facing folks one at a time instead of trying to “talk in circles” literally. This also would have given the opportunity to set up some A/V and video screencasting distribution a little smoother. Another point, Mirth was somewhat of a star, and I needed more representation. I think I underestimated that, and next year, Im going to beg Webreach to send somebody out to help. At the ring of the bell, I was instantly swamped and intimidated, but obliged most interested best I could with sample channels, some swag from the webreach camp, and put my MacBook to work by ripping 12 adhoc CD’s with the screencasts, sample channels and webinars. Participants to the plugfest were cordial to say the least, and some had already deployed some interesting integrations with the product. I would have liked more time, (how about an all day thing Paul?) to see what they have done, but the evil of moderating is participating sometimes becomes a challenge. Can you believe I missed the dcm4chee table altogether and it was right next to me? This is ok however, since I got this cool dcm4che.org hat hat to wear all over the Emerald City, and was also knighted with cool polo shirts from Webreach and dcm4che (PACS Mafia). Here are the resources from the PlugFest in case we ran out: Mirth Install on Windows Mirth Install on Mac OSX SIIM – PlugFest CD 2008 WebReach Mirth Appliances Handout Mirth-JavaScript Reference Mirth-SIIM News Winter 2008 | ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PDF Extraction and Conversion with Mirth
Ron Sweeney on 2007-12-24 15:39:00 UTC
![]() |
So here is the story, with a not-so-agile ending, but effective solution. Our EKG system is robust enough to send out various |
Goal: Receive Message from EKG system, and place resulting PDF on a remote filesystem with the name, fin, mrn of the patient as its filename. This sub-intellectual blathering on the interwebs outlines: - how I stripped the pdf from the HL7 message - how I used my own custom java class in Mirth. - how Mirth and iText saved the day for the second time in the solution. Mandantory Screencast Freshly Brewed Java Strip/Encode Class Convert a PDF Version using Mirth Channel |
If you are still hanging in there, here is the process flow:
- EKG system sends out HL7 Message with PDF embedded.
- Mirth, takes the inbound message, grabs 3 variables from the message and passes the
UUENCODED (I know, Base64 would have been elegant) segment to a java class for appropriation as a file. Mirth then ftp’s
the file to a remote filesystem.
For starters, lets take a look a the Message from Mike Litherland’s HL7 Browser. The Name, FIN, MRN of
the patient (and the requirement) are easy and quite frankly are no fun at all. The Good, Bad, and the Ugly exist
in the not so popular ZPD segment as in the screenshot below.

If you take a closer look at this segment you will notice
that its telling you what kind of file it is PDF (ZPD2.1), some integrity checks on the size of the file in (ZPD3.1, ZPD3.2),
and the “meat” of our solutions exists in ZPD3.3. So check it, by looking at it, its UUencoded. This really sucks, but is not
a big deal, and gives us the opportunity to flex some of Mirth’s ability to include some custom stuff and also to flex
some java foo. Im going to note here that I actually think Mirth can do this nowadays, and I can recall also Brendan Haverlock
showing me some Mirth utils in the form of:
importPackage(Packages.com.webreach.mirth.util);
Entities.getInstance().encode(“String”);
Entities.getInstance().decode(“String”);
But im NOT using this here, I whooped up a Java Class StripDecode, with two methods Strip/Decode, the first method will escape all the
HL7 escape chars from the segment, the second method Decode, Decodes it and write it to a target file name. I uploaded it to the ‘libcustom’
folder on Mirth and was able to access it in the channel transformer via javascript.
Here is the Java Class.
And below is a screenshot to the javascript that includes the Java Class:

Ok, pretty sweet, we are now writing the extracted pdf’s to the local filesystem on Mirth, we compliment the channel
with another channel that reads the files and ftp’s them to a remote server which ends up in the specified target location.
But, HOUSTON WE HAVE A PROBLEM.
After all the hackery, it ends up that the EMR has having issues with our PDF version(1.0) we are writing out. Its not our fault,
its the pdf version that is all encoded up in the segment. We need at least a 1.2, so what to do now?
Chris Bonis and I googled it about and ended up at the iText site. Cool, maybe we can include it and
do some conversions? Better yet, Mirth had iText already included in the libraries, all we had to do was call it and BAM!
We were writing out 1.4’s from our Adobe 1.0’s using the Stamp method. We seriously read it in, and write it out.
Isn’t that just awesome?

Special thanks to Jeff Peters, and Chris Lang at WebReach Inc for the opportunity to
hack on some Mirth appliances!







