Question Christine Nyamu · Aug 31, 2023

How to Search If OBX 5 contains a certain value in consecutive OBXs in BPL

I need to search for the following values "SEDATION:  " and "Procedure" In consecutive OBX 5 as seen below. Note that sometimes the OBX 5 containing "Procedure" may be followed by other characters/text hence I am leaning towards using a contains statement. 

OBX|028|TX|OP^Operative Note^D4D^11504-8^Surgical operation note^XXX||SEDATION:  ||||||C|
OBX|029|TX|OP^Operative Note^D4D^11504-8^Surgical operation note^XXX||Procedure:

Only when they appear consecutively do I want to process the message as an ORU using the BPL. Not sure how to go about it and would appreciate any assistance. Thanks 

Product version: IRIS 2021.2

Comments

Christine Nyamu  Sep 1, 2023 to Luis Angel Pérez Ramos

Hi Luis, thanks for your response. However, the interface in question doesn't have a rule, only BPL. All the routing gets determined by the BPL. 

0
Luis Angel Pérez Ramos  Sep 4, 2023 to Christine Nyamu

No problem @Christine Nyamu ! Take a look to this code:

Set context.matchFound = 0// Get count of OBR segmentsSet tOBXCnt = request.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(*)")

 // Loop through OBXs and evaluate field contentsFor tIter = 1:1:tOBXCnt
 {
   set nextIter = tIter+1if tIter < tOBXCnt
   {  
     If ((request.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp("_tIter_").OBX:ObservationValue")["SEDATION:") &&
       (request.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp("_nextIter_").OBX:ObservationValue")["Procedure"))
     {
       Set context.matchFound = 1
     }
   }
   
 }

This code will check the OBX segments and check a variable to 1 in case that "SEDATION" and "Procedure:" are in consecutive segments.

You can add that code in an Activity of your BPL and check the matchFound variable.

0
Christine Nyamu  Sep 8, 2023 to Luis Angel Pérez Ramos

Hi @Luis Angel Pérez Ramos 
Thank you, the code worked perfectly in the BPL. How can I change it to work in the DTL?

I need to search for the following values "SEDATION:  " and "Procedure" In consecutive OBX 5 and if true set OBR 4.1 = "28014-9"

OBX|028|TX|OP^Operative Note^D4D^11504-8^Surgical operation note^XXX||SEDATION:  ||||||C|
OBX|029|TX|OP^Operative Note^D4D^11504-8^Surgical operation note^XXX||Procedure:
0
Luis Angel Pérez Ramos  Sep 11, 2023 to Christine Nyamu

That's easy! You only need to add in your DTL an action with the following code:

Set matchFound = 0// Get count of OBR segmentsSet tOBXCnt = source.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp(*)")

 // Loop through OBXs and evaluate field contentsFor tIter = 1:1:tOBXCnt
 {
   set nextIter = tIter+1if tIter < tOBXCnt
   {  
     If ((source.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp("_tIter_").OBX:ObservationValue")["SEDATION:") &&
       (source.GetValueAt("PIDgrpgrp(1).ORCgrp(1).OBXgrp("_nextIter_").OBX:ObservationValue")["Procedure"))
     {
       Set matchFound = 1
     }
   }
   
 }
 if (matchFound = 1)
 {
  do target.SetValueAt("28014-9","PIDgrpgrp(1).ORCgrp(1).OBR:UniversalServiceID.identifier")
 }

As you can see, we keep the seach of the "SEDATION:" and "Procedure" strings and after that, if we find it in our source message, we just update the value of the specific field in the target.

0
Luis Angel Pérez Ramos · Sep 1, 2023

And in case that you want to be sure that SEDATION and Procedure are consecutives:

0