We use DSLs to enable writing rules for all of the following reasons:
- to create pre-validated constructions of re-usable logic
- to use logical language more familiar to medical informaticists
- to reference clinical data constructed as a virtual medical record (vMR)
- to hide some of the syntactic complexity of Drools
Theere are 39 DSLs used in this URI example, and they fall into several groups, as follows:
DSLs that create and reference intermediate results
We call these intermediate results "Assertions" and they exist in two forms:
Internal Data Model as a class named "Assertion" defined as a String, which can be added to a fact list and used for logical inferencing within Drools
- Drools Global named "assertions", which is a java HashSet<String> that can be have values added or referenced within Drools, but changes to it will not trigger rules to fire. However, it can be referenced outside of Drools, both in the jBPM processes, and by OpenCDS at the end of a stateless Drools session. We use "assertions" both to create intermediate results that we can pass to subsequent steps in a process, and for debugging, since globals continue to exist once control is passed from Drools back to OpenCDS.
All of our DSLs that work with "Assertions" on the RHS of a rule always create both forms of the DSL, so that it can both trigger logical inferencing, and be seen outside of Drools. On the other hand, DSLs that reference "Assertions" in the LHS of a rule always reference the class "Assertion", because that is the form that triggers Drools.
DSLs for the LHS include:
Assertion.Exists - references that an Assertion containing an enumerated concept code exists in Drools working memory
Assertion.Not.Exists - references that a particular Assertion containing an enumerated concept code does not exist in Drools working memory
Assertion.String.Exists - references that an Assertion containing a simple string exists in Drools working memory
DSLs for the RHS include:
- Assert - creates a string using an enumerated concept code, for standardized assertions, e.g., "C3390" which is enumerated in the OpenCDS Apelon instance as "QM HEDIS-FPC 81-100 Percent"
- Assert.NamedDate - creates a string of a name value pair, separated by an equal-sign, e.g., "importantDate=20140704", which might be useful for debugging
- Assert.String - allows you to specify a simple string, e.g."ruleABCfired", or "patientNeedsHbA1cTest"
DSLS that control
Concept.Det.Clin.Stmt.Identify
Concept.Det.Clin.Stmt.Remove
Concept.Det.Entity.Identify
Concept.Det.Entity.Remove
Concept.Det.Rship.Identify
Concept.Det.Rship.Remove
Dem.Age.Time
Enc.From.NamedList.After.Med.SubDispense.Count.Id
Enc.From.NamedList.After.Med.SubDispense.DaysSupply.Active.Count.Id
Enc.From.NamedList.Before.After.Enc.Rship.EncDx.Count.Id
Enc.From.NamedList.Rship.EncDx.Not.Multiple.Count.Id
Enc.Rship.EncDx.Between.Times.Count.Id
Enc.Rship.EncDx.Between.Times.Count.Id
Enc.Between.Times.Count.Id
Init.EvalTime.FpId.EvalpId
Insert.EncListRef.As.NamedList
Insert.EncListRef.As.NamedList
Insert.NamedDate.After.NamedDate
Insert.NamedDate.From.Earliest.Enc.In.NamedList
Missing.DOB
NamedDate.Exists.Not.Null
NamedEnc.Exists.Not.Null
NamedList.Exists.EncListId
NamedList.Exists.Not.Empty
Out.Nested.Obs.Num.Denom
Out.Assertions
Out.Concepts.All.Read
Out.Concepts.All.Write
Out.Nested.Obs.Num.Denom
Out.Root.Obs.Focus.EvalpId
Set.EncListId.Add.EncListRefs
Set.EncListId.EncListRefs.No.Time.Overlap
SubDispense.Med.Between.NamedDates.NoTimes