An open domain-driven platform for developing flexible e-health systems
About this Website | Wiki | Jira | CKM

openEHR XML Schemas

Overview

This page provides access to the W3C XML schemas for the openEHR Reference Model (RM) and Archetype Model (AM).

Changes from previous release (1.0.1)

Basic_types.xsd:
  1. UID_BASED_ID is changed to abstract
  2. DV_AMOUNT class, a default value is added to accuracy element. The default value will be used when the accuracy is empty. However, when accuracy is not provided, then there will no default value for accuracy. Based on the spec, the DV_AMOUNT.accuracy is optional.
Resource.xsd:
  1. make AUTHORED_RESOURCE abstract
  2. make RESOURCE_DESCRIPTION.details element mandatory, i.e. change minOccurs="0" to minOccurs="1"
No other schemas are changed in this release.

Stable Schemas

For the RM, separate schemas have been created, as follows:
  • Basic types - types from rm.data_types and rm.support.identification packages. (xsd file)
  • Structure - types from rm.data_structures and rm.common.generic packages. (xsd file)
  • Resource - types from the rm.common.resource package (xsd file)
  • Content - item, Section, Entry and all subtypes. (xsd file)
  • Composition - rm.composition. (xsd file)
  • Version - the Version classes from rm.common.change_control (xsd file)
For the AM, two schemas are provided:
  • Archetype - types from the Archetype Object Model (AOM) (xsd file)
  • OpenehrProfile - types from the openEHR Archetype Profile package (xsd file)

Schemas in Development

Two further schemas are in the draft stage, and are under active development:
  • Extract - types from rm.extract package (xsd file)
  • openEHR Template - (coming soon)
    • an interim '.oet' Template schema (xsd file) - this file is used for templates created with Ocean tools, and is based on the official openEHR schemas published above. It will be replaced when the openEHR template specification is finalised.

Transformation Rules

The following mapping rules were used in order to create the schema from the reference model.

Basic type mappings

The basic types utilise the internal XML simpleTypes in accordance with the assumed types section in the Support IM.  Some changes have been made to the reference model to accommodate these standards.

Reference model type

XML Schema complexType

DV_DATE_TIME value is of type Iso8601DateTime, a restriction of xs:string, matching regular expression
\d{4}((0[1-9]|1[0-2])((0[1-9]|[12]\d|3[01])(T?([01]\d|2[0-3])([0-5]\d([0-5]\d([,.]\d+)?)?)?(Z|([+\-]((0\d)|(1[0-2]))(00|30)?))?)?)?)?|
\d{4}(\-(0[1-9]|1[0-2])(\-(0[1-9]|[12]\d|3[01])(T([01]\d|2[0-3])(:[0-5]\d(:[0-5]\d([,.]\d+)?)?)?(Z|([+\-]((0\d)|(1[0-2]))(:(00|30))?))?)?)?)?
DV_DATE value is of type Iso8601Date, a restriction of xs:string, matching regular expression
\d{4}((((0[1-9])|(1[0-2]))((0[1-9])|([12]\d)|(3[01]))?)?
|(\-(((0[1-9])|(1[0-2]))(\-((0[1-9])|([12]\d)|(3[01])))?)?)?)
DV_TIME value is of type Iso8601Time, a restriction of xs:string, matching regular expression
([01]\d|2[0-3])([0-5]\d([0-5]\d([,.]\d+)?)?)?(Z|([+\-]((0\d)|(1[0-2]))(00|30)?))?|
([01]\d|2[0-3])(:[0-5]\d(:[0-5]\d([,.]\d+)?)?)?(Z|([+\-]((0\d)|(1[0-2]))(:(00|30))?))?
DV_DURATION value is of type DV_Iso8601Duration, a restriction of xs:string, matching regular expression
P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?

Generic types

The openEHR reference model makes use of generic types - including DV_INTERVAL<T> (Data types IM) and VERSION<T> (Common IM) for example. As generic types are now available in C# and Java this is warranted for implementation specifications. Generic types are not available in XML Schema, so specific types prefixed with 'XS_' have been created to provide the same constraints.

Reference model type

XML Schema complexType

Interval<Integer> IntervalOfInteger (BaseTypes.xsd)
Interval<Real> IntervalOfReal (BaseTypes.xsd)
Interval<Date> IntervalOfDate (BaseTypes.xsd)
Interval<Time> IntervalOfTime (BaseTypes.xsd)
Interval<DateTime> IntervalOfDateTime (BaseTypes.xsd)
Interval<Duration> IntervalOfDuration (BaseTypes.xsd)
DV_INTERVAL<DV_ORDERED> only one type is used, namely DV_INTERVAL, with lower and upper of type DV_ORDERED. Software implementations
of the relevant generic types (DV_INTERVAL<DV_DATE> etc) are expected to implement further typing sensibly.
(BaseTypes.xsd)
VERSION<T> only one type is used, namely VERSION. The subtype ORIGINAL_VERSION has its data attribute of type LOCATABLE
(Version.xsd)

Multiple Inheritance

There are a couple of places where multiple inheritance occurs in the openEHR reference model. In all cases, only one inheritance branch corresponds to subtyping in the substitutability (i.e. 'is-a') sense; the other branches are always 'facility'  or 'mix-in' inheritance. In the RM, classes inheriting in this way include rm.data_types.quantity.DV_INTERVAL and the rm.data_types.quantity.date_time classes. The latter inherit only interface, which has no visibility in XML-schema. For the former, the inheritance of Interval<T> by DV_INTERVAL<T> is done in the schema simply by direct inclusion, since the other branch of inheritance (of DATA_VALUE) is the one which must be visible to schema processing.

Non-included classes and attributes

The following RM classes are not included in the schema, as they are not needed in the data view: UID, UUID, INTERNET_ID, ISO_OID, and VERSION_TREE_ID. UID and its subtypes are not needed because OBJECT_ID has a value attribute of type string and its subtypes have a function that return a UID.

Added attributes

None in the current release.

Conditional Rules

In instance data, LOCATABLE.archetype_details (of type ARCHETYPED) is only included when template_id exists, since the archetype_id attribute from ARCHETYPED is included by default as the value of LOCATABLE.archetype_node_id on archetype root-point LOCATABLE instances (top of a SECTION structure, OBSERVATION structure etc).

XML Attributes and Elements

XML attributes are not used with the exception of the LOCATABLE.archetype_node_id RM attribute, which is, from the point of view of RM classes, true meta-data. Making it an attribute allows archetype paths to be easily mapped to Xpaths.

Acknowledgements

This work was carried out for the openEHR Foundation  by Ocean Informatics. Many thanks to Dr Chunlan Ma, Heath Frankel and Lisa Thurston for maintaining the openEHR schemas. Thanks to the many people in the community including Mattias Forss and Andrew Patterson, who have provided feedback and improved them.


Acknowledgements: Atlassian (Jira, Confluence) | NoMagic (MagicDraw UML) | AsciiDoctor (publishing) | GitHub (DVCS) | LAMP dev community