Recently I created a small utility (written in Go) to convert JSON to HL7v2. The JSON follows a specific layout, and I’ve been using Mockaroo to generate it. All of the details are in Github here:

Using Mockaroo + Go To Create Fake X12 834 Files

In the past I had a Mirth channel that would convert X12 834 files to ADTs and CSVs that I needed run a lot of fake/test data through. I use Mockaroo a lot to generate various types of fake data. I haven’t found an easy way to generate X12 directly out of Mockaroo, so decided to spit out JSON with all the segments and fields that I need and write a script to convert that to X12.

Difference in using between Mirth Connect versions

Ran into something recently when moving a channel I inherited from an instance of Mirth Connect to a server running I was seeing the following error in the log when messages were hitting the newly moved channel: ERROR-300: Transformer error ERROR MESSAGE: Error evaluating transformer com.webreach.mirth.server.MirthJavascriptTransformerException: CHANNEL: MedI - Convert orders to HL7 NEW CONNECTOR: sourceConnector SCRIPT SOURCE: LINE NUMBER: 378 DETAILS: TypeError: Cannot call method "toString" of null at com.

Mirth HL7 to PDF example

Quick example of taking an HL7 message, in this case lab results, and creating a PDF document out of them. In fact, here is a link to the example Mirth Connect channel (XML file, right-click download) if you want to import this and go through it yourself. Below is an example HL7 message as well… but keep reading if you want a simple walk through. MSH|^~\&|LAB|LUCENTGLOW|||200909301135||ORU^R01||D|2.3|||||||| PID|1||Z000001078||DOE^JOHN||19500213|M||CA|123 STREET^^KINGSPORT^TN^37660|||||M|||999-99-9999|||||||||||| OBR|1|1973^LAB||BMP^BASIC METABOLIC PANEL^L|||200909301134|||||||200909301134||SLOCA^STRANGE^CARL^W^^^MD||||||||LAB|F||^^^^^R||||||||||||||||| OBX|1|ST|GLU^GLUCOSE,RANDOM^L||100|mg/dL|74-106|N||A^S|F|||200909301134|ML^MAIN LAB^L||| OBX|2|ST|BUN^BLOOD UREA NITROGEN^L||10|mg/dL|9-20|N||A^S|F|||200909301135|ML^MAIN LAB^L||| OBX|3|ST|CRE^CREATININE^L||3.

Get a channel’s state from code

Recently I had a scenario where I needed to know the state of one channel from within another in Mirth Connect. I couldn’t find anything readily available to do this, so I rolled my own Code Template to get the state. Here’s the code for the template: function GetChannelState(channel_id) { var channel_status = "NA"; var channel_count = parseInt(; for(var i=0;i<channel_count;i++) { if (channel_id == { channel_status =; } } return channel_status; } So you can now call the function, pass in the channel’s id that you want to check the state on, and you’ll get back one of the following (according to the ChannelStatus.