web stats
Multiple OBX Segments from query - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2014, 09:56 AM
wzubke wzubke is offline
Mirth Newb
 
Join Date: Mar 2014
Location: Minnesota
Posts: 11
wzubke is on a distinguished road
Default Multiple OBX Segments from query

Hello to all! I apologize if this has already been addressed elsewhere but I was unable to locate it.

I am new to Mirth connect and am attempting to use a database query to create an HL7 v2.3 message. Where I am stuck is in the creation of multiple OBX segments during the mapping. Each OBX segment will have the same values in all areas except the SETID (OBX 1) and Observation Value (OBX 5).

I can manipulate the database query as needed to make mapping as easy as possible in MIRTH but an unsure how to begin.

Thanks in advance!

Wade Z.
Reply With Quote
  #2  
Old 03-03-2014, 10:16 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Are you using a Database Reader? If so, note that each row in the result set will be processed as a discrete message through the channel. It sounds like instead what you want is to aggregate the rows together and send only a single message through. We have an open issue for that (MIRTH-2337) but in the meantime you can use a JavaScript Reader instead, build up a custom message, and return it. Then in your transformer you can build an HL7 message, iterating through each row in your inbound message and creating an OBX segment for each one.
__________________
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 03-04-2014, 09:30 AM
wzubke wzubke is offline
Mirth Newb
 
Join Date: Mar 2014
Location: Minnesota
Posts: 11
wzubke is on a distinguished road
Default

Thanks for your comments. Just to clarify the database query will only return one result per message that needs to be sent.

I will be creating one long string field containing all of the OBX values necessary. My thought was that I could use a delimiter of some sort so that the transformer can parse the large string and create segments for each delimited section as well as increment the OBX setid.

For example my OBX query value could look like the following with a bar delimiter "visit for diabetes|patient name|visit date|medication list|"

MY OBX segments after processing would look something like the following

OBX|1|ST|NOTE||visit for diabetes||||||F||||||
OBX|2|ST|NOTE||patient name||||||F||||||
OBX|3|ST|NOTE||visit date||||||F||||||
OBX|4|ST|NOTE||medication list||||||F||||||

Is something that can be accomplished?
Reply With Quote
  #4  
Old 03-04-2014, 01:28 PM
skekasaurus skekasaurus is offline
OBX.3 Kenobi
 
Join Date: Dec 2013
Posts: 145
skekasaurus is on a distinguished road
Default

Certainly possible, I do this kind of thing all the time. My exact process is a little different than yours, but nothing you can't adjust to suit your needs.


What I do instead of creating a single string delimited is to actually produce a full message, then any custom values I need I put into the very last segment of the message and in the transformer the message is auto converted to xml so I can just do something like:

Code:
connectorMap.put('value1', msg['NTE']['NTE.1']['NTE.1.1'].toString());

EDIT:
In your situation, using the pipes as my loop control and assuming you're doing all this from javascript:

Code:
PSEUDO CODE, UNTESTED

mySplitString = myDBString.split('|');

var obxCounter = 1;
for (var i = 0;i<=mySplitString.length() - 1;i++)
{
   createSegmentBefore('OBX', msg.NTE);
   msg['OBX']['OBX.1']['OBX.1.1'] = obxCounter;
   msg['OBX']['OBX.5']['OBX.5.1'] = mySplitString[i];

   obxCounter++;
}

So even if you don't do exactly what I do, you could still use a transformer to parse your database returned string and work with the values accordingly.

Last edited by skekasaurus; 03-04-2014 at 01:47 PM.
Reply With Quote
  #5  
Old 03-06-2014, 09:38 AM
wzubke wzubke is offline
Mirth Newb
 
Join Date: Mar 2014
Location: Minnesota
Posts: 11
wzubke is on a distinguished road
Default

Thanks for the reply I will give this a shot and let you know what I come up with.
Reply With Quote
Reply

Tags
hl7, mapping, obx

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 05:26 AM.


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