web stats
Mapping Multiple Segments - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2019, 07:50 AM
Golfmachine Golfmachine is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default Mapping Multiple Segments

Hello! I'm sure this is a very simple inquiry but I very stumped. I have been receiving hl7 messags that I wish to convert into more "standardized" versions. I am having problems with multiple OBX lines as different tests may have different numbers of OBX segments. For example, if I were to process a urinalysis, I would receive something like:

OBX|1|ST|CBC^Complete Blood Count||""||||||I
OBX|2|NM|HGB^Hemoglobin||""|g/L|130 - 170||||I|||||
OBX|3|NM|HCT^Hematocrit||""||0.40 - 0.50||||I|||||
OBX|4|NM|RBC^Total RBC||""||4.63 - 6.08||||I|||||
OBX|5|NM|MCV^ MCV||""|fL|79.0 - 92.0||||I|||||
OBX|6|NM|MCH^ MCH||""|pg|25.7 - 32.2||||I|||||
OBX|7|NM|MCHC^ MCHC||""|g/dL|32.3 - 36.5||||I|||||
OBX|8|NM|WBC^Total WBC||""|x 10\S\9/L|4.00 - 10.00||||I|||||
OBX|9|NM|NEUT^ Neutrophils||""|%|0.40 - 0.80||||I|||||
OBX|10|NM|LYMPH^ Lymphocytes||""|%|0.20 - 0.40||||I|||||
OBX|11|NM|EOSI^ Eosinophils||""|%|0.01 - 0.06||||I|||||
OBX|12|NM|MONO^ Monocytes||""|%|0.02 - 0.10||||I|||||
OBX|13|NM|BASO^ Basophils||""|%|0.00 - 0.02||||I|||||
OBX|14|NM|PLT^Platelet||""|cumm|150,000 - 400,000||||I|||||

If I always have tests with 14 OBX segments, I can just use an outbound template as so:
MSH|^~\&|||||||^|||2.5
PID|||||^^|||
PV1|||||||||||||||||||||||||||||||||||||||||||||
ORC||||||||||^^^||^^^^|||||||||||
OBR||||^||||||||||||^^^||||||||||||||||&&&^^|&&&^^ |&&&^^|&&&^^||||||||||||||||^^|^^|^^|^^|^^|^^|^^|| ||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||
OBX|||||||||||||||||^^||

However, depending on the tests, I may have just 1 OBX segment or 5 OBX segments. It's not always going to be 14 segments. Is there a way to add in an outbound template but with a condition of "make new OBX segments based on how many OBX segments were from the inbound hl7?"

I know it's a very noob question but I would really appreciate the help!
Reply With Quote
  #2  
Old 11-18-2019, 08:13 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 247
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Personally, I would leave the OBXes out of the outbound template and build those as needed with a JavaScript transformer based on logic.
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #3  
Old 11-18-2019, 08:17 AM
Golfmachine Golfmachine is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default

I see so I should just use this template:

MSH|^~\&|||||||^|||2.5
PID|||||^^|||
PV1|||||||||||||||||||||||||||||||||||||||||||||
ORC||||||||||^^^||^^^^|||||||||||
OBR||||^||||||||||||^^^||||||||||||||||&&&^^|&&&^^ |&&&^^|&&&^^||||||||||||||||^^|^^|^^|^^|^^|^^|^^ || ||

and then use message builders for them?

How would I do the OBX segments then? I've been trying to read up on the for each javascript but it doesn't seem to be working for me hehe
Reply With Quote
  #4  
Old 11-18-2019, 08:26 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 247
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Yes, just like that, then add segments using:

Code:
var i = 0;

var obx = createSegment('OBX', tmp, i++);
obx['OBX.2']['OBX.2.1'] = "test #1 ";

var obx = createSegment('OBX', tmp, i++);
obx['OBX.2']['OBX.2.1'] = "test #2 ";
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #5  
Old 11-18-2019, 08:37 AM
Golfmachine Golfmachine is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default

I think I'm starting to get it. If it's not too much of a hassle, can you please help guide me in simple mapping without changing anything first? Say I have

OBX|1|ST|CBC^Complete Blood Count||""||||||F
OBX|2|NM|HGB^Hemoglobin||120|g/L|130 - 170|L|||F|||20191015001740|CTRLAB^CENTRAL LAB|JMDELACRUZ^Jessica May E. Dela Cruz PRC 0078638
OBX|3|NM|HCT^Hematocrit||0.386||0.40 - 0.50|L|||F|||20191015001740|CTRLAB^CENTRAL LAB|JMDELACRUZ^Jessica May E. Dela Cruz PRC 0078638

I want to map just OBX-1 so that I will have outbound

OBX|1
OBX|2
OBX|3

For my transformer javascript, should it be
var i = 0;

var obx = createSegment('OBX', tmp, i++);
obx['OBX.1']['OBX.1.1'] = msg['OBX.1']['OBX.1.1'];
Reply With Quote
  #6  
Old 11-18-2019, 08:50 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 247
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Because there are multiple OBXes in the incoming message, you will have to ITERATE through the OBXes in msg to have it do the creation of the OBX in the tmp as it hits each OBX in the msg. You can have it copy the whole OBX if you want...

Code:
var i = 0;

for each (seg in msg..OBX)
	{
	createSegment('OBX', tmp, i);
	tmp['OBX'][i] = seg.copy();
	i++;
	}
or just the OBX.3 of each:

Code:
var i = 0;

for each (seg in msg..OBX)
	{
	var obx = createSegment('OBX', tmp, i);
	obx['OBX.3']['OBX.3.1'] = seg['OBX.3']['OBX.3.1'].toString();
	obx['OBX.3']['OBX.3.2'] = seg['OBX.3']['OBX.3.2'].toString();
	i++;
	}
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #7  
Old 11-18-2019, 09:00 AM
Golfmachine Golfmachine is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default

I understand the iteration now!!!

Thanks a lot!
Reply With Quote
  #8  
Old 11-18-2019, 09:01 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 247
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

If you would like some training / help on specific projects or topics, please let me know!
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #9  
Old 11-18-2019, 09:08 AM
Golfmachine Golfmachine is offline
Mirth Newb
 
Join Date: Jun 2019
Posts: 13
Golfmachine is on a distinguished road
Default

Thanks for the offer

Right now this really opens up a lot of doors for me. Will experiment on my own a bit

Thanks again!
Reply With Quote
  #10  
Old 11-18-2019, 09:19 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 247
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Of course! I'm here if you need me!
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
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 11:24 AM.


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