web stats
Passing data structure between channels - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2017, 03:43 AM
vill vill is offline
OBX.1 Kenobi
 
Join Date: Dec 2011
Posts: 33
vill is on a distinguished road
Default Passing data structure between channels

I am having a problem where I am having a problem passing JSON between different mirth channels. The problem is how do i transform this string into an hl7 message that mirth can handle. I can already decode message element below but i need a way to convert the message element into an HL7 structure as if channel 1 sent channel 2 an HL7 message so i can access the e4x elements (ie) msg[PID]......

The setup is Channel 1 receives and sends JSON structure to Channel 2.

JSON structure is as follows:

the message element is base64 encoded
filename - just name of the file JSON was retrieved from



{

message: "4usouT&_...."
filename: "testFile.txt"


}
Reply With Quote
  #2  
Old 08-26-2017, 09:00 AM
odo odo is offline
OBX.3 Kenobi
 
Join Date: Feb 2017
Location: Luxembourg
Posts: 142
odo is on a distinguished road
Default

Quote:
Originally Posted by vill View Post
i need a way to convert the message element into an HL7 structure
Code:
// decode base64-encoded message
var hl7Message = new String(FileUtil.decode(<BASE64-ENCODED MESSAGE>));
// and transform it to XML
var xmlMessage = new XML(SerializerFactory.getSerializer('HL7V2').toXML(hl7Message));
Reply With Quote
  #3  
Old 08-27-2017, 04:45 AM
vill vill is offline
OBX.1 Kenobi
 
Join Date: Dec 2011
Posts: 33
vill is on a distinguished road
Default

thanks
Reply With Quote
  #4  
Old 08-28-2017, 07:18 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

You can also pass objects between channels without needing serialization, by using the source map. On a Channel Writer you can do this with the metadata table. When using router in a JavaScript context, you can send a RawMessage object containing the message and a source map with whatever entries you want.
__________________
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
Reply

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 07:36 AM.


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