Foundation Types
Issuer: openEHR Specification Program | |
---|---|
Release: BASE Release-1.0.4 |
Status: STABLE |
Revision: [latest_issue] |
Date: [latest_issue_date] |
Keywords: openehr, identifiers, types |
© 2017 - 2022 The openEHR Foundation | |
---|---|
The openEHR Foundation is an independent, non-profit foundation, facilitating the sharing of health records by consumers and clinicians via open specifications, clinical models and open platform implementations. |
|
Licence |
Creative Commons Attribution-NoDerivs 3.0 Unported. https://creativecommons.org/licenses/by-nd/3.0/ |
Support |
Issues: Problem Reports |
Amendment Record
Issue | Details | Raiser | Completed |
---|---|---|---|
R E L E A S E 1.1.0 |
|||
SPECBASE-15. Add foundation types specification to BASE component. |
T Beale |
||
SPECPUB-6. Correct UML package nesting and paths in documents; insert |
T Beale |
27 Nov 2017 |
|
0.7.6 |
Re-organise heading structure. Remove references to ISO 11404. Rename to 'Foundation types'; |
T Beale |
17 Aug 2017 |
0.7.5 |
Rework date/time types; addition of types |
T Beale |
18 Jan 2017 |
0.7.0 |
Initial Writing. Taken from openEHR RM Release 1.0.3 Support Model |
T Beale |
20 May 2016 |
The Amendment history relevant to the original content in this specification can be found here (a fully hyper-linked version may be found on the working baseline).
1. Preface
1.1. Purpose
This document describes the openEHR Foundation Types, a collection of built-in and library types whose semantics are assumed by all other openEHR specifications.
The intended audience includes:
-
Standards bodies producing health informatics standards;
-
Research groups using openEHR, ISO 13606, archetypes and related technologies;
-
The open source healthcare community;
-
Solution vendors.
1.3. Status
This specification is in the STABLE state. The development version of this document can be found at https://specifications.openehr.org/releases/BASE/Release-1.0.4/foundation_types.html.
Known omissions or questions are indicated in the text with a 'to be determined' paragraph, as follows:
TBD: (example To Be Determined paragraph)
1.4. Feedback
Feedback may be provided on the technical mailing list.
Issues may be raised on the specifications Problem Report tracker.
To see changes made due to previously reported issues, see the BASE component Change Request tracker.
1.5. Previous Versions
This specification is based on the types orginally defined in the openEHR Support Information Model from Release 1.0.3 of the Reference Model. Some changes have been made as follows.
1.5.1. Interval types
The additional types Point_interval
and Proper_interval
have been added, to support the common need for a point value and a proper interval to be specified as substitutable types. The types Multiplicity_interval
and Cardinality
have been added, from the AOM2 specification.
2. Overview
The openEHR Foundation Types (org.openehr.base.foundation_types
package) consists of generic foundational types assumed by and used throughout the openEHR components and specifications. The types described here are specified in order to establish the names and minimal semantics of typical standard classes, as used by all other openEHR specifications, and to provide a mapping point into implementation technologies.
The set of types chosen here is based on a common set derived from various published sources, including:
-
ISO 8601 (2004) date/time specification;
-
Major interoperability formalisms, including OMG IDL, W3C XML-schema;
-
Major typed programming languages, including Java, C#, C++, etc.
The package structure is illustrated below.
The primitive_types
, structures
and time
packages describe types assumed by the openEHR specifcations to exist in any implementation technology, such as a programming language, schema language or database environment.
The functional
package includes types enabling functional programming primitives to be expressed in the openEHR modelling environment, i.e. functions-as-objects and 'lambda' expressions.
The types are described in this specification are typically of two kinds: built-in types, which are those built in to a type system of the development language, and library types, which are assumed to be available in a (class) library defined in the formalism. Thus, the type Boolean
is always assumed to exist in a formalism, while the type Array<T>
is assumed to be available in a library. For practical purposes, these two categories do not matter too much - whether String
is really a library class (the usual case) or an inbuilt type doesn’t make much difference to the programmer. They are shown separately here mainly as an explanatory convenience.
The assumptions that openEHR makes about existing types are documented below in terms of interface definitions. Each of these definitions contains only the assumptions required for the given type to be used in the openEHR Reference Model - it is not by any means a complete interface definition. The name and semantics of any function used here for an assumed type might not be identical to those found in some implementation technologies. Any mapping required should be stated in the relevant implementation technology specification (ITS). To give a concrete example, where the assumed Set<T>
type defined below has an operation has (item: T): Boolean
which is used throughout the openEHR specifications, Java has the method contains()
on its Set<T>
class. In a Java implementation, the contains()
method should then be used throughout the openEHR classes as expressed in Java, in place of the has ()
method.
2.1. The Any Class
Within all object-oriented and most other modern programming and modelling environment exists an ultimate ancestor type to which all others conform. In this specification, we assume the type Any
, which defines a bare minimum of operators, and stands for the real Any
or Object
type found in real technologies.
2.2. openEHR Leaf Types
The sections below provide formal definitions of all the foundation types used in openEHR. A subset of these can be understood as terminal or leaf types, typically used as terminal value types in other information models. The following diagram provides an aide memoire for the leaf types.
2.3. Class Definitions
2.3.1. Any Class
Class |
Any (abstract) |
|||
---|---|---|---|---|
Description |
Abstract supertype. Usually maps to a type like Any or Object in an object-oriented technology. Defined here to provide value and reference equality semantics. |
|||
Functions |
Signature |
Meaning |
||
1..1 |
Value equality. |
|||
1..1 |
Reference equality. Parameters
|
|||
1..1 |
Create new instance of a type. |
|||
1..1 |
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
3. Primitive Types
3.1. Overview
This section describes primitive types assumed by all openEHR models. These are types supported directly by most programing languages, and usually visible via either a class interface and/or a built-in raw value type. The following table lists the primitive types assumed by openEHR.
Type name in openEHR |
Description |
---|---|
|
a type whose value is an 8-bit value. |
|
a type whose value is a member of an 8-bit character-set (ISO: "repertoire"). |
|
logical True/False values; usually physically represented as an integer, but need not be. |
|
32-bit integers. |
|
64-bit integers. |
|
32-bit real numbers in any interoperable representation, including single-width IEEE floating point. |
|
64-bit real numbers, in any interoperable representation including double-precision IEEE floating point. |
|
represents unicode-enabled strings. |
The figure below illustrates these types. Simple inheritance relationships are shown which facilitate the type descriptions below. Actual inheritance from or subsitutability for an Any
class is not assumed, and is shown only for convenience (e.g. to indicate that the '=' operator is available on any type). The type Ordered_numeric
is on the other hand is used to indicate assumed substitutability of numeric types, and is intended to be mapped to an equivalent type in a real type system (e.g. in Java, java.lang.Number
). Data-oriented implementation type systems such as XML-schema do not have such operations.
3.2. Unicode
It is assumed in the openEHR specifications that Unicode is supported by the type String
. Unicode is needed for all Asian, Arabic and other script languages, for both data values (particularly plain text and coded text) and for many predefined string attributes of the classes in the openEHR Reference Model. It encompasses all existing character sets. In openEHR, UTF-8 encoding is assumed.
3.3. Class Definitions
3.3.1. Boolean Class
Class |
Boolean |
|
---|---|---|
Description |
Class representing minimal interface of standard Boolean type. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
infix and ( |
Logical conjunction |
1..1 |
infix and_then ( |
Boolean semi-strict conjunction with other |
1..1 |
infix or ( |
Boolean disjunction with other. |
1..1 |
infix or_else ( |
Boolean semi-strict disjunction with `other'. |
1..1 |
infix xor ( |
Boolean exclusive or with `other'. |
1..1 |
infix implies ( |
Boolean implication of `other' (semi-strict) |
Invariants |
Involutive_negation: |
|
Non_contradiction: |
||
Completeness: |
3.3.2. Ordered Class
Class |
Ordered (abstract) |
|
---|---|---|
Description |
Abstract notional parent class of ordered, types i.e. types on which the ‘<‘ operator is defined. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
3.3.5. String Class
Class |
String |
|
---|---|---|
Description |
Strings of characters, as used to represent textual data in any natural or formal language. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Concatenation operator - causes ‘other’ to be appended to this string. |
|
1..1 |
is_empty (): |
True if string is empty, i.e. equal to "". |
1..1 |
is_integer (): |
True if string can be parsed as an integer. |
1..1 |
as_integer (): |
Return the integer corresponding to the integer value represented in this string. |
3.3.7. Numeric Class
Class |
Numeric (abstract) |
|
---|---|---|
Description |
Abstract notional parent class of numeric types, which are types which have various arithmetic and comparison operators defined. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|
1..1 |
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|
1..1 |
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
3.3.8. Ordered_Numeric Class
Class |
Ordered_Numeric (abstract) |
|
---|---|---|
Description |
Abstract notional parent class of ordered, numeric types, which are types with ‘<‘ and arithmetic operators defined. |
|
Inherit |
3.3.9. Integer Class
Class |
Integer |
|
---|---|---|
Description |
Class representing minimal interface of standard Integer type. |
|
Inherit |
3.3.10. Integer64 Class
Class |
Integer64 |
|
---|---|---|
Description |
Class representing minimal interface of standard Integer64 type. |
|
Inherit |
3.3.11. Real Class
Class |
Real |
|
---|---|---|
Description |
Type used to represent decimal numbers. Corresponds to a single-precision floating point value in most languages. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
floor (): |
Return the greatest integer no greater than the value of this object. |
4. Structure Types
4.1. Overview
The types described in this section are basic data structures assumed to be standardly available in implementation technologies. The following types consititute the minimum set of structure types assumed by openEHR of an implementation environment.
Type name in openEHR |
Description |
---|---|
|
physical container of items indexed by number |
|
container of items, implied order, non-unique membership |
|
container of items, no order, unique membership |
|
a table of values of any type V, keyed by values of any |
The following UML diagram illustrates the base.foundation_types.structures
package. As with the primitive types, inheritance and abstract classes are used for convenience of the definitions in openEHR models, but are not assumed to exist in exactly the same way within implementation technologies. Hence, in an implementation, various workarounds or equivalences may be needed to obtain the defined semantics.
4.2. Class Definitions
4.2.1. Aggregate Class
Class |
Aggregate<T> (abstract) |
|
---|---|---|
Description |
Abstract ancestor of container types whose items are addressable in some way. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
has ( |
Test for membership of a value. |
1..1 |
count (): |
Number of items in container. |
1..1 |
is_empty (): |
True if container is empty. |
4.2.2. List Class
Class |
List<T> |
|
---|---|---|
Description |
Ordered container that may contain duplicates. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
first (): |
Return first element. |
1..1 |
last (): |
Return last element. |
Invariants |
First_validity: |
|
Last_validity: |
4.2.3. Set Class
Class |
Set<T> |
|
---|---|---|
Description |
Unordered container that may not contain duplicates. |
|
Inherit |
4.2.4. Array Class
Class |
Array<T> |
|
---|---|---|
Description |
Container whose storage is assumed to be contiguous. |
|
Inherit |
4.2.5. Hash Class
Class |
Hash<K,V> |
|
---|---|---|
Description |
Type representing a keyed table of values. T is the value type, and U the type of the keys. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
has_key ( |
Test for membership of a key. |
1..1 |
item ( |
Return item for key a_key'. |
5. Interval
5.1. Overview
Another kind of structure commonly needed in rich data is the interval. The definition of the Interval<T>
class here is an intensional one, i.e. it states its members by implication from its limits, rather than enumerating them. To support the common need for defining times in models that could be either a fixed point in time or a time interval, the classes Point_interval<T>
and Proper_interval<T>
are provided. If Interval<X>
is defined as the type of a feature in a class in an openEHR model, where X
is some descendant of Ordered
, then at runtime, either a Point_interval
or Proper_interval
may be attached.
In addition to the generic interval types, the derived types Multiplicity_interval
and Cardinality
are provided, for use in models to represent multiplicity, optionality, and cardinality.
The following UML diagram illustrates the interval
package.
5.2. Class Definitions
5.2.1. Interval Class
Class |
Interval<T> (abstract) |
|
---|---|---|
Description |
Interval abstraction, featuring upper and lower limits that may be open or closed, included or not included. Interval of ordered items. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
lower: |
lower bound. |
1..1 |
lower_unbounded: |
lower boundary open (i.e. = -infinity) |
1..1 |
upper_unbounded: |
upper boundary open (i.e. = +infinity) |
1..1 |
lower_included: |
lower boundary value included in range if not lower_unbounded. |
1..1 |
upper_included: |
upper boundary value included in range if not upper_unbounded. |
Functions |
Signature |
Meaning |
1..1 |
has ( |
True if (lower_unbounded or lower_included and v >= lower) or v > lower and (upper_unbounded or upper_included and v <= upper or v < upper) |
1..1 |
True if there is any overlap between intervals represented by Current and `other'. True if at least one limit of other is strictly inside the limits of this interval. |
|
1..1 |
True if current interval properly contains `other'? True if all points of `other' are inside the current interval. |
|
1..1 |
True if current object’s interval is semantically same as `other'. |
|
0..1 |
upper (): |
|
Invariants |
Lower_included_valid: |
|
Upper_included_valid: |
||
Limits_consistent: |
||
Limits_comparable: |
5.2.2. Point_interval Class
Class |
Point_interval<T> |
|
---|---|---|
Description |
Type representing an Interval that happens to be a point value. Provides an efficient representation that is substitutable for Interval<T> where needed. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
lower_unbounded: |
lower boundary open (i.e. = -infinity) |
1..1 |
upper_unbounded: |
upper boundary open (i.e. = +infinity) |
1..1 |
lower_included: |
lower boundary value included in range if not lower_unbounded. |
1..1 |
upper_included: |
upper boundary value included in range if not upper_unbounded. |
Functions |
Signature |
Meaning |
0..1 |
upper (): |
5.2.3. Proper_interval Class
Class |
Proper_interval<T> |
|
---|---|---|
Description |
Type representing a 'proper' Interval, i.e. any two-sided or one-sided interval. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
upper: |
Upper bound. |
5.2.4. Multiplicity_interval Class
Class |
Multiplicity_interval |
|
---|---|---|
Description |
An Interval of Integer, used to represent multiplicity, cardinality and optionality in models. |
|
Inherit |
||
Constants |
Signature |
Meaning |
1..1 |
Multiplicity_range_marker: |
Marker to use in string form of interval between limits. |
1..1 |
Multiplicity_unbounded_marker: |
Symbol to use to indicate upper limit unbounded. |
Functions |
Signature |
Meaning |
1..1 |
is_open (): |
True if this interval imposes no constraints, i.e. is set to 0..* |
1..1 |
is_optional (): |
True if this interval expresses optionality, i.e. 0..1. |
1..1 |
is_mandatory (): |
True if this interval expresses mandation, i.e. 1..1. |
1..1 |
is_prohibited (): |
True if this interval is set to 0..0. |
5.2.5. Cardinality Class
Class |
Cardinality |
|
---|---|---|
Description |
Express constraints on the cardinality of container objects which are the values of multiply-valued attributes, including uniqueness and ordering, providing the means to state that a container acts like a logical list, set or bag. The cardinality cannot contradict the cardinality of the corresponding attribute within the relevant reference model. |
|
Attributes |
Signature |
Meaning |
1..1 |
interval: |
The interval of this cardinality. |
1..1 |
is_ordered: |
True if the members of the container attribute to which this cardinality refers are ordered. |
1..1 |
is_unique: |
True if the members of the container attribute to which this cardinality refers are unique. |
Functions |
Signature |
Meaning |
1..1 |
is_bag (): |
True if the semantics of this cardinality represent a bag, i.e. unordered, non-unique membership. |
1..1 |
is_list (): |
True if the semantics of this cardinality represent a list, i.e. ordered, non-unique membership. |
1..1 |
is_set (): |
True if the semantics of this cardinality represent a set, i.e. unordered, unique membership. |
6. Time Types
6.1. Overview
Two packages of time types are defined in this specification: the base.foundation_types.time
package and the base.foundation_types.iso8601_time
package. The first group are assumed to be available in some form within the implementation environment, and normally correspond to either built-in types or standard library classes. It is not assumed that the class names in any actual environment match those shown in the package here. The second set are concrete types based on the ISO 8601 time standard, which supports partial dates, times, and complex durations, all of which are needed in the biomedical and clinical domains. These classes have a String
physical representation, and also inherit from the IDate
etc classes.
The Iso8601_xxx
classes are assumed to exist in close to the form specified here, because they are specified in other openEHR specifications.
The two packages are shown below.
6.2. Primitive Time Types
The classes in the foundation_types.time
package are divided into interface classes IDate
etc, and concrete primitive types Date
, Time
etc, which are assumed to have some native data representation such as a long integer or similar. The separation is a clarifying device for this specification. It is not assumed that the classes IDate
etc literally exist in a given implementation environment.
6.3. ISO 8601 Types
The set of ISO 8601 based types define dates and times with a String
representation (as per ISO 8601), and the ISO 8601 'partial' and 'extended' semantics. They are defined as descendents of the native types described above, and add the necessary elements required for ISO 8601.
ISO 8601 semantics not used in these types include:
-
"expanded" dates, which have year numbers of greater than 4 digits, and may be negative; in openEHR, only 4-digit year numbers are assumed;
-
the
YYYY-WW-DD
method of expressing dates (since this is imprecise and difficult to compute with due to variable week starting dates, and not required in health); -
partial date/times with fractional minutes or hours, e.g.
hh,hhh
ormm,mm
; in openEHR, only fractional seconds are supported; -
the interval syntax. Intervals of date/times are supported in openEHR, but their syntax form is defined by ADL, and is standardised across all comparable types, not just dates and times.
Deviations from the published standard include the following:
-
durations are supposed to take the form of
PnnW
orPnnYnnMnnDTnnHnnMnnS
, but in openEHR, the W (week) designator can be used in combination with the other designators, since it is very common to state durations of pregnancy as some combination of weeks and days. -
partial variants of
Iso8601_date_time
can include missing hours, days and months, whereas ISO 8601:2004 (section 4.3.3 c) only allows missing seconds and minutes. The reasons for this deviation are:-
the same deviation is used in HL7v2 and HL7v3 TS (timestamp) type, i.e. there are data in existing clinical systems matching this specification;
-
in a typed object model, this deviation is more sensible anyway; the ISO 8601 rule is most likely a limitation of the purely syntactic means of expression. In real systems where a timestamp/date-time is specified in a screen form, it makes sense to allow it to be as partial as possible, rather than artifically restricted to only missing seconds and minutes.
-
-
the time
24:00:00
(or240000
) is not allowed anywhere, whereas in ISO 8601:2004 it appears to be legal at least for times. This deviation is also appears to be used in HL7v2 and HL7v3 (where midnight is defined as the time00:00:00
), and is preferable to the documented standard, since a date/time with time of24:00:00
is really the next day, i.e. the date part is then incorrect.
See [ISO_8601] and the official ISO standard for ISO 8601 details. Note that in the date, time and date_time formats shown below, 'Z' and 'T' are literals. In the duration class shown below, 'P', 'Y', 'M', 'W', 'D', 'H', 'S' and 'T' are literals.
6.4. Derived Interval / Time Types
A number of useful types may be generated from the Date/time classes and the Interval classes. These are shown in blue on the following diagram.
6.5. Class Definitions
6.5.1. Time_Definitions Class
Class |
Time_Definitions |
|
---|---|---|
Description |
Definitions for date/time classes. Note that the timezone limits are set by where the international dateline is. Thus, time in New Zealand is quoted using +12:00, not -12:00. |
|
Constants |
Signature |
Meaning |
1..1 |
Seconds_in_minute: |
|
1..1 |
Minutes_in_hour: |
|
1..1 |
Hours_in_day: |
|
1..1 |
Nominal_days_in_month: |
Used for conversions of durations containing months to days and / or seconds. |
1..1 |
Max_days_in_month: |
|
1..1 |
Days_in_year: |
|
1..1 |
Days_in_leap_year: |
|
1..1 |
Max_days_in_year: |
|
1..1 |
Nominal_days_in_year: |
Used for conversions of durations containing years to days and / or seconds. |
1..1 |
Days_in_week: |
|
1..1 |
Months_in_year: |
|
1..1 |
Min_timezone_hour: |
Minimum hour value of a timezone (note that the -ve sign is supplied in the ISO8601_TIMEZONE class). |
1..1 |
Max_timezone_hour: |
|
Functions |
Signature |
Meaning |
1..1 |
||
1..1 |
valid_month ( |
|
1..1 |
valid_day ( |
True if d >= 1 and d <= days_in_month (m, y) |
1..1 |
valid_hour ( |
True if (h >= 0 and h < Hours_in_day) or (h = Hours_in_day and m = 0 and s = 0) |
1..1 |
valid_minute ( |
True if m >= 0 and m < Minutes_in_hour. |
1..1 |
valid_second ( |
True if s >= 0 and s < Seconds_in_minute . |
1..1 |
valid_fractional_second ( |
True if fs >= 0.0 and fs < 1.0 . |
6.5.2. Temporal Class
Class |
Temporal (abstract) |
|
---|---|---|
Description |
Abstract ancestor type of Date/Time types. |
|
Inherit |
6.5.3. IDate Class
Class |
IDate (abstract) |
|
---|---|---|
Description |
Interface of an absolute point in time, as measured on the Gregorian calendar, and specified only to the day. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
year (): |
Year. |
1..1 |
month (): |
Month in year. |
1..1 |
day (): |
Day in month. |
1..1 |
timezone (): |
Timezone; may be Void. |
1..1 |
as_string (): |
ISO8601 string for date/time, in format |
6.5.4. ITime Class
Class |
ITime (abstract) |
|
---|---|---|
Description |
Defines the interface of an absolute point in time from an origin usually interpreted as meaning the start of the current day, specified to fractional seconds. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
hour (): |
Hour in day, in 24-hour time. |
1..1 |
minute (): |
Minute in hour. |
1..1 |
second (): |
Second in minute. |
1..1 |
fractional_second (): |
Fractional seconds. |
0..1 |
timezone (): |
Timezone; may be Void. |
Invariants |
Hour_valid: |
6.5.5. IDate_time Class
Class |
IDate_time (abstract) |
|
---|---|---|
Description |
Defines the interface of an absolute point in time, specified to fractional seconds. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
year (): |
Year. |
1..1 |
month (): |
Month in year. |
1..1 |
day (): |
Day in month. |
1..1 |
hour (): |
Hour in day. |
1..1 |
minute (): |
Minute in hour. |
1..1 |
second (): |
Second in minute. |
1..1 |
fractional_second (): |
Fractional seconds. |
1..1 |
timezone (): |
Timezone; may be Void. |
Invariants |
Day_valid: |
|
Month_valid: |
||
Year_valid: |
||
Month_valid: |
||
Day_valid: |
||
Hour_valid: |
6.5.6. IDuration Class
Class |
IDuration (abstract) |
|
---|---|---|
Description |
Defines the interface of a period of time corresponding to a difference between two timepoints. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
seconds (): |
Number of seconds. |
1..1 |
fractional_seconds (): |
Fractional seconds. |
Invariants |
Years_valid: |
|
Months_valid: |
||
Weeks_valid: |
||
Days_valid: |
||
Hours_valid: |
||
Minutes_valid: |
||
Seconds_valid: |
||
Fractional_second_valid: |
6.5.7. ITimezone Class
Class |
ITimezone (abstract) |
|
---|---|---|
Description |
Interface definition of a timezone. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
hour (): |
Hour part of timezone - in the range 00 - 13. |
1..1 |
minute (): |
Minute part of timezone. Generally 00 or 30. |
1..1 |
sign (): |
Direction of timezone expresssed as +1 or -1. |
Invariants |
Min_hour_valid: |
|
Max_hour_valid: |
||
Minute_valid: |
||
Sign_valid: |
6.5.8. Date Class
Class |
Date |
|
---|---|---|
Description |
Assumed built-in primitive type representing a date. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
Internal private data value of a native Date. No assumption is made about either the naming of this attribute or its type, or if more than one attribute is used. |
6.5.9. Time Class
Class |
Time |
|
---|---|---|
Description |
Assumed built-in primitive type representing a time. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
Internal private data value of a native Time. No assumption is made about either the naming of this attribute or its type, or if more than one attribute is used. |
6.5.10. Date_time Class
Class |
Date_time |
|
---|---|---|
Description |
Assumed built-in primitive type representing a date/time. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
Internal private data value of a native Date/Time. No assumption is made about either the naming of this attribute or its type, or if more than one attribute is used. |
6.5.11. Duration Class
Class |
Duration |
|
---|---|---|
Description |
Assumed built-in primitive type representing a duration. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
Internal private data value of a native Duration. No assumption is made about either the naming of this attribute or its type, or if more than one attribute is used. |
6.5.12. Timezone Class
Class |
Timezone |
|
---|---|---|
Description |
Assumed built-in primitive type representing a timezone. |
|
Inherit |
6.5.13. Iso8601_type Class
Class |
Iso8601_type (abstract) |
|
---|---|---|
Description |
Abstract ancestor type of ISO 8601 types, defining interface for 'extended' and 'partial' concepts from ISO 8601. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: |
|
Functions |
Signature |
Meaning |
1..1 |
is_partial (): |
True if this date time is partial, i.e. if trailing end (right hand) value(s) is/are missing. |
1..1 |
is_extended (): |
True if this ISO8601 string is in the 'extended' form, i.e. uses ‘-’ and / or ‘:’ separators. |
6.5.14. Iso8601_date Class
Class |
Iso8601_date |
|
---|---|---|
Description |
Represents an ISO 8601 date, including partial and extended forms. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
month_unknown (): |
Indicates whether month in year is unknown. If so, the date is of the form “YYYY”. |
1..1 |
day_unknown (): |
Indicates whether day in month is unknown. If so, and month is known, the date is of the form “YYYY-MM” or “YYYYMM”. |
1..1 |
valid_iso8601_date (): |
String is a valid ISO 8601 date, i.e. takes the complete form:
or the equivalent extended form:
Where:
The combinations of YYYY, MM, DD numbers must be correct with respect to the Gregorian calendar. |
1..1 |
is_partial (): |
True if this date is partial, i.e. if days or more is missing. |
1..1 |
is_extended (): |
True if this date uses |
1..1 |
as_string (): |
ISO8601 string for date, in format |
1..1 |
as_date (): |
Convert to a native |
Invariants |
Year_valid: |
|
Month_valid: |
||
Day_valid: |
||
Partial_validity: |
6.5.15. Iso8601_time Class
Class |
Iso8601_time |
|||
---|---|---|---|---|
Description |
Represents an ISO 8601 time, including partial and extended forms.
|
|||
Inherit |
||||
Functions |
Signature |
Meaning |
||
1..1 |
minute_unknown (): |
Indicates whether minute is unknown. If so, the time is of the form “hh”. |
||
1..1 |
second_unknown (): |
Indicates whether second is unknown. If so and month is known, the time is of the form “hh:mm” or “hhmm”. |
||
1..1 |
is_decimal_sign_comma (): |
True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period). |
||
1..1 |
valid_iso8601_time (): |
String is a valid ISO 8601 date, i.e. takes the form:
or the extended form:
or one of the partial forms:
or the extended form:
with an additional optional timezone indicator of:
Where:
|
||
1..1 |
is_partial (): |
True if this time is partial, i.e. if seconds or more is missing. |
||
1..1 |
is_extended (): |
True if this time uses ‘-’, ‘:’ separators. |
||
1..1 |
as_string (): |
ISO8601 string for time, i.e. in the form:
or the extended form:
or a partial invariant. See |
||
1..1 |
has_fractional_second (): |
True if the fractional_second part is signficant (i.e. even if = 0.0). |
||
1..1 |
as_time (): |
Convert to a native |
||
Invariants |
Hour_valid: |
|||
Minute_valid: |
||||
Second_valid: |
||||
Fractional_second_valid: |
||||
Partial_validity: |
6.5.16. Iso8601_date_time Class
Class |
Iso8601_date_time |
|
---|---|---|
Description |
Represents an ISO 8601 date/time, including partial and extended forms. Note that this class includes 2 deviations from ISO 8601:2004:
|
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
month_unknown (): |
Indicates whether month in year is unknown. |
1..1 |
day_unknown (): |
Indicates whether day in month is unknown. |
1..1 |
minute_unknown (): |
Indicates whether minute in hour is known. |
1..1 |
second_unknown (): |
Indicates whether minute in hour is known. |
1..1 |
is_decimal_sign_comma (): |
True if this time has a decimal part indicated by ‘,’ (comma) rather than ‘.’ (period). |
1..1 |
String is a valid ISO 8601 date-time, i.e. takes the form:
or the extended form:
or one of the partial forms:
or the equivalent extended forms:
(meanings as in DV_DATE, DV_TIME) and the values in each field are valid. |
|
1..1 |
is_partial (): |
True if this date time is partial, i.e. if seconds or more is missing. |
1..1 |
is_extended (): |
True if this date/time uses ‘-’, ‘:’ separators. |
1..1 |
as_string (): |
ISO8601 string for date/time, in format:
or in extended format:
or a partial variant; see |
1..1 |
has_fractional_second (): |
True if the fractional_second part is signficant (i.e. even if = 0.0). |
1..1 |
as_date_time (): |
Convert to a native |
Invariants |
Year_valid: |
|
Month_valid: |
||
Day_valid: |
||
Hour_valid: |
||
Minute_valid: |
||
Second_valid: |
||
Fractional_second_valid: |
||
Partial_validity_year: |
||
Partial_validity_month: |
||
Partial_validity_day: |
||
Partial_validity_hour: |
||
Partial_validity_minute: |
6.5.17. Iso8601_duration Class
Class |
Iso8601_duration |
|||||
---|---|---|---|---|---|---|
Description |
Represents an ISO 8601 duration, which may have multiple parts from years down to seconds. |
|||||
Inherit |
||||||
Functions |
Signature |
Meaning |
||||
1..1 |
is_decimal_sign_comma (): |
True if this time has a decimal part indicated by ',' (comma) rather than '.' (period). |
||||
1..1 |
String is a valid ISO 8601 duration, i.e. takes the form:
Where each nn represents a number of years, months, etc. nnW represents a number of 7-day weeks. Note: allowing the W designator in the same expression as other designators is an exception to the published standard, but necessary in clinical information (typically for representing pregnancy duration). Parameters
Where each nn represents a number of years, months, etc. nnW represents a number of 7- day weeks.
|
|||||
1..1 |
is_partial (): |
Returns False. |
||||
1..1 |
is_extended (): |
Returns True. |
||||
1..1 |
as_string (): |
ISO8601 string for duration, in format
|
||||
1..1 |
months (): |
Number of months. |
||||
1..1 |
years (): |
Number of years of nominal 365-day length. |
||||
1..1 |
weeks (): |
Number of 7 day weeks. |
||||
1..1 |
to_seconds (): |
Total number of seconds equivalent (including fractional) of entire duration. |
||||
1..1 |
minutes (): |
Number of 60 second minutes. |
||||
1..1 |
hours (): |
Number of 60 minute hours. |
||||
1..1 |
days (): |
Number of 24 hour days. |
||||
1..1 |
as_duration (): |
Convert to a native |
||||
Invariants |
Years_valid: |
|||||
Months_valid: |
||||||
Weeks_valid: |
||||||
Days_valid: |
||||||
Hours_valid: |
||||||
Minutes_valid: |
||||||
Seconds_valid: |
||||||
Fractional_second_valid: |
6.5.18. Iso8601_timezone Class
Class |
Iso8601_timezone |
|
---|---|---|
Description |
Represents a timezone as used in ISO 8601. |
|
Inherit |
||
Functions |
Signature |
Meaning |
1..1 |
minute_unknown (): |
Indicates whether minute part known. |
1..1 |
is_partial (): |
True if this time zone is partial, i.e. if minutes is missing. |
1..1 |
is_extended (): |
True if this time-zone uses ‘:’ separators. |
1..1 |
as_string (): |
ISO8601 timezone string, in format:
where:
|
1..1 |
is_gmt (): |
True if timezone is UTC, i.e. +0000. |
1..1 |
as_timezone (): |
Convert to a native |
Invariants |
Min_hour_valid: |
|
Max_hour_valid: |
||
Minute_valid: |
||
Sign_valid: |
7. Functional Meta-types
7.1. Overview
A small number of meta-types are defined that correspond to functional programming primitives, otherwise known as 'closures', 'lambda expressions' and so on. These concepts are supported in most modern programming languages now, and the types defined here are intended to provide a minimal formal basis to enable other openEHR specification to defined function-related elements. Since UML does not contain native functional elements, the semantics here are approximated using normal class facilities.
The following illustrates the functional
package.
Two key abstractions are required, namely 'function as a type', and 'tuple', which enables arguments to be formalised. To provide a 'function' type, a 'routine' type is also required. For completeness, a 'procedure' type is also defined. The 'tuple' type is defined as a generic meta-type whose descendants may additionally define any number of generic parameter types, corresponding to a type list.
7.1.2. ROUTINE Class
Class |
ROUTINE<ARGS> |
|
---|---|---|
Description |
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
7.1.3. FUNCTION Class
Class |
FUNCTION<ARGS,RESULT> |
|
---|---|---|
Description |
Type representing a function with a return type and 0 or more arguments represented as a TUPLE. |
|
Inherit |
7.1.4. PROCEDURE Class
Class |
PROCEDURE<ARGS> |
|
---|---|---|
Description |
Type representing a procedure with 0 or more arguments represented as a TUPLE. |
|
Inherit |
7.1.6. TUPLE1 Class
Class |
TUPLE1<A> |
|
---|---|---|
Description |
A Tuple type used, among other things, for representing a single typed argument within a Routine signature. |
|
Inherit |
8. Type Cross-Reference
The following table provides a cross-reference from openEHR foundation types to their equivalents in common implementation formalisms. Where there is no equivalent listed, a specific library may still exist, or an implementation may be required of the openEHR specification.
Type name in openEHR |
Description | XML | Java | C# |
---|---|---|---|---|
|
8-bit value. |
- |
|
|
|
a member of an 8-bit character-set. |
|
|
|
|
logical True/False values. |
`boolean |
|
|
|
32-bit integers. |
`decimal |
|
|
|
64-bit integers. |
`decimal |
|
|
|
32-bit real numbers |
|
|
|
|
64-bit real numbers |
|
|
|
|
Unicode-enabled strings. |
|
|
|
|
Contiguous Array. |
|
|
|
|
Ordered List. |
|
|
|
|
Unordered, unique membership container. |
|
|
|
|
Unique-keyed map. |
(various) |
|
|
|
Interval of ordered types. |
- |
- |
|
|
Native date type. |
|
|
|
|
Native time type. |
|
|
|
|
Native date/time type. |
|
|
|
|
Native duration type. |
|
|
|
|
ISO8601-encoded date type. |
|
use |
(use formatted string) |
|
ISO8601-encoded time type. |
|
use j`ava.text.SimpleDateFormat` |
(use formatted string) |
|
ISO8601-encoded date/time type. |
|
use |
(use formatted string) |
|
ISO8601-encoded duration type. |
|
use |
(use formatted string) |
|
Interval of Integer. |
- |
(various) |
- |
|
Interval of Date. |
- |
(various) |
- |
|
Interval of Time. |
- |
(various) |
- |
|
Interval of DateTime. |
- |
(various) |
- |