DLM Model

Overview

The structure of the proc.decision_language packages is shown below.

PROC decision language packages
Figure 1. proc.decision_language Package strucure

The packages are described below.

Decision Logic Module Package

The module structure of a Decision Logic Module is formally represented by a class model consisting of minimal extensions to the BMM class (i.e. BMM_CLASS) concept. A DLM is thus understood as a special kind of module expressible as a constrained form of class definition, such that only certain types of features are allowed. It also has additions for documentary meta-data and terminology provided by the AUTHORED_RESOURCE class from the openEHR BASE component.

The meta-model is shown below, with the meta-class DECISION_LOGIC_MODULE being the root entity.

PROC decision language.dlm
Figure 2. proc.decision_language.dlm Package

Within this model, the various DLM sections are modelled as specialisations of the BMM meta-class BMM_FEATURE_GROUP, so as to restrict the kind of features they may define. These are described in the following sub-sections.

Pre-conditions Section

The DLM preconditions section is formally represented as a feature group called 'preconditions' whose members are limited to being a single BMM_FUNCTION containing the Boolean expression that appears in that section. The expression may reference only rules and input variables.

Reference Section

The DLM reference section is formally represented as a feature group called 'reference' whose members are limited to BMM constants.

Input Section

The DLM input section is formally represented as a feature group called 'input' whose members are limited to BMM constants of a specific concrete type TRACKED_VARIABLE<T> and descendants, supplied by the proc.decision_language.concrete package.

Rules Section

The DLM rules section is formally represented as a feature group called 'rules' whose members are limited to BMM functions. A specific meta-type DLM_RULE is used in case extensions to the standard BMM_FUNCTION are required.

Class Descriptions

DECISION_LOGIC_MODULE Class

  • Definition

Class

DECISION_LOGIC_MODULE

Description

Specialised kind of class that represents a Decision Logic Module (DLM).

Inherit

AUTHORED_RESOURCE, BMM_SIMPLE_CLASS

Functions

Signature

Meaning

0..1

create_bmm_class

Generate a BMM_CLASS structure whose feature groups correspond to the formal sections of a DLM, instantiated using the DLM_XXX_SECTION classes.

DLM_REFERENCE_SECTION Class

  • Definition

Class

DLM_REFERENCE_SECTION

Description

Specialised feature group used in DLM to represent the reference section.

Inherit

BMM_FEATURE_GROUP

Attributes

Signature

Meaning

1..1
(redefined)

name: String
{default = "reference"}

Name of this feature group; defaults to 'reference'.

0..1
(redefined)

features: List<BMM_CONSTANT>

Constant definitions needed by module.

DLM_INPUT_SECTION Class

  • Definition

Class

DLM_INPUT_SECTION

Description

Specialised feature group used in DLM to represent the input section. Contains only SUBJECT_TRACKED_VARIABLE members.

Inherit

BMM_FEATURE_GROUP

Attributes

Signature

Meaning

1..1
(redefined)

name: String
{default = "input"}

Name of this feature group; defaults to 'input'.

0..1
(redefined)

features: List<BMM_CONSTANT>

Input variable proxies.

DLM_RULES_SECTION Class

  • Definition

Class

DLM_RULES_SECTION

Description

Specialised feature group used in DLM to represent the rules section. Contains only DLM_RULE members.

Inherit

BMM_FEATURE_GROUP

Attributes

Signature

Meaning

1..1
(redefined)

name: String
{default = "rules"}

Name of this feature group; defaults to 'rules'.

0..1
(redefined)

features: List<DLM_RULE>

Rules for this module.

DLM_RULE Class

  • Definition

Class

DLM_RULE

Description

Specialised form of BMM_FUNCTION that acts as a DLM rule.

Inherit

BMM_FUNCTION

DLM Concrete Model

In order to supply a few of the key constructs of a DLM, a concrete model is provided with specific types that express the needed semantics. The main types required relate to input variables. The DLM concrete model UML is shown below.

PROC decision language.concrete
Figure 3. proc.decision_language.concrete Package

Subject Variables

The variable definitions found in the input section of a DLM are designed to facilitate both intuitive DLM authoring and tracking of values over time from real data sources, typically health records, devices and so on. The generic class STATE_VARIABLE<T> and descendants provide a representation of a subject variable with a symbolic name. The generic type parameter is substituted with types used for representing atomic data values, including primitive types such as String, Integer etc, as well as types like Terminology_code, Quantity etc, as available in the models (type definitions) used by a DLM.

The class STATE_VARIABLE<T> models the simplest case: a variable that may be queried once for an execution run. This is sufficient for subject variables that are not time-dependent, and will not change during the execution, such as date_of_birth, sex, and Boolean variables such as is_type1_diabetic. The history attribute contains the variable value (normally only one sample), while the features is_available() and unavailable_reason() provide a way for missing data to be checked for.

For time-varying variables, the values must usually be tracked. The class TRACKED_STATE_VARIABLE<T> is is provided for this purpose, and adds the meta-attribute currency, a duration indicating the maximum age of the sample value to be useful or valid. The history attribute now contains variable samples over time. The function value() extracts the most recent available value, while is_available() is redefined to indicate whether a sufficiently recent value is available.

Many tracked variables are quantitative, and for these, extra facilities are provided via the class TRACKED_QUANTITATIVE_VARIABLE<T>, which adds the ranges facility described earlier in Quantitative Tracked Variables.

Variable declarations in DL syntax, as described in the language section above are in fact instantiations of the STATE_VARIABLE<T> or a descendant, potentially with constructor paramaters supplied. Consider the following declaration, shown earlier:

    systolic_blood_pressure: Quantity
        currency = 1 min,
        ranges["mm[Hg]"] =
            --------------------------------
            |≥180|:         [critical_high],
            |>140|:         [very_high],
            |>120|:         [high],
            |>90..≤120|:    [normal],
            |≤90|:          [low],
            |≤50|:          [critical_low]
            --------------------------------
        ;

If we were to rewrite this in a more standard programming language, it might look like the following object instantiation, preceded by setup code (the syntax 'Type_name (args)' is used to represent an object creation using a constructor call in each case):

// build the ranges Map
ranges: Map <Terminology_code, Interval<Quantity> ();
ranges.put (Terminology_code("critical_high"), Interval<Quantity>(180 mm[Hg], Void);
    ...
ranges.put (Terminology_code("critical_low"), Interval<Quantity>(Void, 50 mm[Hg]);

// instantiate the tracked variable object
systolic_blood_pressure: TRACKED_QUANTITATIVE_VARIABLE<Quantity> (
    "systolic_blood_pressure",   // name
    "PT1M",                      // currency
    ranges                       // ranges
);

It will be appreciated that this is substantially more complex, and also arcane to a domain specialist. In the above, the part between the parentheses in the lower declaration corresponds to a call to a constructor of type TRACKED_QUANTITATIVE_VARIABLE with the signature (name: String, currency: Iso8601_duration, ranges: Map<Terminology_code, Interval<T>). From a formal point of view, such an instantiation creates an instance that will remain for the life of the DLM’s execution, in other words, a computed constant value. It is thus a meta-instance of the BMM meta-type BMM_CONSTANT, as shown in the DLM model above.

Each input variable declaration creates an object similar to the above, which may then be used during the execution of the DLM by calls made from the functions in the rules section. The simplest possible 'bare' reference of the variable name alone, i.e. systolic_blood_pressure in the example above, makes use of the default delegate feature of the BMM (BMM_FUNCTION) to invoke the value() function, avoiding the need to write systolic_blood_pressure.value(). However, all the features defined on TRACKED_VARIABLE and its descendants are indeed available for use in DLM code if needed. Thus, systolic_blood_pressure.in_range([high]) is a normal call on the systolic_blood_pressure instance of TRACKED_QUANTITATIVE_VARIABLE<Quantity>.

TO BE CONTINUED

Class Descriptions

STATE_VARIABLE Class

  • Definition

Class

STATE_VARIABLE<T>

Description

Abstraction of a real-world variable that represents a quality of a subject, e.g. patient diabetic status, date of birth etc.

The generic parameter is a model type from an accessible model.

Attributes

Signature

Meaning

0..1

history: Hash<String,VALUE_SNAPSHOT>

Local history of values.

1..1

name: String

Name of variable.

Functions

Signature

Meaning

1..1

is_available (): Boolean

Return True if there is a value in history.

0..1

unavailable_reason (): String

If is_available is False, potentially provide a reason.

0..1

value (): T

Retrieve latest value, or null if none.

VALUE_SNAPSHOT Class

  • Definition

Class

VALUE_SNAPSHOT<T>

Description

One or more snapshot attempts of the state variable, either containing values or unavailable reason.

Attributes

Signature

Meaning

0..1

value: T

Value of variable in the real world, if available; Void if not.

0..1

effective_time: Iso8601_date_time

Real-world time at which value was last True, if available.

1..1

sample_time: Iso8601_date_time

Time at which this sample was obtained from its source (e.g. a patient record system, device, or user interaction).

0..1

unavailable_reason: String

Functions

Signature

Meaning

1..1

is_available (): Boolean

Return True if value is not Void.

Invariants

Inv_available: is_available() implies value /= Void

TRACKED_STATE_VARIABLE Class

  • Definition

Class

TRACKED_STATE_VARIABLE<T>

Description

A 'tracked' subject variable representing a continuant quality of a subject over time, e.g. patient systolic blood pressure, heart rate etc, whose value is sampled over time.

The generic parameter is a model type from an accessible model.

Inherit

STATE_VARIABLE

Attributes

Signature

Meaning

0..1

currency: Iso8601_duration

If set, maximum age of a real-world snapshot of this variable’s value to be usable or valid.

0..1

max_history: Iso8601_duration

Functions

Signature

Meaning

1..1

value_at_time (
a_time: Iso8601_date_time[1]
): T

Return the value from history that was available at time time.

1..1
(redefined)

is_available (): Boolean

Return True if there is a member of history whose time is within the duration of currency of the current moment.

TRACKED_QUANTITATIVE_VARIABLE Class

  • Definition

Class

TRACKED_QUANTITATIVE_VARIABLE<T>

Description

Specialised property that represents a 'tracked variable' within the DLM input section. A tracked variable is used to record snapshots of an external variable such as a subject blood pressure.

Inherit

TRACKED_STATE_VARIABLE

Attributes

Signature

Meaning

0..1

unit_ranges: Hash<String,EL_CASE_TABLE<EL_LITERAL>>

Range definitions, represented as tables, each one exhaustively covering the value space.

Functions

Signature

Meaning

1..1

in_range (
a_range: Terminology_code[1]
): Boolean

Determine if the last read value of the variable is in the named range within the default group. Use when there is only one range group.

1..1

range (): Terminology_code

Return the name of the range from the default range group within which the last read value of the variable resides. Use when there is only one range group.

1..1

range_definition (
a_range: Terminology_code[1]
): Interval<T>

Return the interval of the named range within the default range group. Use when there is only one range group.

1..1

in_group_range (
range_group: Terminology_code[1],
a_range: Terminology_code[1]
): Boolean

Form of in_range() to use when there is more than one range group.

1..1

group_range (
range_group: Terminology_code[1]
): Terminology_code

Form of range() to use when there is more than one range group.

1..1

group_range_definition (
range_group: Terminology_code[1],
a_range: Terminology_code[1]
): Interval<T>

Form of range_def() to use when there is more than one range group.