Question
· Nov 20, 2023

Optimizing HL7 Routing Rules: Filtering ADT_A08 Messages Without OBXs

Hello,

First of all thanks for your time reading this doubt.

We have discovered the following behaviour. Inside a Router we have a roule which needs to filter out the ADT_A08 messages which have not OBXs.

The legacy system had this rule implemented:

(((Document.{OBX(1).SetIDOBX}<"1")||((Document.{EVN:EventReasonCode}!="COD")&&(Document.{EVN:EventReasonCode}!="FIN")))

 

However we have tested it and it does not filter out the ADT_A08 messages.

Is there any way to express inside a Rule, that we need to discard ADT_A08 messages which have not OBXs?

 

We have been investigating this class which provides the functions to use inside a Rule: " Ens.Util.FunctionSet"

We do observe a "Contains" function but we do not see a "Count" function.

 

We have also read:

How to work with Rules: https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=EB...

How is Routing Rule Editor expected to work: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

 

Could you help us please?

 

Thank you for your time, thoughts, replies and for your help.

Thanks.

Product version: IRIS 2020.1
Discussion (5)3
Log in or sign up to continue

Hi @Yone Moreno Jimenez !

You can do something like this to filter messages with no OBX:

Do a foreach by OBX, in case that OBX exists you can redirect the message to the proper business component and jump out of the loop. @withOBX is a local variable to check if exists any OBX segment, if the value is "0" then there is no OBX segments and you can redirect the message to another business component.

You can use the "*" shorthand for obtaining a count of the number of repeating segments (or fields, or groups) in a when clause. Anything greater than 0 evaluates to "true," so adding a Not() around the expression negates that:

Note: The original reply had Document.DocTypeName rather than Document.Name as the first part of the condition expression. The DocTypeName property refers to the message structure, not the actual message trigger event. That's in the Name property.

Thanks @Jeffrey Drumm thank you so much, Jeffrey Drumm, for your prompt and precise solution! Your explanation is thorough and greatly appreciated. Your time, assistance, and support mean a lot. The clarification about using the '*' shorthand and the correction regarding Document.DocTypeName versus Document.Name were particularly helpful. Thanks again for your invaluable contribution!

It worked as expected!