web stats
getSerializer to convert HL7 to XML - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2013, 04:48 AM
irhm irhm is offline
Mirth Newb
 
Join Date: May 2012
Location: Oxford, UK
Posts: 6
irhm is on a distinguished road
Default getSerializer to convert HL7 to XML

My channel reads records from an input file; part of each record is an HL7 message (without <CR> segment delimiters) which I can put into a javascript variable or channelMap. I want to pick out specific fields.
We are just moving to Mirth Connect v3 so it seems sensible to use the getSerializer method to put it into a format I can access in the same way as I would if it had come as a normal message into the channel.

Does anyone know of any examples of this kind of thing using the Serializer Factory class?
Or other ways of achieving the same thing?
thanks
Reply With Quote
  #2  
Old 12-05-2013, 07:19 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Yes you can certainly do that:

Code:
var serializedHL7 = new XML(SerializerFactory.getSerializer('HL7V2').toXML(er7String));
However, there needs to be segment delimiters. Otherwise how would you know for sure when one segment ends and the next begins?
__________________
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
  #3  
Old 12-09-2013, 09:07 AM
irhm irhm is offline
Mirth Newb
 
Join Date: May 2012
Location: Oxford, UK
Posts: 6
irhm is on a distinguished road
Smile

Thanks, that worked well and easier than I expected by looking at javadocs.

I realise I need delimiters - I'll need to search for segment identifiers and add some /r, hoping no clash with content.
Reply With Quote
Reply

Tags
serializer

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 12:00 PM.


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