web stats
Delete duplicate OBX segment from second instance - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2018, 09:07 AM
gsuresh543 gsuresh543 is offline
What's HL7?
 
Join Date: Feb 2018
Posts: 2
gsuresh543 is on a distinguished road
Default Delete duplicate OBX segment from second instance

I am beginner to Mirth connect .Any experts can you please help me with this .
Thanks in Adavance
I want to delete duplicate OBX segment from second instance onwords. Delet NTE and OBR.2 segments also.

SOURCE MESSAGE:
MSH|^~\&|LCS|LCA|LIS|TEST9999|199807311532||ORU^R0 1|3629|P|2.2
PID|2|2161348462|20809880170|1614614|20809880170^T ESTPAT||19760924|M|||^^^^
00000-0000|||||||86427531^^^03|SSN# HERE
ORC|NW|8642753100012^LIS|20809880170^LCS||||||1998 0727000000|||HAVILAND
OBR|1|8642753100012^LIS|20809880170^LCS|008342^UPP ER RESPIRATORY
CULTURE^L|||19980727175800||||||SS#634748641 CH14885 SRC:THROA
SRC:PENI|19980727000000||||||20809880170||19980730 041800||BN|F
OBX|1|TX|^^^19825-9^Case Signout Location^LN|0|||||||F|||20180403|
OBX|2|TX|^^^22636-5^Specimen Clinical Information^LN|0|-2.\.br\R13.19, K21.9, R07.89, K22.2, K44.9, K29.70\.br\Dysphagia, other, GERD, Non-cardiac chest pain\.br\Nodule\.br\Erythema, R/O H pylori||||||F|||20180403|
OBX|3|TX|^^^34071-1^Warning Message^LN|1|Some of these immunohistochemical stains may have been developed and the performance characteristics determined by Biopsy Diagnostics. Some may not have been cleared or approved by the U.S. Food and Drug Administration. The FDA has determined that such clearance or approval is not necessary. This test is used for clinical purposes. It should not be regarded as investigational or for research. This laboratory is certified under the Clinical Laboratory Improvement Amendments of 1988 (CLIA-88) as qualified to perform high complexity clinical laboratory testing.||||||F|||20180403|
OBX|4|TX|^^^46029-5^ICD9 Code^LN|0|K29.80 K31.89||||||F|||20180403|
OBX|5|TX|^^^18771-6^Electronically Signed By^LN|0|Zhu M.D. Ph.D., Weijian, Electronic Signature||||||F|||20180403|
OBX|6|TX|^^^18647-8^Case Signed^LN|0|2018-04-03||||||F|||20180403|
OBR|2|8642753100012^LIS|20809880170^LCS|997602^.^L |||19980727175800||||G|||19980727000000||||||20809 880170||19980730041800|||F|997602|||008342
OBX|1|TX|^^^19825-9^Case Signout Location^LN|0|^^^^^^||||||F|||20180403|
OBX|2|TX|^^^22637-3^Diagnosis^LN|0|COLINIC MUCOSA WITH ACTIVE CHRONIC INFLAMMATION ULCERATION AND REGENERATIVE CHANGES (SEE COMMENT)^BNEGATIVE FOR DYSPLASIA OR VIRAL CYTOPATHIC EFFECT IN THE CURRENT BIOPSY||||||F|||20180403|
OBX|3|TX|^^^18106-5^Procedure^LN|0|||||||F|||20180403|
OBX|4|TX|^^^19763-2^Material Submitted^LN|0|ColonTerminal Ileum, Biopsy\.br\||||||F|||20180403|
OBX|5|TX|^^^22634-0^Gross Description^LN|0|Received in a formalin-filled specimen container with the patientís name, medical record number, and "Terminal Ileum, Colon". It contains 7 portions of light tan mucosal tissue ranging from 0.1 cm to 0.5 cm in the greatest dimension. The specimen is entirely submitted in one cassette. TS 1\.br\||||||F|||20180403|
OBX|6|TX|^^^22635-7^Microscopic^LN|0|Initial and deeper sections have been prepared and examined.||||||F|||20180403|
OBX|7|TX|^^^22636-5^Specimen Clinical Information^LN|0|Ileo pouch bxs, r/o inflammation\.br\||||||F|||20180403|
OBX|10|TX|^^^18771-6^Electronically Signed By^LN|0|Zhu M.D. Ph.D., Weijian, Electronic Signature||||||F|||20180403|
OBX|11|TX|^^^18647-8^Case Signed^LN|0|2018-04-03||||||F|||20180403|
NTE|1|L|MORAXELLA (BRANHAMELLA) CATARRHALIS
NTE|2|L| HEAVY GROWTH
NTE|3|L| BETA LACTAMASE POSITIVE


OUTPUT MESSAGE:
MSH|^~\&|LCS|LCA|LIS|TEST9999|199807311532||ORU^R0 1|3629|P|2.2
PID|2|2161348462|20809880170|1614614|20809880170^T ESTPAT||19760924|M|||^^^^
00000-0000|||||||86427531^^^03|SSN# HERE
ORC|NW|8642753100012^LIS|20809880170^LCS||||||1998 0727000000|||HAVILAND
OBR|1|8642753100012^LIS|20809880170^LCS|008342^UPP ER RESPIRATORYCULTURE^L|||19980727175800||||||SS#6347 48641 CH14885 SRC:THROASRC:PENI|19980727000000||||||20809880170| |19980730041800||BN|F
OBX|1|TX|^^^19825-9^Case Signout Location^LN|0|^^^^^^||||||F|||20180403|
OBX|2|TX|^^^22637-3^Diagnosis^LN|0|COLINIC MUCOSA WITH ACTIVE CHRONIC INFLAMMATION ULCERATION AND REGENERATIVE CHANGES (SEE COMMENT)^BNEGATIVE FOR DYSPLASIA OR VIRAL CYTOPATHIC EFFECT IN THE CURRENT BIOPSY||||||F|||20180403|
OBX|3|TX|^^^18106-5^Procedure^LN|0|||||||F|||20180403|
OBX|4|TX|^^^19763-2^Material Submitted^LN|0|ColonTerminal Ileum, Biopsy\.br\||||||F|||20180403|
OBX|5|TX|^^^22634-0^Gross Description^LN|0|Received in a formalin-filled specimen container with the patientís name, medical record number, and "Terminal Ileum, Colon". It contains 7 portions of light tan mucosal tissue ranging from 0.1 cm to 0.5 cm in the greatest dimension. The specimen is entirely submitted in one cassette. TS 1\.br\||||||F|||20180403|
OBX|6|TX|^^^22635-7^Microscopic^LN|0|Initial and deeper sections have been prepared and examined.||||||F|||20180403|
OBX|7|TX|^^^22636-5^Specimen Clinical Information^LN|0|Ileo pouch bxs, r/o inflammation\.br\||||||F|||20180403|
OBX|10|TX|^^^18771-6^Electronically Signed By^LN|0|Zhu M.D. Ph.D., Weijian, Electronic Signature||||||F|||20180403|
OBX|11|TX|^^^18647-8^Case Signed^LN|0|2018-04-03||||||F|||20180403|


MY CODE:

var indices = new java.util.TreeSet();//msg['OBR'][0]['OBR.28']['OBR.28.6'].toString()
for each (obr in msg.OBR) {
if (/K/.test(obr['OBR.28']['OBR.28.6'].toString()))
var obxArray = getSegmentsAfter(msg,obr,'OBX');
for each (obx in obxArray)
if (/F/.test(obx['OBX.11']['OBX.11.1'].toString()))
for each (obx2 in obxArray)
if (obx.childIndex() != obx2.childIndex() && obx['OBX.3']['OBX.3.4'].toString() == obx2['OBX.3']['OBX.3.4'].toString())
indices.add(obx.childIndex());
}

for each (i in indices.descendingSet().toArray())
delete msg.children()[Number(i)];

var newOBXNum = 1;
for each (obx in getSegmentsAfter(msg,obr,'OBX',true)){
obx['OBX.1']['OBX.1.1'] = newOBXNum++;
}


delete msg['NTE']
delete msg['OBR'][1];
Reply With Quote
  #2  
Old 04-10-2018, 12:29 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,037
agermano is on a distinguished road
Default

I don't understand what you're trying to do. Your sample output looks like you kept the first OBR, then all the OBX segments under the second OBR. That doesn't match what you said in the description, and neither of those match what it appears your code is trying to do.

If you're able to clarify what you are trying to accomplish I think someone will be able to help you.
Reply With Quote
  #3  
Old 04-11-2018, 01:07 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 835
siddharth is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
That doesn't match what you said in the description, and neither of those match what it appears your code is trying to do.
haha..made me chuckle!
__________________
HL7v2.7 Certified Control Specialist!
Reply With Quote
Reply

Tags
hl7 message, javascipt, mirth 3, oru

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 06:37 PM.


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