Announcement

Collapse
No announcement yet.

Delete duplicate OBX segment from second instance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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];

  • #2
    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.

    Comment


    • #3
      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!

      Comment

      Working...
      X