Question
· Jun 17

How to apply huge amount of Biz Rules on a cloned object by using Rule Editor?

Hi dear Sir,

I see the DTL chain defined in IRIS, which is applicable if regarding transformation from one protocol to another, and fields/segments mapping:

But Business Rules may be applied on the same message (my case is the same result message HL7 ORU_R01), without transformation from protocol formats to another formats, without mapping from sources to targets.

Below is a diagram with desired workflow on a single cloned Object(This is also the efficient process algorism of Open Source Drools while working with hundreds or thousands of rules). How can we apply this in IRIS?

Please advise.

Product version: IRIS 2023.3
Discussion (8)3
Log in or sign up to continue

Hi Enrico, thank you!

Do you have the sample code?//using a single cloned Object. The purpose is to avoid the huge amount of source-target DTL processes while working with several hundreds of Rules

Here is a sample result message (HL7 ORU_R01) to process

MSH|^~\&|CWS|LAB||EXE11|20200616173921||ORU^R01|20200616173921847|P|2.3|||||||
PID|1||6789||TEST^S^||||||||||||||
ORC|RE|L616041|||||||20200616170303
OBR|1|L616041||HEMATO^HEMATO||20200616170303|20200616000000||||N||||||||||||||F
OBX|1|NM|WBC^WBC^||5.88|||||N|F||||SXN901|6000^6000
..........
================================================

Sample case: 

under condition 1 
update "NM" to "N01" in first rule

under condition 2
update "WBC" to "001" in second rule 

send the cloned object to next process "MyNextProces"

I don't understand your problem, in fact, are you having a problem or you just think there is a problem?

The purpose is to avoid the huge amount of source-target DTL processes while working with several hundreds of Rules 

First, rules do not modify messages, only DTL may modify a message.
Did you measured and verified this supposed "huge amount" or you think/guess this is actually happening? 

Please note that HL7 storage is complex/advanced and very efficient, only changed segments are actually duplicated in storage, even from different HL7 messages.
Did you actually checked what is actually stored in your scenario?

I feel and believe that you are looking for a solution to a non existent problem.

Each DTL calls “ConstructClone” to make a copy of the message before making any changes to it. There will be hundreds of cloned-objects in case of hundreds of DTLs

It is expected to run the rules chain by using Rule Editor without DTL, namely against a SINGLE cloned-object. It will be much efficient in case of hundreds or thousands of rules under same protocol, for example HL7 2.3, ORU_R01.

Question is how to pass the cloned-object from one rule to another, and send the modified object to target Process or Operation in Rule Editor?
 

Each DTL calls “ConstructClone” to make a copy of the message before making any changes to it. There will be hundreds of cloned-objects in case of hundreds of DTLs

Keep in mind that when you create a clone of an HL7 message using %ConstructClone() the segments ARE NOT CLONED.

Only modified segments will be replaced with the new modified segment content.
The storage of unmodified segments will be "shared" between the original HL7 message and the cloned message.

A little test do demonstrate it:

; open an existing message and see the storage
Set hl7msg=##class(EnsLib.HL7.Message).%OpenId(33)
zw ^EnsLib.H.MessageD(33)

^EnsLib.H.MessageD(33)=$lb("","","Demo.HL7.MsgRouter.Schema:ORM_O01",0,"2024-03-24 01:44:43.142","Demo.HL7.MsgRouter.Schema","C:\temp\hl7\in\XYZ1.txt"_$c(13,10)_" Document# 2, level 1, @Line 11","","",0)
^EnsLib.H.MessageD(33,"segs")=9
^EnsLib.H.MessageD(33,"segs",1)="8480,161"
^EnsLib.H.MessageD(33,"segs",2)="8480,162"
^EnsLib.H.MessageD(33,"segs",3)="8480,163"
^EnsLib.H.MessageD(33,"segs",4)="8480,164"
^EnsLib.H.MessageD(33,"segs",5)="8480,165"
^EnsLib.H.MessageD(33,"segs",6)="8480,166"
^EnsLib.H.MessageD(33,"segs",7)="8480,167"
^EnsLib.H.MessageD(33,"segs",8)="8480,168"
^EnsLib.H.MessageD(33,"segs",9)="8480,169"


; create a clone, save it and see the storage
Set hl7msgClone=hl7msg.%ConstructClone()
Write hl7msgClone.%Save()
Set CloneId=hl7msgClone.%Id()
zw ^EnsLib.H.MessageD(CloneId)

^EnsLib.H.MessageD(37)=$lb("","","Demo.HL7.MsgRouter.Schema:ORM_O01",1,"2024-03-24 01:44:43.142","Demo.HL7.MsgRouter.Schema","C:\temp\hl7\in\XYZ1.txt"_$c(13,10)_" Document# 2, level 1, @Line 11","","",0)
^EnsLib.H.MessageD(37,"segs")=9
^EnsLib.H.MessageD(37,"segs",1)="8480,161"
^EnsLib.H.MessageD(37,"segs",2)="8480,162"
^EnsLib.H.MessageD(37,"segs",3)="8480,163"
^EnsLib.H.MessageD(37,"segs",4)="8480,164"
^EnsLib.H.MessageD(37,"segs",5)="8480,165"
^EnsLib.H.MessageD(37,"segs",6)="8480,166"
^EnsLib.H.MessageD(37,"segs",7)="8480,167"
^EnsLib.H.MessageD(37,"segs",8)="8480,168"
^EnsLib.H.MessageD(37,"segs",9)="8480,169"

; as you can see the new cloned message shares exactly the same segments of the original HL7 message

; modify a segment in the cloned HL7 message, save it and see the storage

Write hl7msgClone.SetValueAt("NEWVALUE","MSH:3.1")
Write hl7msgClone.%Save()
zw ^EnsLib.H.MessageD(CloneId)

^EnsLib.H.MessageD(37)=$lb("","","Demo.HL7.MsgRouter.Schema:ORM_O01",1,"2024-03-24 01:44:43.142","Demo.HL7.MsgRouter.Schema","C:\temp\hl7\in\XYZ1.txt"_$c(13,10)_" Document# 2, level 1, @Line 11","","",0)
^EnsLib.H.MessageD(37,"UserValues")=""
^EnsLib.H.MessageD(37,"segs")=9
^EnsLib.H.MessageD(37,"segs",1)="8992,2"
^EnsLib.H.MessageD(37,"segs",2)="8480,162"
^EnsLib.H.MessageD(37,"segs",3)="8480,163"
^EnsLib.H.MessageD(37,"segs",4)="8480,164"
^EnsLib.H.MessageD(37,"segs",5)="8480,165"
^EnsLib.H.MessageD(37,"segs",6)="8480,166"
^EnsLib.H.MessageD(37,"segs",7)="8480,167"
^EnsLib.H.MessageD(37,"segs",8)="8480,168"
^EnsLib.H.MessageD(37,"segs",9)="8480,169"

; as you can see now the first segment is different, all other segments use the same storage as the original message

The storage and I/O overhead of the cloning performed by DTL is minimal and limited the the strictly necessary modifications.
Of course if you change all the segments content, then all segment will be replaced, there is no options, but more often than not, DTL modify a limited number of segments.

Prefer Rule Editor Framework without DTL(too expensive) if:

  • Working on a single protocol(e.g.,  HL7)

It can be simple and efficient if:

  • Working on a single cloned object(e.g.,  cloned from HL7 msg)

With benefits:

  • Separate Rules logic from the code
  • Edit rules externally with help of Export & Import in Business Rule List page
  • Replace Open Source Drools and bring in their customers