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.
Class Descriptions
C_ORDINAL Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
C_ORDINAL |
|
|---|---|---|
Description |
Constrainer class for Ordinal data. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
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: |
Reference model type that this node corresponds to. |
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). |
|
node_id: |
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. |
assumed_value: |
Value to be assumed if none sent in data. |
Value set of allowed Ordinals in the constraint. |
|
Functions |
|
(abstract) is_subset_of ( |
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. |
(abstract) is_valid (): |
+ Inherited from ARCHETYPE_CONSTRAINT |
path (): |
Path of this node relative to root of archetype. |
True if the relative path a_path exists at this node. |
|
True if a_value is valid with respect to constraint expressed in concrete instance of this type. |
|
(abstract) prototype_value (): |
Generate a prototype value from this constraint object. |
has_assumed_value (): |
True if there is an assumed value. |
(abstract) default_value (): |
Generate a default value from this constraint object. |
(abstract) any_allowed (): |
True if any value of the reference model type being constrained is allowed. Redefine in descendants. |
(abstract) standard_equivalent (): |
Standard (i.e. C_OBJECT) form of constraint. |
Invariants |
|
Post: |
|
Path_exists: |
|
Assumed_value_valid: |
|
{
"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
}
}
}
}
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: |
Ordinal value. |
| ORDINAL | |
|---|---|
Constrainer object representing a single Ordinal value. |
|
Attributes |
|
symbol: `CODE_PHRASE ` [1..1] |
Terminology code providing the Ordinal’s symbol. |
value: |
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"
}
}
}
C_QUANTITY Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
C_QUANTITY |
|
|---|---|---|
Description |
Constrainer class for Quantity data. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
property: |
Name of physical property for Quantities being constrained. |
0..1 |
list: |
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: |
Reference model type that this node corresponds to. |
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). |
|
node_id: |
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. |
assumed_value: |
Value to be assumed if none sent in data. |
property: |
Name of physical property for Quantities being constrained. |
list: |
Value set of allowed individual Quantity item constraints in this Quantity constraint. |
Functions |
|
(abstract) is_subset_of ( |
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. |
(abstract) is_valid (): |
+ Inherited from ARCHETYPE_CONSTRAINT |
path (): |
Path of this node relative to root of archetype. |
True if the relative path a_path exists at this node. |
|
True if a_value is valid with respect to constraint expressed in concrete instance of this type. |
|
(abstract) prototype_value (): |
Generate a prototype value from this constraint object. |
has_assumed_value (): |
True if there is an assumed value. |
(abstract) default_value (): |
Generate a default value from this constraint object. |
(abstract) any_allowed (): |
True if any value of the reference model type being constrained is allowed. Redefine in descendants. |
(abstract) standard_equivalent (): |
Standard (i.e. C_OBJECT) form of constraint. |
Invariants |
|
Post: |
|
Path_exists: |
|
Assumed_value_valid: |
|
{
"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
}
}
}
}
C_QUANTITY_ITEM Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
C_QUANTITY_ITEM |
|
|---|---|---|
Description |
Constrainer class for a single Quantity. |
|
Attributes |
Signature |
Meaning |
1..1 |
Quantity magnitude constraint. |
|
0..1 |
units: |
Optional units constraint. |
| C_QUANTITY_ITEM | |
|---|---|
Constrainer class for a single Quantity. |
|
Attributes |
|
Quantity magnitude constraint. |
|
units: |
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"
}
}
}
C_CODED_TEXT Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
C_CODED_TEXT |
|
|---|---|---|
Description |
Constrainer class for Coded text data. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
terminology: |
Terminology identifier. |
0..1 |
Optional list of codes from the terminology. No list means any code from the terminology is allowed. |
|
0..1 |
reference: |
|
| C_CODED_TEXT | |
|---|---|
Constrainer class for Coded text data. |
|
Inherits: ARCHETYPE_CONSTRAINT, C_OBJECT, C_DEFINED_OBJECT, C_DOMAIN_TYPE |
|
Attributes |
|
rm_type_name: |
Reference model type that this node corresponds to. |
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). |
|
node_id: |
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. |
assumed_value: |
Value to be assumed if none sent in data. |
terminology: |
Terminology identifier. |
Optional list of codes from the terminology. No list means any code from the terminology is allowed. |
|
reference: |
|
Functions |
|
(abstract) is_subset_of ( |
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. |
(abstract) is_valid (): |
+ Inherited from ARCHETYPE_CONSTRAINT |
path (): |
Path of this node relative to root of archetype. |
True if the relative path a_path exists at this node. |
|
True if a_value is valid with respect to constraint expressed in concrete instance of this type. |
|
(abstract) prototype_value (): |
Generate a prototype value from this constraint object. |
has_assumed_value (): |
True if there is an assumed value. |
(abstract) default_value (): |
Generate a default value from this constraint object. |
(abstract) any_allowed (): |
True if any value of the reference model type being constrained is allowed. Redefine in descendants. |
(abstract) standard_equivalent (): |
Standard (i.e. C_OBJECT) form of constraint. |
Invariants |
|
Post: |
|
Path_exists: |
|
Assumed_value_valid: |
|
{
"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"
}
}
}