Question
· Oct 7, 2021

HL7 Message: Find a value inside message

First of all thanks for your time and help reading this question:

We would need some help:

The use case is: to add a rule inside a EnsLib.HL7.MsgRouter.RoutingEngine, where we iterate in a EnsLib.HL7.Message to find a specified value inside all OBXs segments. It should return a Boolean

Is there any recommended way, or standard function inside Ensemble, that we could use, without having to develop a new function?

 

We have read:

https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?...

https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?...

Discussion (6)3
Log in or sign up to continue

If you're attempting to determine whether the same value appears in a field for all repetitions of a given repeating segment, the ..RegexMatch() function, virtual document bracket syntax and an appropriately constructed regular expression should be able to handle this:

EDIT: My original example included a caret ("^") as the regex begin string anchor, but it appears the RegexMatch() method forces the pattern the pattern to be begin and end anchored. In other words, the pattern supplied as the 2nd argument is automatically wrapped with "^" at the beginning and "$" at the end. You can add them if you like, but doing so doesn't change the behavior.

Thanks Jeffrey Drumm for your reply

We have observed that our Ensemble's version is:

Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.2.1 (Build 801_3_18358U) Tue Jul 24 2018 16:36:10 EDT

It does not contain "RegexMatch" function in Ens.Util.FunctionSet

We have tried to develop a rule using Length and Contains functions

We would need to detect the following:

if at least one OBX3.1 is "24642" or at least one OBX3.5 = "24642"

What we have developed does not work, and we do not know why

Could you help us, please?

We have been testing, developing and debugging some hours, and we would really appreciate your time, replies, effort, and examples, please

The rule which does not work is:

Being the code:

<rule name="22 09 21 ADTs Antigenos DragoAE -&gt; DRAGOAP" disabled="true">
<constraint name="source" value="GestionPacientesFromSelenev02"></constraint>
<constraint name="msgClass" value="EnsLib.HL7.Message"></constraint>
<constraint name="docCategory" value="2.5"></constraint>
<when condition="(Document.{MSH:MessageType.TriggerEvent}=&quot;A08&quot;)&amp;&amp;(((Length(HL7.[OBX:3.1])=&quot;5&quot;)&amp;&amp;(HL7.[OBX:3.1] Contains &quot;24642&quot;))||((Length(HL7.[OBX:3.5])=&quot;5&quot;)&amp;&amp;(HL7.[OBX:3.5] Contains &quot;24642&quot;)))&amp;&amp;((Document.{OBX(1):ObservationResultStatus}=&quot;R&quot;)||(Document.{OBX(1):ObservationResultStatus}=&quot;C&quot;))">
<trace value="&quot;Se permiten ADTs con código de Antígenos en OBX3.5 o OBX3.1 y con OBX.11 = &apos;R&apos; Creaciones o &apos;C&apos; Modificaciones&quot;"></trace>
<send transform="" target="EnrutadorTestAntigenos"></send>
<return></return>
</when>
</rule>

Could you help us?

Would you know why it does not detect that the OBX3.1 and OBX3.5 are "24642"?

Thanks for your time