#Business Rules

4 Followers · 128 Posts

Business rules are the part of InterSystems Ensemble production solution which allow nontechnical users to change the behavior of Ensemble business processes at specific decision points.

Question Brett Willis · Jul 16, 2021

I am trying to find the best way to evaluate if OBX-3 = ^IS TEST PATIENT? and OBX-5 =  Y In the same OBX in a Business Rule

OBX|1|NM|P-CSN|1|7623201922192||||||F
OBX|2|NM|P-UCI|2|||||||F
OBX|3|TX|^ADT: PATIENT CLASS|1|Outpatient|||||||||20210715
OBX|4|TX|^IS TEST PATIENT?|1|Y

I started to create a function in a class that uses the Rule [] bracket syntax and  extends  Ens.Rule.FunctionSet:

But after some initial troubleshooting I realized that the [] brackets will not return a value if a field is null, making the two lists different lengths and impossible to compare.

HL7.

1
0 331
Question Tom Philippi · Nov 27, 2017

I am calling a business rule from one of my business processes and I noticed that when the business rule reports an error that the business process calling that rule just stops without any errors. Resultingly it fails to trigger the scope - catch-all construction that is surrounding the business rule. I know that it is possible to view the errors in business rules in the business rules log, but I really like to push an error message to Ens.Alert or something similar when my business rules report an error. How do I achieve that?

2
0 381
Question Scott Roth · May 12, 2021

Awhile back the Developer community helped me with a situation I was having... How to loop through a Repeating Segment and Single Filed, example OBX().5, within a Business Process Rule and compare it against a Data Lookup table.

Well now I need to take it a step further. I need a way to loop through OBR() segment, and loop through OBR().4() and the subfield 4.1 and compare it to a Data Lookup table.

So I thought I could copy my existing function code and add another level to it, but its not returning what I would expect.

ClassMethod DoesValueExistRepeatingSegmentFields(pHL7Msg As EnsLib.HL
2
0 558
Question Scott Roth · Mar 23, 2021

A while back I asked the developer community for a way to loop through repeatable HL7 segments and check them against a Data Lookup table within a Business Rule.

The example I got was the following...

ClassMethod GroupIDExists(pHL7Msg As EnsLib.HL7.Message, pSegment As %String, pField As %String, pLookupTable As %String) As %Boolean
{
            #dim tSeg as EnsLib.HL7.
1
0 777
Question Scott Roth · Jan 7, 2021

I need another set of eyes to look at the following. Instead of a Data Lookup table, I wanted to try to lookup a value against a Cache table that I had build. So I thought I could write a function to run a simple SQL query against the Cache Table and return me a %Boolean value back to my routing rule. However today I found that it was not working properly.

Can someone take a look at the following method and verify that I am doing this correct?

4
0 529
Question Lewis Greitzer · Jul 9, 2018

I would like to examine the contents of my OBX-5 field and not route the message if it contains alphabetic characters. I've tried various combinations of the Match and Contains functions, with no luck. Should I be using the COS ? operator or plaini regular expressions?

e.g.

OBX-5 Contains "\D"

OBX-5 Contains "?.A"

OBX-5 Contains "[A-Z]"

17
0 1696
Question John Nurmi · Jan 5, 2021

I have a operations that is writing 6 values to a table 

Class BHS.Custom.MosaiqCloudPatientsTable Extends (%Persistent, Ens.Request) [ Inheritance = right ]

I need to create a routing rule to evaluate a field in an hl7 ORU message ,  see if it exists in the account column of the table. If it does then allow the message to pass.

This table is not a lookup table. How can I get a function to evaluate a field to this  table?

1
0 542
Question Stuart Byrne · Sep 9, 2020

I have a project to only filter certain pathology results into a downstream system.

Within a HL7 router and business I was planning on using a lookup table and either the exists() or Lookup(), but am having issues when using it with repeating fields or segments.

For example if I perform teh analysis per stated segment usign {} brackets this will work, as each stated repeat is assessed:

(HL7.{PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList(1).ID} DoesNotStartWith "ICE")&&((Lookup("Sunquest.Lorenzo.OBR4Whitelist",HL7.{PIDgrpgrp1(1).ORCgrp(1).OBR:UniversalServiceIdentifier.

2
0 999
Question alex chang · Nov 4, 2020

Hi

My Ensemble platform worked well before. 

Since yesterday , I found out lot of slow request ,I opened trace for one message. 

as above shown. 

It take about 8s from HisEmrRouter to ADTRoutingRule.

 In my opinion, HisEmrRouter And ADTRoutingRule is Simple Rule,  should't do IO operation. should be pure compute. 

Why does it take so long to process the routing?

What Can I do to avoid it spend too much time to routing?

Tks

10
1 555
Question Bukhtiar Ahmad · Oct 6, 2020

Hi

I need to get list of segments from a message ,  so that i can validate if EMR sending all valid segment against a msg structure. calling this function should return me below string

,MSH,EVN,PID,PD1,NK1,PV1,PV2,DB1,OBX,OBX,AL1,DG1,DRG,PR1,ROL,GT1,IN1,IN2,IN3,ACC,UB1,UB2,

Below is my HL7 msg

MSH|^~\&|REGADT|MCM|IFENG||199601061253||ADT^A01|000001|P|2.3.

2
0 753
Question Ahmad Bukhtiar · Sep 23, 2020

Any syntax help, i want to check different msg types and then reach out to the value in that particular segment. Here is example, i want to get SSNNumber from a method. Trying to use NOTIN, and Lookup

Class Training.RulesFunctionSet Extends Ens.Rule.FunctionSet

{

ClassMethod getEmiratesId(pHL7 As EnsLib.HL7.Message) As %String
{
SET msgType = pHL7.GetValueAt("MSH:MessageType.TriggerEvent")
 

IF msgType NotIn "A39,A40,O01,O11,O09,R01" {
return pHL7.GetValueAt("PID:SSNNumberPatient")}

IF msgType In "A39,A40" {
 return pHL7.GetValueAt("PIDgrp(1).

5
0 757
Question Bukhtiar Ahmad · Sep 10, 2020

Hi i have rules and i want to log them to analyse what rules executed , I want to add in the log Msg Controller Id, MRN, Value coming in the message, and my customize text telling whats wrong with this field... i have like 50 rules and at the end i can check the log table and found like 20 entries so it means 20 data issues are there for a given message control id. any advice how to to do it

3
0 327
Question Ahmad Bukhtiar · Sep 1, 2020

Hi 

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
0 361
Question Bukhtiar Ahmad · Sep 7, 2020

Getting routingrules compiling error message. same code works fine for IRIS For Health

/// 
Class Training.HL7Validation.RoutingRule Extends Ens.Rule.Definition
{
Parameter RuleAssistClass = "EnsLib.HL7.MsgRouter.RuleAssist";
XData RuleDefinition [ XMLNamespace = "http://www.intersystems.com/rule]
{
<ruleDefinition alias="" context="EnsLib.HL7.MsgRouter.RoutingEngine" production="Training.HL7Validation">
<ruleSet name="" effectiveBegin="" effectiveEnd="">
<rule name="Valid Sending Facility Code Required">
<when condition="Lookup(&quot;OnboardedFacilities&quot;,HL7.{MSH:SendingFacility.

5
0 315
Question Scott Roth · Jun 19, 2017

I have come across several cases where I need to set a Date filter to send only send any admit/scheduled date past a certain point. We have a couple different date comparison functions but none looking at the true date. Most of them are date + 15 or etc. Does anyone have a good date function they have written to say if x > 20170102 ?

Thanks

Scott

14
0 2474
Question Bukhtiar Ahmad · Sep 6, 2020

Hi 

Getting error message, when calling NACK function that I created. Its working fine on Iris For HeathShare but on HealShare its giving below error msg. Any help.

Error message

Compiling class Hospital.RoutingRules ERROR <Ens>ErrParsingExpression: Error parsing expression 'GenerateNACK("For NewBorn Msg, PID21 Mother Idendentifier should have MRN number",%ErrorStatus)': ERROR <Ens>ErrInvalidName: Invalid name at offset 83   > ERROR #5490: Error running generator for method 'evaluateRuleDefinition:Hospital.RoutingRules' ERROR: Ens.Rule.Definition.

2
0 411
Question Steve Pisani · Jul 15, 2020

Hi,

Business Rules can define a context object,  whose properties are exposed and used in the expressions of the rules. For example, my context object is an object with 3 properties. PropA, PropB and PropC.

When constructing my rules, I can call a custom function, and I have one I built myself called 'myFunction' which takes arguments and I pass in properties of my context object. (I can pass in the value of the context object's PropA, B or C).

6
0 456
Question Scott Roth · Jun 9, 2020

After all these years of doing basic Ensemble work, I am just beginning to venture into using Cache Tables instead of either Data Lookup tables, or what I know of Outside SQL tables using JDBC.  I have several Cache SQL tables that I am building for a project I am working on.  

  • I was wondering if it was possible to use a SQL call to look up a value against a Cache SQL table  within a Business Rule? 
  • Or is this something that I would have to build a custom function for?
9
0 524
Question Scott Roth · Jun 3, 2020

Cache for UNIX (IBM AIX for System Power System-64) 2018.1.3 (Build 414U) Mon Oct 28 2019 11:24:02 EDT [HealthShare Modules:Core:15.032.9026 + Linkage Engine:15.032.9026]

We had an odd situation come up last night. Towards the end of the day one of my team members added a rule to an existing routing rule. When he had hit saved, he got a warning that he would overwrite someone else's changes. He hit cancel, then was able to click save. What he did not know is that there was a syntax issue in his rule that he had put in. He was missing a {  that wasn't caught till hours later.

3
0 292
Question KI Joon Keum · Apr 2, 2019

Does anyone have experience in creating a Business Routing Rule using Exists function?

 

I've used the comma delimited 'In' function, but I would like more manageability. Entering and remove items from a look up table would be much easier to manage then changing the comma delimited string.

Messages go to error state.

Any help would be appreciated.

This is my first post, so if I am doing anything wrong please let me know.

3
0 1753
Question James Fitzpatrick · Feb 10, 2020

Hello,

I am playing around with an HL7 business rule set and a EnsLib.HL7.MsgRouter.RoutingEngine component. I'm wondering how I can get the routing engine to fire a rule when a response is received from a business operation.

I have a simple "debug" statement in my rule to log the "Source" value when a message is received. This debug statement only seems to fire when the message comes as a request from the business service (trace item #1 below).

6
1 910
Discussion Jeffrey Drumm · Feb 7, 2020

I'm not sure what the purpose of this is, but the Management Console causes the browser to refresh periodically. If you're in a form or an editor such as the DTL or Routing Rule editors, you may lose work unless you save frequently. This did not occur in Caché 2018 and earlier releases.

I've had a couple of incidents where I've created a number of rules in the DTL editor, answered the phone or stepped away for a few minutes, then come back to find any work since the last save erased.

I've noticed this in both 2019 and 2020 releases of IRIS.

Heads up!

4
1 601
Question Yone Moreno · Jan 11, 2020

I am trying to create a rule which filters out ADT_A08 messages, when they have an OBX segment and their EVN.4 is "COD" or EVN.4 is "FIN"

The attempt is:

I have sent messages with EVN.4 COD or FIN and they are filtered out correctly

However if I remove EVN.4 and leave just the OBX filled up, the message passes from the Process to the Operation.

How could we express that if the message has OBX, we want it to be filtered out
 

3
0 468
Question Scott Roth · Sep 19, 2019

We have a case where we have 1 message coming in, but then sending two messages out to the same location. Even with FIFO sometimes the messages get out of sequence depending on what is need to be done to the message in the DTL before send. Is it possible to call sleep or Halt or write some kind of a function to put a pause in a routing rule between two sends?

5
0 801
Question Scott Roth · Sep 9, 2019

We have a customer that is not able to accept HL7 result messages that are missing OBX:3.1. I have been trying to create a function that could return a boolean value of 0 if the message didn't meet the expectations of the function.

ClassMethod IsValued(pHL7Msg As EnsLib.HL7.Message, pSegment As %String, pField As %String) As %Boolean
{
            #dim tSeg as EnsLib.HL7.Segment
            
            set tSegCount = pHL7Msg.

7
0 550