web stats
Converting HL7 to XML - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 02-26-2009, 10:41 PM
r_jyothsna r_jyothsna is offline
Mirth Newb
Join Date: Feb 2009
Posts: 6
Default Converting HL7 to XML


I am new to Mirth tool, can anyone help me in creating a channel which will convert HL7 file to XML file.

Thanks in Advance
Reply With Quote
Old 02-27-2009, 12:57 AM
Tarun Tarun is offline
What's HL7?
Join Date: Feb 2009
Posts: 3
Default Re:Converting HL7 to XML


I am also trying for the same thing, Can you help me in this if you got a solution.

Thanks In Advance,
Reply With Quote
Old 02-27-2009, 01:57 AM
quimicefa quimicefa is offline
Mirth Guru
Join Date: Dec 2007
Location: Barcelona
Posts: 235
quimicefa is on a distinguished road
Default Re:Converting HL7 to XML

Define a channel that reads hl7 plain files from a folder, and define a destination with type FileWriter ...

Drag and drop the encoded message in the content of the file that the destination writes. I can't remember the exact name, but there is a variable that represents the original message as XML

Hope that helps.
Reply With Quote
Old 06-05-2009, 09:16 AM
jkimmel jkimmel is offline
Mirth Newb
Join Date: Jun 2009
Posts: 11
jkimmel is on a distinguished road

I've added this to the wiki at: http://www.mirthcorp.com/community/w...XML+conversion

I tried what was suggested above. Here are the steps I took and my results:
Create a new channel and name it HL7toXML
Incoming data is HL7 v2.x

Source is set to File Reader with a valid directory.

Destination is set to File Writer with a valid directory.
File name is ${ORIGINALNAME}
Append to file is No
drag and drop the Encoded Data from Destination Mappings to Template
Template is: ${message.encodedData}

Saved and enabled the channel. Deployed the channel.

It runs, and I get files in my destination directory that look exactly the same as the original files, which I expected because I didn't make any changes to the default transformer applied to Destination 1.

What else does it take to do this? I read that Mirth's internal representation of the message is XML. Is encodedData Mirth's XML format? Obviously not.
I've attached my exported channel.

When I look at the channel xml, I see that the Destination 1 section looks like:
<name>Destination 1</name>
<property name="scheme">file</property>
<property name="binary">0</property>
<property name="username">anonymous</property>
<property name="outputPattern">${ORIGINALNAME}</property>
<property name="validateConnections">1</property>
<property name="DataType">File Writer</property>
<property name="FTPAnonymous">1</property>
<property name="charsetEncoding">DEFAULT_ENCODING</property>
<property name="password">anonymous</property>
<property name="passive">1</property>
<property name="template">${message.encodedData}</property>
<property name="outputAppend">0</property>
<property name="host">C:/mirth/xmlout</property>

<transportName>File Writer</transportName>

If I then go into the default transformer applied to Destination 1 -> Message Template tab and change the Outbound Message Template to HL7 v3.0, the transformer section in the exported channel xml file (see attachment) changes to:

When I apply my changes to the channel and redeploy, I get HL7 v3.0 xml in my xmlout directory.

So now I've got my first Mirth transformation simply using the built in tool, but XML isn't really what I need. My incoming HL7 files could have multiple messages in them.

I need to:
read each individual message in the file
figure out the hl7 message type
transform it to comma delimited text
and sort them into individual directories based on message type
Attached Files
File Type: xml 2xHL7toXML.xml (4.1 KB, 358 views)
File Type: xml 2xHL7toXML2.xml (4.2 KB, 157 views)

Last edited by jkimmel; 06-05-2009 at 11:55 AM.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion failed when converting datetime doc4child General Discussion 3 06-02-2019 11:06 PM
Converting complete message to XML Tombo Support 3 08-28-2008 05:36 AM
Converting HL7 Message from 2.1 to 2.3 maym2915 Development 0 10-15-2007 09:53 AM
Converting HL7 Message from 2.1 to 2.3 maym2915 Development 0 10-15-2007 09:51 AM
converting transformers from 1.4 to 1.5 gsasquatch Support 4 06-19-2007 11:53 AM

All times are GMT -8. The time now is 06:31 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation