Encapsulated Package
Overview
The data_types.encapsulated package contains classes representing data values whose internal
structure is defined outside the EHR model, such as multimedia and parsable data. It is illustrated below.
Requirements
There is a need to be able to include content in the EHR whose interior structure is not modelled in the EHR reference model, but instead documented by sufficient meta-data attributes for specific tools to process the data. Types of content in this category are as follows.
-
Images, including images which are themselves a compressed version of one image from a high-resolution image set stored elsewhere. Such images may be in any of the well-known compressed or uncompressed formats, and may have their own thumbnail image attached, to facilitate web-viewing.
-
Bio-signal data series, such as a set of values representing a diagnostic part of an ECG trace. This might be represented as DICOM content.
-
Content which is textual (or nearly so) which is essentially a parsable language file of some kind. This includes all XML instance, HTML, and any other EHR content which happens to be represented in syntax form - such as the unit strings used in quantities. The name of the formalism should be stored as meta-data.
-
Binary content which is processed by a work processor or other dedicated tool.
-
Digital signatures.
Sufficient meta-data must be included with all of these types to enable a way for the content to be processed, typically by indicating either its type (e.g. "jpeg", "word document") or the name of a tool which can be used to process it. Important meta-data include:
-
size of the content;
-
natural language, if any.
Any encapsulated data item may be a summary, "thumbnail" or otherwise reduced form of an original content item found outside the EHR, in some other system or file-system. Checksums must be expressible for those items for which a checksum is available, or for which the system generates checksums to improve the quality of its internal data transmissions.
Design
The design approach used here is based on the following analysis.
-
Any encapsulated data item may be in some particular language, even if it is an image or other graphic form such as a biosignal with axis markings in a particular language;
-
The general structure of encapsulated content data items includes a block of bytes or characters representing the content, and various meta-data as appropriate, including:
-
size
-
character encoding
-
compression type/algorithm
-
name of formalism for parsable content
-
-
For encapsulated items that have a counterpart in another system, the standard means of portable address is the W3C URI;
-
For items may that have an associated integrity checksum, the checksum is itself a series of bytes, and the type of checksum must also be specified, e.g. "md5".
These observations lead naturally to an abstract DV_ENCAPSULATED class, with two subtypes,
DV_PARSABLE, for all content which is syntactic in nature, and DV_MULTIMEDIA for everything else.
Note that it is possible to imagine parsable content items which are large, stored in compressed form,
and are themselves a summary of another item elsewhere on the web; such items can for practical
purposes be represented as instances of DV_MULTIMEDIA, rather than DV_PARSABLE. The vast
majority of parsable encapsulated data are expected to be short and stored in native textual form, e.g.
fragments of XML or HTML.
The formal model of the classes DV_ENCAPSULATED and DV_MULTIMEDIA are closely based on the
ED type from the HL7v3 data types specification.
Examples
The following examples show how to use the classes to represent some common encapsulated data types.
| Data format | Class | Attributes |
|---|---|---|
inline JSON |
|
|
inline JSON, minified |
|
|
JSON document |
|
|
inline JPG |
|
|
inline JPG, Base64 |
|
|
inline JPG with |
|
|
Class Descriptions
DV_ENCAPSULATED Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
DV_ENCAPSULATED (abstract) |
|
|---|---|---|
Description |
Abstract class defining the common meta-data of all types of encapsulated data. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
charset: |
Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions. |
0..1 |
language: |
Optional indicator of the localised language in which the data is written, if relevant. Coded from openEHR Code Set |
Invariants |
Size_valid: |
|
Language_valid: |
||
Charset_valid: |
||
| DV_ENCAPSULATED (abstract) | |
|---|---|
Abstract class defining the common meta-data of all types of encapsulated data. |
|
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, DATA_VALUE |
|
Constants |
|
BASIC_DEFINITIONS.CR: |
Carriage return character. |
BASIC_DEFINITIONS.LF: |
Line feed character. |
BASIC_DEFINITIONS.Any_type_name: |
|
BASIC_DEFINITIONS.Regex_any_pattern: |
|
BASIC_DEFINITIONS.Default_encoding: |
|
BASIC_DEFINITIONS.None_type_name: |
|
OPENEHR_DEFINITIONS.Local_terminology_id: |
Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype |
Attributes |
|
charset: |
Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions. |
language: |
Optional indicator of the localised language in which the data is written, if relevant. Coded from openEHR Code Set |
Invariants |
|
Size_valid: |
|
Language_valid: |
|
Charset_valid: |
|
{
"name": "DV_ENCAPSULATED",
"documentation": "Abstract class defining the common meta-data of all types of encapsulated data.",
"is_abstract": true,
"ancestors": [
"DATA_VALUE"
],
"properties": {
"charset": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "charset",
"documentation": "Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions. ",
"type": "CODE_PHRASE"
},
"language": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "language",
"documentation": "Optional indicator of the localised language in which the data is written, if relevant. Coded from openEHR Code Set `languages`.",
"type": "CODE_PHRASE"
}
},
"invariants": {
"Size_valid": "size >= 0",
"Language_valid": "language /= Void implies code_set (Code_set_id_languages).has_code (language)",
"Charset_valid": "charset /= Void implies code_set (Code_set_id_character_sets).has_code (charset)"
}
}
DV_MULTIMEDIA Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
DV_MULTIMEDIA |
|
|---|---|---|
Description |
A specialisation of |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
alternate_text: |
Text to display in lieu of multimedia display/replay. |
0..1 |
uri: |
URI reference to electronic information stored outside the record as a file, database entry etc, if supplied as a reference. |
0..1 |
The actual data found at |
|
1..1 |
media_type: |
Data media type coded from openEHR code set media types (interface for the IANA MIME types code set). |
0..1 |
compression_algorithm: |
Compression type, a coded value from the openEHR Integrity check code set. Void means no compression. |
0..1 |
Binary cryptographic integrity checksum. |
|
0..1 |
integrity_check_algorithm: |
Type of integrity check, a coded value from the openEHR |
0..1 |
thumbnail: |
The thumbnail for this item, if one exists; mainly for graphics formats. |
1..1 |
size: |
Original size in bytes of unencoded encapsulated data. I.e. encodings such as base64, hexadecimal etc do not change the value of this attribute. |
Functions |
Signature |
Meaning |
1..1 |
is_external (): |
Computed from the value of the |
1..1 |
is_inline (): |
Computed from the value of the data attribute. True if the data is stored in expanded form, ie within the EHR itself. |
1..1 |
is_compressed (): |
Computed from the value of the |
1..1 |
has_integrity_check (): |
Computed from the value of the |
Invariants |
Not_empty: |
|
Media_type_valid: |
||
Compression_algorithm_validity: |
||
Integrity_check_validity: |
||
Integrity_check_algorithm_validity: |
||
Size_valid: |
||
| DV_MULTIMEDIA | |
|---|---|
A specialisation of |
|
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, DATA_VALUE, DV_ENCAPSULATED |
|
Constants |
|
BASIC_DEFINITIONS.CR: |
Carriage return character. |
BASIC_DEFINITIONS.LF: |
Line feed character. |
BASIC_DEFINITIONS.Any_type_name: |
|
BASIC_DEFINITIONS.Regex_any_pattern: |
|
BASIC_DEFINITIONS.Default_encoding: |
|
BASIC_DEFINITIONS.None_type_name: |
|
OPENEHR_DEFINITIONS.Local_terminology_id: |
Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype |
Attributes |
|
DV_ENCAPSULATED.charset: |
Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions. |
DV_ENCAPSULATED.language: |
Optional indicator of the localised language in which the data is written, if relevant. Coded from openEHR Code Set |
alternate_text: |
Text to display in lieu of multimedia display/replay. |
uri: |
URI reference to electronic information stored outside the record as a file, database entry etc, if supplied as a reference. |
The actual data found at |
|
media_type: |
Data media type coded from openEHR code set media types (interface for the IANA MIME types code set). |
compression_algorithm: |
Compression type, a coded value from the openEHR Integrity check code set. Void means no compression. |
Binary cryptographic integrity checksum. |
|
integrity_check_algorithm: |
Type of integrity check, a coded value from the openEHR |
thumbnail: |
The thumbnail for this item, if one exists; mainly for graphics formats. |
size: |
Original size in bytes of unencoded encapsulated data. I.e. encodings such as base64, hexadecimal etc do not change the value of this attribute. |
Functions |
|
is_external (): |
Computed from the value of the |
is_inline (): |
Computed from the value of the data attribute. True if the data is stored in expanded form, ie within the EHR itself. |
is_compressed (): |
Computed from the value of the |
has_integrity_check (): |
Computed from the value of the |
Invariants |
|
Size_valid: |
|
DV_ENCAPSULATED.Language_valid: |
|
DV_ENCAPSULATED.Charset_valid: |
|
Not_empty: |
|
Media_type_valid: |
|
Compression_algorithm_validity: |
|
Integrity_check_validity: |
|
Integrity_check_algorithm_validity: |
|
{
"name": "DV_MULTIMEDIA",
"documentation": "A specialisation of `DV_ENCAPSULATED` for audiovisual and bio-signal types. Includes further metadata relating to multimedia types which are not applicable to other subtypes of `DV_ENCAPSULATED`.",
"ancestors": [
"DV_ENCAPSULATED"
],
"properties": {
"alternate_text": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "alternate_text",
"documentation": "Text to display in lieu of multimedia display/replay.",
"type": "String"
},
"uri": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "uri",
"documentation": "URI reference to electronic information stored outside the record as a file, database entry etc, if supplied as a reference. \n",
"type": "DV_URI"
},
"data": {
"_type": "P_BMM_CONTAINER_PROPERTY",
"name": "data",
"documentation": "The actual data found at `_uri_`, if supplied inline.",
"type_def": {
"container_type": "Array",
"type": "Octet"
},
"cardinality": {
"lower": 0,
"upper_unbounded": true
}
},
"media_type": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "media_type",
"documentation": "Data media type coded from openEHR code set media types (interface for the IANA MIME types code set). \n",
"is_mandatory": true,
"type": "CODE_PHRASE"
},
"compression_algorithm": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "compression_algorithm",
"documentation": "Compression type, a coded value from the openEHR Integrity check code set. Void means no compression. ",
"type": "CODE_PHRASE"
},
"integrity_check": {
"_type": "P_BMM_CONTAINER_PROPERTY",
"name": "integrity_check",
"documentation": "Binary cryptographic integrity checksum.",
"type_def": {
"container_type": "Array",
"type": "Octet"
},
"cardinality": {
"lower": 0,
"upper_unbounded": true
}
},
"integrity_check_algorithm": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "integrity_check_algorithm",
"documentation": "Type of integrity check, a coded value from the openEHR `Integrity check` code set. ",
"type": "CODE_PHRASE"
},
"thumbnail": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "thumbnail",
"documentation": "The thumbnail for this item, if one exists; mainly for graphics formats.",
"type": "DV_MULTIMEDIA"
},
"size": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "size",
"documentation": "Original size in bytes of unencoded encapsulated data. I.e. encodings such as base64, hexadecimal etc do not change the value of this attribute.",
"is_mandatory": true,
"type": "Integer"
}
},
"functions": {
"is_external": {
"name": "is_external",
"documentation": "Computed from the value of the `_uri_` attribute: True if the data is stored externally to the record, as indicated by `_uri_`. A copy may also be stored internally, in which case `_is_expanded_` is also true.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_inline": {
"name": "is_inline",
"documentation": "Computed from the value of the data attribute. True if the data is stored in expanded form, ie within the EHR itself. ",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"is_compressed": {
"name": "is_compressed",
"documentation": "Computed from the value of the `_compression_algorithm_` attribute: True if the data is stored in compressed form. ",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"has_integrity_check": {
"name": "has_integrity_check",
"documentation": "Computed from the value of the `_integrity_check_algorithm_` attribute: True if an integrity check has been computed. ",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
},
"invariants": {
"Not_empty": "is_inline or is_external",
"Media_type_valid": "media_type /= Void and then code_set (Code_set_id_media_types).has_code (media_type)",
"Compression_algorithm_validity": "compression_algorithm /= Void implies code_set (Code_set_id_compression_algorithms).has_code (compression_algorithm)",
"Integrity_check_validity": "integrity_check /= Void implies integrity_check_algorithm /= Void",
"Integrity_check_algorithm_validity": "integrity_check_algorithm /= Void implies code_set (Code_set_id_integrity_check_algorithms).has_code (integrity_check_algorithm)",
"Size_valid": "size >= 0"
}
}
DV_PARSABLE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
DV_PARSABLE |
|
|---|---|---|
Description |
Encapsulated data expressed as a parsable String. The internal model of the data item is not described in the openEHR model in common with other encapsulated types, but in this case, the form of the data is assumed to be plaintext, rather than compressed or other types of large binary data. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
The string, which may validly be empty in some syntaxes. |
1..1 |
formalism: |
Name of the formalism, e.g. GLIF 1.0 , Proforma etc. |
Functions |
Signature |
Meaning |
1..1 |
size (): |
Size in bytes of value. |
Invariants |
Formalism_valid: |
|
Size_valid: |
||
| DV_PARSABLE | |
|---|---|
Encapsulated data expressed as a parsable String. The internal model of the data item is not described in the openEHR model in common with other encapsulated types, but in this case, the form of the data is assumed to be plaintext, rather than compressed or other types of large binary data. |
|
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, DATA_VALUE, DV_ENCAPSULATED |
|
Constants |
|
BASIC_DEFINITIONS.CR: |
Carriage return character. |
BASIC_DEFINITIONS.LF: |
Line feed character. |
BASIC_DEFINITIONS.Any_type_name: |
|
BASIC_DEFINITIONS.Regex_any_pattern: |
|
BASIC_DEFINITIONS.Default_encoding: |
|
BASIC_DEFINITIONS.None_type_name: |
|
OPENEHR_DEFINITIONS.Local_terminology_id: |
Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype |
Attributes |
|
DV_ENCAPSULATED.charset: |
Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions. |
DV_ENCAPSULATED.language: |
Optional indicator of the localised language in which the data is written, if relevant. Coded from openEHR Code Set |
value: |
The string, which may validly be empty in some syntaxes. |
formalism: |
Name of the formalism, e.g. GLIF 1.0 , Proforma etc. |
Functions |
|
size (): |
Size in bytes of value. |
Invariants |
|
Size_valid: |
|
DV_ENCAPSULATED.Language_valid: |
|
DV_ENCAPSULATED.Charset_valid: |
|
Formalism_valid: |
|
{
"name": "DV_PARSABLE",
"documentation": "Encapsulated data expressed as a parsable String. The internal model of the data item is not described in the openEHR model in common with other encapsulated types, but in this case, the form of the data is assumed to be plaintext, rather than compressed or other types of large binary data. ",
"ancestors": [
"DV_ENCAPSULATED"
],
"properties": {
"value": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value",
"documentation": "The string, which may validly be empty in some syntaxes.",
"is_mandatory": true,
"type": "String"
},
"formalism": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "formalism",
"documentation": "Name of the formalism, e.g. GLIF 1.0 , Proforma etc.",
"is_mandatory": true,
"type": "String"
}
},
"functions": {
"size": {
"name": "size",
"documentation": "Size in bytes of value.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Integer"
}
}
},
"invariants": {
"Formalism_valid": "not formalism.is_empty",
"Size_valid": "size >= 0"
}
}