Announcement

Collapse
No announcement yet.

Create NTE after all OBX's following OBR if it meets criteria

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

  • Create NTE after all OBX's following OBR if it meets criteria

    I have the following message that I need to create an NTE after all of the OBX's following the first OBR, and not the second OBR.

    If OBR.4.1 = "CD FLD", then I need to create an NTE segment following each of the child OBX's.

    Mirth Version 3.4

    OBR|1|6486^LAB|6486^LAB|CD FLD^Cell Count Diff Fluid^L|||201706201328|||||||201706201328||FAMHA^F amily^Hays^FACP^^^MD FACC||00005960||||||LAB|F||^^^^^R|
    OBX|1|ST|rbcfl^RBC, Body Fluid^L|1|2|cmm|See Below|N||A^S|F|||201706201330|IH^Hays Medical Center 4382800^L|
    OBX|2|ST|wbcfl^WBC, Body Fluid^L|1|3|cmm|See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|3|ST|flc^Color, Body Fluid^L|1|COLORLESS||See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|4|ST|flapp^Appearance, Body Fluid^L|1|CLEAR||See Below|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|5|ST|neufl^Neutrophils, Body Fluid^L|1|1|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|6|ST|lymphfl^Lymphocytes, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|7|ST|monofl^Mononuclear WBCs, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|8|ST|eosfl^Eosinophils, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|9|ST|basofl^Basophils, Body Fluid^L|1|0|%||N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|10|ST|source fld cd^Source^L|1|PERITONEAL|||N||A^S|F|||201706201331 |IH^Hays Medical Center 4382800^L|
    NTE|1||REFERENCE RANGES:|
    NTE|2||COLOR ...................... PALE YELLOW|
    NTE|3||APPEARANCE ................. CLEAR|
    NTE|4||WBC ........................ <500/cmm|
    NTE|5||RBC ........................ <25,000/cmm|
    NTE|6|
    NTE|7||INTERPRETATION:|
    NTE|8|| Cell Type Associated Pathologic Conditions|
    NTE|9|| --------- --------------------------------|
    NTE|10|| Neutrophilia Peritonitis and malignancy|
    NTE|11|
    NTE|12|| Lymphocytosis Tuberculosis, malignancy, chylous|
    NTE|13|| ascites and lymphoproliferative|
    NTE|14|| disorders.|
    NTE|15|
    NTE|16|| Eosinophilia Chronic peritoneal dialysis,|
    NTE|17|| lymphoma atrophy, vasculitis,|
    NTE|18|| eosinophilic gastroenteritis,|
    NTE|19|| and ruptured hydatid cyst|
    OBR|2|6486^LAB|6486^LAB|CD CSF^Cell Count/Rflx Diff CSF^L|||201706201328|||||||201706201328||FAMHA^Fam ily^Hays^FACP^^^MD FACC||00005960||||||LAB|F||^^^^^R|
    OBX|1|ST|csfc^Color, CSF^L|1|COLORLESS||Colorless|N||A^S|F|||2017062013 31|IH^Hays Medical Center 4382800^L|
    OBX|2|ST|csfapp^Appearance, CSF^L|1|CLEAR||Cryst Clr|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|3|ST|wbc csf^WBC, Cerebrospinal Fluid^L|1|2|cmm|0-5|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    OBX|4|ST|rbc csf^RBC, Cerebrospinal Fluid^L|1|1|cmm|0-1|N||A^S|F|||201706201331|IH^Hays Medical Center 4382800^L|
    NTE|20||NOTE: RBC counts in CSF have limited diagnostic value. A|
    NTE|21||few RBC's are normal in all CSF due to contamination by|
    NTE|22||blood vessels injured during the lumbar puncture.|

  • #2
    From what I understand if you encounter OBR.4.1 = "CD FLD" then create NTE after every OBX for that OBR. You can try this:

    Code:
    if (OBR4.1 == 'CD FLD') {
    		for each (obx in getSegmentsAfter(msg, msg.OBR[0],'OBX')) {
    			
    			// Create the NTEs
    		}
    }
    For the given example, it will create 10 NTEs - one after every OBX
    Last edited by Thoughts_Shared; 07-10-2017, 05:02 AM. Reason: I

    Comment


    • #3
      How do you access the function, getSegmentsAfter()?
      Is this from a jar we can download?

      Comment


      • #4
        Originally posted by rkMC View Post
        How do you access the function, getSegmentsAfter()?
        Is this from a jar we can download?
        This should help:

        http://www.mirthcorp.com/community/f...4608#post24608

        Comment


        • #5
          Mirth 3.5

          Thanks for the link to the routines. I still have another question. How do you build the NTE's? Do you reference the msg and tmp same as normal mapping? If you are going to build NTE's should the outbound template contain NTE? one or more? If the inbound has NTE's in the message (msg) and you create an NTE for each OBX, how do you reference the NTE iteration? The example above has 10 OBX's and 19 NTE's, how do you create new NTE's off of the OBX's without mixing up the inbound NTE's?
          You can see I'm a little confused.
          Bottom line for this newb is what should the inbound and outbound template look like for the above example and how do you create the new messages? I'm trying, but the code is getting one error after another such as:

          Transformer error
          ERROR MESSAGE: Error evaluating transformer
          com.mirth.connect.server.MirthJavascriptTransforme rException:
          CHANNEL: Lab Results
          CONNECTOR: Destination 1
          SCRIPT SOURCE: TRANSFORMER
          SOURCE CODE:
          443: {
          444: for each(obx in getSegmentsAfter(msg, obr, 'OBX', true))
          445: {
          446: // map inbound obx to outbound obx
          447: // OBX.1 Set ID
          448: tmp['OBX'][obx_index]['OBX.1']['OBX.1.1'] = obx_index + 1;
          449:
          450: // OBX.2 Resulting Value Type
          451: tmp['OBX'][obx_index]['OBX.2']['OBX.2.1'] = msg['OBX'][obx_index]['OBX.2']['OBX.2.1'].toString();
          452:
          LINE NUMBER: 448
          DETAILS: TypeError: Cannot read property "OBX.1" from undefined
          at abbcf63f-498a-4d0c-a767-e1fb01585839:448 (doTransform)
          at abbcf63f-498a-4d0c-a767-e1fb01585839:509 (doScript)
          at abbcf63f-498a-4d0c-a767-e1fb01585839:511
          at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:154)
          at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.doCall(JavaS criptFilterTransformer.java:119)
          at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
          at java.lang.Thread.run(Unknown Source)

          Comment


          • #6
            Before you can reference OBX.1 of OBX[0], you need to create OBX[0].
            HL7v2.7 Certified Control Specialist!

            Comment


            • #7
              Does anyone know where I can find the routine/function for "createSegmentAfter"?
              I have found code to use this function, but I have only found the createSegmentBefore function.
              Thanks in advance.
              btw: I'm using version 3.5.0.8232 of Mirth Connect

              Comment


              • #8
                Originally posted by rkMC View Post
                Does anyone know where I can find the routine/function for "createSegmentAfter"?
                I have found code to use this function, but I have only found the createSegmentBefore function.
                Thanks in advance.
                btw: I'm using version 3.5.0.8232 of Mirth Connect
                Look for 'Create Segment After Segment' in the Reference tab of filter/transformer.

                Comment


                • #9
                  Originally posted by rkMC View Post
                  Does anyone know where I can find the routine/function for "createSegmentAfter"?
                  I have found code to use this function, but I have only found the createSegmentBefore function.
                  Thanks in advance.
                  btw: I'm using version 3.5.0.8232 of Mirth Connect
                  You have to add the code in the Code Templates. Otherwise you can't call it. Once you have the Code Template configured you can just use it as shown previously.

                  Comment

                  Working...
                  X