Domain-specific Extension Example

Overview

Domain-specific classes can be added to the archetype constraint model by inheriting from the class C_DOMAIN_TYPE. This section provides an example of how domain-specific constraint classes are added to the archetype model. Actual additions to the AOM for openEHR are documented in the openEHR Archetype Profile (oAP) specification.

Scientific/Clinical Computing Types

The following figure shows the general approach, used to add constraint classes for commonly used concepts in scientific and clinical computing, such as 'ordinal' (used heavily in medicine, particularly in pathology testing), 'coded term' (also heavily used in clinical computing) and 'quantity', a general scientific measurement concept. The constraint types shown are C_ORDINAL, C_CODED_TEXT and C_QUANTITY which can optionally be used in archetypes to replace the default constraint semantics represented by the use of instances of C_OBJECT / C_ATTRIBUTE to constrain ordinals, coded terms and quantities. The following model is intended only as an example, and does not try to define any normative semantics of the particular constraint types shown.

AM aom14.openehr archetype profile
Figure 1. aom14.openehr_archetype_profile package

Class Descriptions

C_ORDINAL Class

  • Definition

  • Effective

  • BMM

  • UML

Class

C_ORDINAL

Description

Constrainer class for Ordinal data.

Inherit

C_DOMAIN_TYPE

Attributes

Signature

Meaning

0..1

list: List<ORDINAL>

Value set of allowed Ordinals in the constraint.

C_ORDINAL

Constrainer class for Ordinal data.

Inherits: ARCHETYPE_CONSTRAINT, C_OBJECT, C_DEFINED_OBJECT, C_DOMAIN_TYPE

Attributes

rm_type_name: String [1..1]

Reference model type that this node corresponds to.
Inherited from C_OBJECT

occurrences: Interval<Integer> [1..1]

Occurrences of this object node in the data, under the owning attribute. Upper limit can only be greater than 1 if owning attribute has a cardinality of more than 1).
Inherited from C_OBJECT

node_id: String [1..1]

Semantic identifier of this node, used to distinguish sibling nodes. All nodes must have a node_id; for nodes under a container C_ATTRIBUTE, the id must be an id-code must be defined in the archetype terminology. For valid structures, all node ids are at-codes. For C_PRIMITIVE_OBJECTs, it will have the special value Primitive_node_id.
Inherited from C_OBJECT

assumed_value: Any [0..1]

Value to be assumed if none sent in data.
Inherited from C_DEFINED_OBJECT

list: List<ORDINAL> [0..1]

Value set of allowed Ordinals in the constraint.

Functions

(abstract) is_subset_of (
other: ARCHETYPE_CONSTRAINT[1]
): Boolean [1..1]

True if constraints represented by this node, ignoring any sub-parts, are narrower or the same as other. Typically used during validation of special-ised archetype nodes.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) is_valid (): Boolean [1..1]

+ Inherited from ARCHETYPE_CONSTRAINT

path (): String [1..1]

Path of this node relative to root of archetype.
Inherited from ARCHETYPE_CONSTRAINT

has_path (
a_path: String[1]
): Boolean [1..1]

True if the relative path a_path exists at this node.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) valid_value (
a_value: Any[1]
): Boolean [1..1]

True if a_value is valid with respect to constraint expressed in concrete instance of this type.
Inherited from C_DEFINED_OBJECT

(abstract) prototype_value (): Any [1..1]

Generate a prototype value from this constraint object.
Inherited from C_DEFINED_OBJECT

has_assumed_value (): Boolean [1..1]

True if there is an assumed value.
Inherited from C_DEFINED_OBJECT

(abstract) default_value (): Any [0..1]

Generate a default value from this constraint object.
Inherited from C_DEFINED_OBJECT

(abstract) any_allowed (): Boolean

Post: Result = attributes.is_empty [1..1]

True if any value of the reference model type being constrained is allowed. Redefine in descendants.
Inherited from C_DEFINED_OBJECT

(abstract) standard_equivalent (): C_COMPLEX_OBJECT [1..1]

Standard (i.e. C_OBJECT) form of constraint.
Inherited from C_DOMAIN_TYPE

Invariants

Post: Result = soc_parent /= Void or parent.soc_parent /= Void
Inherited from ARCHETYPE_CONSTRAINT

Path_exists: path /= Void
Inherited from ARCHETYPE_CONSTRAINT

Assumed_value_valid: has_assumed_value implies valid_value(assumed_value)
Inherited from C_DEFINED_OBJECT

{
    "name": "C_ORDINAL",
    "documentation": "Constrainer class for Ordinal data.",
    "ancestors": [
        "C_DOMAIN_TYPE"
    ],
    "properties": {
        "list": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "list",
            "documentation": "Value set of allowed Ordinals in the constraint.",
            "type_def": {
                "container_type": "List",
                "type": "ORDINAL"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    }
}
aom14.c ordinal

ORDINAL Class

  • Definition

  • Effective

  • BMM

  • UML

Class

ORDINAL

Description

Constrainer object representing a single Ordinal value.

Attributes

Signature

Meaning

1..1

symbol: `CODE_PHRASE `

Terminology code providing the Ordinal’s symbol.

1..1

value: Integer

Ordinal value.

ORDINAL

Constrainer object representing a single Ordinal value.

Attributes

symbol: `CODE_PHRASE ` [1..1]

Terminology code providing the Ordinal’s symbol.

value: Integer [1..1]

Ordinal value.

{
    "name": "ORDINAL",
    "documentation": "Constrainer object representing a single Ordinal value.",
    "properties": {
        "symbol": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "symbol",
            "documentation": "Terminology code providing the Ordinal's symbol.",
            "is_mandatory": true,
            "type": "CODE_PHRASE"
        },
        "value": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "value",
            "documentation": "Ordinal value.",
            "is_mandatory": true,
            "type": "Integer"
        }
    }
}
aom14.ordinal

C_QUANTITY Class

  • Definition

  • Effective

  • BMM

  • UML

Class

C_QUANTITY

Description

Constrainer class for Quantity data.

Inherit

C_DOMAIN_TYPE

Attributes

Signature

Meaning

1..1

property: String

Name of physical property for Quantities being constrained.

0..1

list: List<C_QUANTITY_ITEM>

Value set of allowed individual Quantity item constraints in this Quantity constraint.

C_QUANTITY

Constrainer class for Quantity data.

Inherits: ARCHETYPE_CONSTRAINT, C_OBJECT, C_DEFINED_OBJECT, C_DOMAIN_TYPE

Attributes

rm_type_name: String [1..1]

Reference model type that this node corresponds to.
Inherited from C_OBJECT

occurrences: Interval<Integer> [1..1]

Occurrences of this object node in the data, under the owning attribute. Upper limit can only be greater than 1 if owning attribute has a cardinality of more than 1).
Inherited from C_OBJECT

node_id: String [1..1]

Semantic identifier of this node, used to distinguish sibling nodes. All nodes must have a node_id; for nodes under a container C_ATTRIBUTE, the id must be an id-code must be defined in the archetype terminology. For valid structures, all node ids are at-codes. For C_PRIMITIVE_OBJECTs, it will have the special value Primitive_node_id.
Inherited from C_OBJECT

assumed_value: Any [0..1]

Value to be assumed if none sent in data.
Inherited from C_DEFINED_OBJECT

property: String [1..1]

Name of physical property for Quantities being constrained.

list: List<C_QUANTITY_ITEM> [0..1]

Value set of allowed individual Quantity item constraints in this Quantity constraint.

Functions

(abstract) is_subset_of (
other: ARCHETYPE_CONSTRAINT[1]
): Boolean [1..1]

True if constraints represented by this node, ignoring any sub-parts, are narrower or the same as other. Typically used during validation of special-ised archetype nodes.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) is_valid (): Boolean [1..1]

+ Inherited from ARCHETYPE_CONSTRAINT

path (): String [1..1]

Path of this node relative to root of archetype.
Inherited from ARCHETYPE_CONSTRAINT

has_path (
a_path: String[1]
): Boolean [1..1]

True if the relative path a_path exists at this node.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) valid_value (
a_value: Any[1]
): Boolean [1..1]

True if a_value is valid with respect to constraint expressed in concrete instance of this type.
Inherited from C_DEFINED_OBJECT

(abstract) prototype_value (): Any [1..1]

Generate a prototype value from this constraint object.
Inherited from C_DEFINED_OBJECT

has_assumed_value (): Boolean [1..1]

True if there is an assumed value.
Inherited from C_DEFINED_OBJECT

(abstract) default_value (): Any [0..1]

Generate a default value from this constraint object.
Inherited from C_DEFINED_OBJECT

(abstract) any_allowed (): Boolean

Post: Result = attributes.is_empty [1..1]

True if any value of the reference model type being constrained is allowed. Redefine in descendants.
Inherited from C_DEFINED_OBJECT

(abstract) standard_equivalent (): C_COMPLEX_OBJECT [1..1]

Standard (i.e. C_OBJECT) form of constraint.
Inherited from C_DOMAIN_TYPE

Invariants

Post: Result = soc_parent /= Void or parent.soc_parent /= Void
Inherited from ARCHETYPE_CONSTRAINT

Path_exists: path /= Void
Inherited from ARCHETYPE_CONSTRAINT

Assumed_value_valid: has_assumed_value implies valid_value(assumed_value)
Inherited from C_DEFINED_OBJECT

{
    "name": "C_QUANTITY",
    "documentation": "Constrainer class for Quantity data.",
    "ancestors": [
        "C_DOMAIN_TYPE"
    ],
    "properties": {
        "property": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "property",
            "documentation": "Name of physical property for Quantities being constrained.",
            "is_mandatory": true,
            "type": "String"
        },
        "list": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "list",
            "documentation": "Value set of allowed individual Quantity item constraints in this Quantity constraint.",
            "type_def": {
                "container_type": "List",
                "type": "C_QUANTITY_ITEM"
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    }
}
aom14.c quantity

C_QUANTITY_ITEM Class

  • Definition

  • Effective

  • BMM

  • UML

Class

C_QUANTITY_ITEM

Description

Constrainer class for a single Quantity.

Attributes

Signature

Meaning

1..1

magnitude: Interval<Real>

Quantity magnitude constraint.

0..1

units: String

Optional units constraint.

C_QUANTITY_ITEM

Constrainer class for a single Quantity.

Attributes

magnitude: Interval<Real> [1..1]

Quantity magnitude constraint.

units: String [0..1]

Optional units constraint.

{
    "name": "C_QUANTITY_ITEM",
    "documentation": "Constrainer class for a single Quantity.",
    "properties": {
        "magnitude": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "magnitude",
            "documentation": "Quantity magnitude constraint.",
            "is_mandatory": true,
            "type_def": {
                "root_type": "Interval",
                "generic_parameters": [
                    "Real"
                ]
            }
        },
        "units": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "units",
            "documentation": "Optional units constraint.",
            "type": "String"
        }
    }
}
aom14.c quantity item

C_CODED_TEXT Class

  • Definition

  • Effective

  • BMM

  • UML

Class

C_CODED_TEXT

Description

Constrainer class for Coded text data.

Inherit

C_DOMAIN_TYPE

Attributes

Signature

Meaning

1..1

terminology: String

Terminology identifier.

0..1

code_list: List<String>

Optional list of codes from the terminology. No list means any code from the terminology is allowed.

0..1

reference: String

C_CODED_TEXT

Constrainer class for Coded text data.

Inherits: ARCHETYPE_CONSTRAINT, C_OBJECT, C_DEFINED_OBJECT, C_DOMAIN_TYPE

Attributes

rm_type_name: String [1..1]

Reference model type that this node corresponds to.
Inherited from C_OBJECT

occurrences: Interval<Integer> [1..1]

Occurrences of this object node in the data, under the owning attribute. Upper limit can only be greater than 1 if owning attribute has a cardinality of more than 1).
Inherited from C_OBJECT

node_id: String [1..1]

Semantic identifier of this node, used to distinguish sibling nodes. All nodes must have a node_id; for nodes under a container C_ATTRIBUTE, the id must be an id-code must be defined in the archetype terminology. For valid structures, all node ids are at-codes. For C_PRIMITIVE_OBJECTs, it will have the special value Primitive_node_id.
Inherited from C_OBJECT

assumed_value: Any [0..1]

Value to be assumed if none sent in data.
Inherited from C_DEFINED_OBJECT

terminology: String [1..1]

Terminology identifier.

code_list: List<String> [0..1]

Optional list of codes from the terminology. No list means any code from the terminology is allowed.

reference: String [0..1]

Functions

(abstract) is_subset_of (
other: ARCHETYPE_CONSTRAINT[1]
): Boolean [1..1]

True if constraints represented by this node, ignoring any sub-parts, are narrower or the same as other. Typically used during validation of special-ised archetype nodes.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) is_valid (): Boolean [1..1]

+ Inherited from ARCHETYPE_CONSTRAINT

path (): String [1..1]

Path of this node relative to root of archetype.
Inherited from ARCHETYPE_CONSTRAINT

has_path (
a_path: String[1]
): Boolean [1..1]

True if the relative path a_path exists at this node.
Inherited from ARCHETYPE_CONSTRAINT

(abstract) valid_value (
a_value: Any[1]
): Boolean [1..1]

True if a_value is valid with respect to constraint expressed in concrete instance of this type.
Inherited from C_DEFINED_OBJECT

(abstract) prototype_value (): Any [1..1]

Generate a prototype value from this constraint object.
Inherited from C_DEFINED_OBJECT

has_assumed_value (): Boolean [1..1]

True if there is an assumed value.
Inherited from C_DEFINED_OBJECT

(abstract) default_value (): Any [0..1]

Generate a default value from this constraint object.
Inherited from C_DEFINED_OBJECT

(abstract) any_allowed (): Boolean

Post: Result = attributes.is_empty [1..1]

True if any value of the reference model type being constrained is allowed. Redefine in descendants.
Inherited from C_DEFINED_OBJECT

(abstract) standard_equivalent (): C_COMPLEX_OBJECT [1..1]

Standard (i.e. C_OBJECT) form of constraint.
Inherited from C_DOMAIN_TYPE

Invariants

Post: Result = soc_parent /= Void or parent.soc_parent /= Void
Inherited from ARCHETYPE_CONSTRAINT

Path_exists: path /= Void
Inherited from ARCHETYPE_CONSTRAINT

Assumed_value_valid: has_assumed_value implies valid_value(assumed_value)
Inherited from C_DEFINED_OBJECT

{
    "name": "C_CODED_TEXT",
    "documentation": "Constrainer class for Coded text data.",
    "ancestors": [
        "C_DOMAIN_TYPE"
    ],
    "properties": {
        "terminology": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "terminology",
            "documentation": "Terminology identifier.",
            "is_mandatory": true,
            "type": "String"
        },
        "code_list": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "code_list",
            "documentation": "Optional list of codes from the terminology. No list means any code from the terminology is allowed.",
            "type_def": {
                "root_type": "List",
                "generic_parameters": [
                    "String"
                ]
            }
        },
        "reference": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "reference",
            "type": "String"
        }
    }
}
aom14.c coded text