Run All Business Rules in Router & Combine Results

Primary tabs


We have several rules in router to validate HL7 messages, each rule check a particular field in HL7 message and send back response.  We want to run all rules and combine the rules responses into some variable/object and at the end if variable/object is empty it means message is valid, else send the value from this variable/object. This way one message we dont run it again and again, and we can send one message and response will give us combine results from all rules. 

For example,

Rule 1 - Check MSH.12 field, Send response "MSH.12 value not valid", and RETURN

Rule 2 - Check PID.3 field, Send response "PID.3 value not valid", and RETURN

Rule 3 - Check PD1.3 field, Send response "PV1.5 value not valid" and RETURN

So we will change the rules a below

Rule 1 - Check MSH.12 field, Add response "MSH.12 value not valid" to some XXX Variable/Object

Rule 2 - Check PID.3 field, Add response "PID.3 value not valid", to some XXX Variable/Object

Rule 3 - Check PD1.3 field, Add response "PV1.5 value not valid" to some XXX Variable/Object

Instead of getting single response, we want to show value from XXX Variable/Object with combine response  "MSH.12 value not valid", "PV1.4 value not valid"

any guidance is appreciated. 



I believe this would be easier to build in a BPL instead of routing rules.   The validation logic can be built directly in the BPL or even done in a validation transformation. (The source is the HL7 message, the target is the Response message.)  If the response message comes back to the BPL empty or "all good" then you could proceed to process the HL7 message and send the good response, otherwise send the combined response from the transformation.

So basically from router we send to DTL (validate msg), if msg comes back as NACK send it back to BS, else send it to BP? Correct

is it possible to share one simple rule example like HL7.DOB  field is future date then generate NACK message from DTL and send back to the router.

It is cleaner to send from the service to a BPL  process that does the validation.  The BPL returns the response to the service.  Then you can either directly route the message from the BPL or you could send it to a router.  So the BPL validation process would be the first to examine the message and make the decision if it is good or not.   When the message hits the routing rules you know it is good.

If you haven't done any BPL please visit InterSystems learning services or contact your sales engineer or service executive to help.