web stats
How to convert Hl7 2.x to a different version of 2.x - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2012, 05:52 AM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default How to convert Hl7 2.x to a different version of 2.x

Hi everyone, I am new to Mirth and after reading the forums and links online I founded out Mirth is capable of converting HL7 to different versions(for example like 2.3.1 to 2.5.1). All of the links states that this can be done, however there is no explanation. I am having trouble on where to start. Is this the right code to change to a different version of HL7 2.x?

message=message.replace("|ORU|", "|ORU^R01|");
message=message.replace(/\|2\.3.1\|/i,'|2.5.1|');
return message;



Thank you all.
Reply With Quote
  #2  
Old 06-04-2012, 06:00 PM
glenn71 glenn71 is offline
OBX.3 Kenobi
 
Join Date: Nov 2010
Location: Sydney Australia
Posts: 129
glenn71 is on a distinguished road
Default

Welcome tvo,


To start off:
1. create a transformer step of 'javascript' type.
2. paste a sample msg of what you are receiving into the Inbound Message Template
3. note now in the message trees tab you have a list of segments.. you can drag and drop from the message tree to the transformer rules.
4. in your transformer step add the following javascript:
msg['MSH']['MSH.12'] = "2.5.1";
msg['MSH']['MSH.9']['MSH.9.2'] = "R01";

Have a play dragging from the message tree and changing stuff in your transformer rule.

You will note that you can create transformer rules in the 'source' and also 'destination'. If it is done in the source it affects all destinations.
Reply With Quote
  #3  
Old 06-05-2012, 06:06 AM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default

Thank you Glenn, I have followed your directions and when I tried to redeploy the channel I get the following error message:


[2012-06-05 09:49:17,785] ERROR (com.mirth.connect.connectors.file.FileMessageRece iver:234): Unable to route.org.mule.umo.routing.RoutingException: Failed to transform message before applying the filter. Failed to route event via endpoint: ImmutableMuleEndpoint{connector=com.mirth.connect. connectors.file.FileConnector@d3a0c0b, endpointUri=file://C:/Users/tuan.vo/Desktop/Trace5, transformer=Transformer{name='ByteArrayToString', returnClass=false, returnClass=false, sourceTypes=[class [B, class java.lang.String]}, name='_fileEndpoint#-1851494063', type='receiver', properties={}, transactionConfig=org.mule.impl.MuleTransactionCon fig@74f86050, filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: java.lang.String

My 'source' is file reader and 'destination' is file writer, I am getting data from a txt file and trying to output a different version of Hl7(in this case version 2.5 from version 2.3.1) to a new txt file.

Any help is appreciative, thanks.
Reply With Quote
  #4  
Old 06-05-2012, 03:44 PM
glenn71 glenn71 is offline
OBX.3 Kenobi
 
Join Date: Nov 2010
Location: Sydney Australia
Posts: 129
glenn71 is on a distinguished road
Default

can you upload your channel config? Right click on the channel and select export.
Reply With Quote
  #5  
Old 06-05-2012, 06:55 PM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default

Hi Glenn, I have attached my channel config on a txt file.

I have manage to not get any errors after spending some time looking at Mirth but I am confused on what are the next steps to take to get my output for a different version of HL7 v.2x.


A problem I encounter is whatever I put into the 'template' for the 'destinations' tab, it just copies and put it in my output txt file (like its bypassing the entire transformer and just copying the 'template' to the txt file).

Thank you for bearing with me and taking your time to help me.
Attached Files
File Type: txt channel_config.txt (7.4 KB, 60 views)
Reply With Quote
  #6  
Old 06-05-2012, 10:10 PM
glenn71 glenn71 is offline
OBX.3 Kenobi
 
Join Date: Nov 2010
Location: Sydney Australia
Posts: 129
glenn71 is on a distinguished road
Default

Hi tvo,
1. if you have more than one message in the input file then change the source connector & enable 'process batch files'.
2. in the destination connector there is a template window where you can specify how the data is formatted when it's written to the file. At the moment you have ${message.id} in there.. change this to ${message.encodedData}. Make sure you stick a carriage return in after ${message.encodedData} otherwise your file will contain one very long line ;-)

'message.encodedData' is referring to the transformed version of the message which you have modified in the javascript rules.
Reply With Quote
  #7  
Old 06-06-2012, 08:50 AM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default

Thank you very much Glenn.

Mirth worked like a charm, it is a very good and useful tool in dealing with HL7.

I have a few more questions if you don't mind.

First, when I deploy my channel, the file in my output txt keeps on duplicating the transformed message nonstop. How do I fix this?

Second, is there a general rule of thumb on how to code the java script to convert to other 2.x versions of HL7? (For example 2.2 =>2.4, 2.5.1 => 2.3, 2.3.1 =>2.6 and so forth.)

Again, thank you, you have been a big help!
Reply With Quote
  #8  
Old 06-06-2012, 12:48 PM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default

Also, as I was comparing the input txt and the output txt, I noticed that only the version name in the msh changed and the ro1 from ro8.

Everything else was the same, due to the same data being transfer, is that accurate?

Thanks.
Reply With Quote
  #9  
Old 06-06-2012, 12:59 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Quote:
Originally Posted by tvo View Post
Also, as I was comparing the input txt and the output txt, I noticed that only the version name in the msh changed and the ro1 from ro8.

Everything else was the same, due to the same data being transfer, is that accurate?

Thanks.
I think you may be misunderstanding...

To fully convert the message, you'll have to map over each potentially differing field (following any possible new field regex requirements, etc.). Just changing MSH.12 is just going to change MSH.12, not anything else in the message. That said, HAPI (which Mirth uses) has several tools that you can use to validate and check differences. Or better yet, assuming you or your company has purchased the HL7 implementation guides, those will tell you exactly what's different between versions. Generally speaking, most people just do "loose" conversions, by just changing whatever's necessary to make it successfully post in the client's EMR. *shrugs*
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #10  
Old 06-06-2012, 04:46 PM
tvo tvo is offline
Mirth Newb
 
Join Date: Jun 2012
Posts: 10
tvo is on a distinguished road
Default

Hi Nick, thanks for your insight.
I saw this link :

http://www.mirthcorp.com/community/w...ng+Transformer

Can I get an example of mapping over a different field? I understand you drag a field to the transformer from the message trees with type mapper but what do you actually type in the mapping tab?

Thanks.
Reply With Quote
Reply

Tags
hl7 conversion

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


All times are GMT -8. The time now is 04:16 PM.


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