Quantity Package

Overview

The data_types.quantity package is illustrated below. Dates and Times are found in the next section.

RM data types.quantity
Figure 1. rm.data_types.quantity package

Requirements

Scores and Scales

Medicine is a domain in which symbols representing relative magnitudes are commonly used, without exact values being used. The main purpose is usually to classify patients into groups for which different decisions might be made. Such classifications are typically known as scores or scales. For example the characterisation of pain as 'mild', 'medium', 'severe', or the reflex response to tendon percussion as "-", "+/-", "+", "++", "+++", "++++". Many scores such as the Apgar Score, Glasgow Coma Scale (GCS), and Barthel Index are globally known and used.

In some cases, there may be no way (or need) to precisely quantify such values because they reflect a subjective experience of the patient or informal judgment by the clinician. However, they are understood as being ordered, e.g. pass: [++] is arithmetically greater than `+`.

Similarly, even though the symbolic values for haemolysed blood in a urinalysis have approximate ranges stated for them, as shown below, these 'values' are not usable in the same way as true quantities.

  • "neg", "trace" (10 cells/μl)

  • "small" (<25 cells/μl)

  • "moderate" (<80 cells/μl)

  • "large" (>200 cells/μl)

A second requirement for score and scale values is that in many cases there is a need to associate numeric values values with the symbols, in order to facilitate ordered comparison, and also to enable longitudinal comparison across results of the same kind (e.g. pain, protein). The majority of scores and scales are limited to Integer values, but some use Real numbers interspersed with Integers e.g. the Borg CR 10 scale for perceived exertion. In both cases, values may be negative, zero or positive.

an argument sometimes put forward for recording all ordinals in a more precise way is that comparisons might want to be made between the values quoted by two laboratories for the same symbol (e.g. 'moderate'). There are a number of counter-arguments. Firstly, such comparisons are a poor attempt at normalisation, an activity which is the business of pathologists, not EHR users. Secondly, the symbolic values are often arrived at by the tester making a judgement of colour on a strip, which while an adequate (and cost-effective) approach for classifying, is not a valid means of quantifying a value. Lastly, in most cases, if a quantified point value or range is desired, or available, then it will be used - meaning that the appropriate quantitative data type can be used, rather than an the ordinal type.

Countable Things

A common kind of data value in medicine is the dimensionless countable quantity, e.g.

  • number of doses: 2;

  • number of previous pregnancies: 1;

  • number of tablets: 3.

Values of this type are always integral. Countable values need to be convertible to real numbers for statistical purposes, for example for a study of average number of pregnancies per couple.

Some countable entities such as tablets are divisible into major fractions, typically halves and occasionally quarters.

Dimensioned Quantities

The most common kind of quantity is a measured, dimensioned quantity. Anything which is measurable (rather than countable) involves a number of data aspects, namely:

  • a magnitude whose value is a real number;

  • the physical property being measured, with the appropriate units;

  • a concept of precision, i.e. to what number of decimal places the value is recorded;

  • a concept of accuracy, i.e. the known or assumed error in the measurement due to instrumentation or human judgement.

Examples of dimensioned quantities include:

  • systolic BP: 110 mmHg

  • height: 178 cm

  • rate of asthma attacks: 7 /week

  • weight loss: 2.5 kg

Ratios and Proportions

A common quantitative type in science and medicine is the proportion, or ratio, which is used in situations like the following:

  • 1:128 (a titer);

  • Na:K concentration ratio (unitary denominator);

  • albumin:creatinine ratio;

  • % e.g. red cell distribution width (RDW) which is the width of a distribution of RBC widths.

In general ratios have real number values, even if many examples appear to be integer ratios. Proportions with unitary denominator and % (denominator = 100) are common.

Formulations

A concept superficially similar to proportions and ratios is formulations of materials, such as a solid in a liquid e.g.:

  • 250 mg / 500 ml (solute/solvent)

Although a single solute/single solvent formulation appears to have the same form as a ratio, the general form is for any number of substances to be mixed together, usually according to a particular procedure. Formulations are therefore not candidates for direct modelling as fine-grained quantities, but instead are constructed by archetyping a higher-level structure, each leaf element of which contains the required kind of Quantity.

Quantity Ranges

Quantity ranges are ubiquitous in science and medicine, and may be defined for any kind of measured phenomenon. Examples include:

  • healthy weight range, e.g. 48kg - 60kg

  • normal range for urinalysis in pregnancy - protein, e.g. "nil" - "trace"

Reference Ranges

A reference range is a quantity range attached to a measured value, and is common for laboratory result values. The typical form of a reference range found in a pathology result indicates what is considered the 'normal' range for a measured value. Examples of reference ranges:

  • normal range for serum Na is 135 - 145 mmol/L.

  • desirable total cholesterol: < 5.5 mmol/L (strictly this probably should be 2.0 - 5.5 mmol/L, but is not usually quoted this way as low cholesterol is not considered a problem.)

Ranges can also be quoted for drug administrations, in which case they are usually thought of as the 'therapeutic' range. For example, the anticonvulsant drug Carbamazepine has a therapeutic range of 20 - 40 μMol/L. In some cases, there are multiple ranges associated with a drug, for example, Salicylate has a therapeutic range of 1.0 - 2.5 mmol/L and a toxic range > 3.6 mmol/L

Various examples occur in which multiple ranges may be stated, including the following.

  • The administration recomendations for drugs which depend on the particular patient state. For example, the therapeutic range of Cyclosporin (an immunosuppresant) is a function of time post-transplant for the affected organ, e.g. kidney: < 6 months: 250 - 350 μg/L, > 6 months: 100 - 200 μg/L.

  • Normal ranges for blood IgG, IgA, IgM which vary significantly with the age in months from birth.

  • Progesterone and pituitary hormones have ranges which are different for different phases of the menstrual cycle and for menopause. This may result in 4 or 5 ranges given for one result. Only one will apply to any particular patient - but the exact phase of the cycle may be unknown - so the ranges may need to be associated with the value with no 'normal' range.

Where there are multiple ranges, the important question is: which range information is relevant to the actual data being recorded for the patient? In theory, only the range corresponding to the particular patient situation should be used, i.e. the range which applies after taking into account sex, age, smoking status, "professional athlete", organ transplanted, etc. In most cases, this is a single "normal" range, or a pair of ranges, typically "therapeutic" and "critical". However, practical factors complicate things. Firstly, data is sometimes supplied from pathology labs along with some or all of the applicable reference ranges, even though only some could possibly apply. This is particularly the case if the laboratory has no other data on the patient, and cannot evaluate which range applies. The requirement for faithfulness of recording might be extended to reference data supplied by laboratories, regardless of how irrelevant or arbitrarily chosen the reference data is, meaning that such data has to be stored in the record anyway. Secondly, there may be circumstances in which physicians want a number of reference ranges, even while knowing that only one range is applicable to the datum. Ranges above and below the relevant one might be useful to a physician wishing to determine how far out of range the datum is.

Normal Range and Status in Laboratory data

It is quite common for laboratories to include a normal range with each measured value, and/or a normal 'status', which indicates where the value lies with respect to the normal range. The latter will commonly take the form of markers like "HHH" (critically high), HH (abnormally high), H (borderline high), L, LL, LLL in HL7v2 messaging, although other schemes are undoubtedly used.

Design

Basic Semantics

In order to make sense of the requirements in a systematic way, a proper typology for quantities is needed. The most basic characteristic of all values typically called 'quantities' is that they are ordered, meaning that the operator "<" (less-than) is defined between any two values in the domain. An ancestor class for all quantities called DV_ORDERED is accordingly defined. This type is subtyped into ordinals, scales and true quantities, represented by the classes DV_ORDINAL, DV_SCALE and DV_QUANTIFIED respectively.

DV_ORDINAL and DV_SCALE are used for scores and scales as described in the requirements above. DV_ORDINAL represents data values whose values are Integers, and which have symbolic or text names instead, such as "+", "++", "+++", or "mild", "medium", "severe". Each symbol can be assigned any Integer value, providing a basis for computable comparison. Typical uses for DV_ORDINAL include representing values from the Apgar and Glasgow Coma Scales, e.g. 0|heart rate absent|, 4|withdraws from pain|. DV_SCALE is similar to DV_ORDINAL, and was introduced to support scales / scores containing Real values as well as Integers.

In contrast to DV_ORDINAL and DV_SCALE, instances of DV_QUANTIFIED and all its subtypes have precise numeric magnitudes. Accordingly, DV_QUANTIFIED introduces the properties magnitude and magnitude_status. The magnitude attribute is guaranteed to be available on any DV_QUANTIFIED, carrying the effective value, regardless of the particular subtype. The optional magnitude_status attribute can be used to provide a non-quantified indication of accuracy, and takes the following values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, the meaning is "=".

Logically, an accuracy attribute should also be included in DV_QUANTIFIED, but as its modelling is different in the subtypes in a way that does not easily lend itself to a common ancestor, it is only included in the subtypes.

The DV_QUANTIFIED class has two subtypes: DV_AMOUNT and DV_ABSOLUTE_QUANTITY. The former corresponds to relative 'amounts' of something, either a physical property (such as mass) or items (e.g. cigarettes). Mathematically, the + and - operators (as well as * and /) are defined in the same way as for the real numbers (or any other mathematical 'field'), with the semantics that adding two relative quantities measuring the same thing (i.e. with the same units) produces another relative quantity of the same kind; while the semantics of subtraction are that one relative quantity subtracted from another generates a third.

The second subtype of DV_QUANTIFIED, DV_ABSOLUTE_QUANTITY, models quantities whose values are absolute along a line having a defined origin. The main example of absolute quantities are the temporal concepts date, time and date/time. These are distinguished from relative quantities in that the normal addition and subtraction operations don’t apply. Instead, the semantics of such operators are based on the idea of the difference between absolute values being a relative amount. For example, two dates can be subtracted, but the result is a duration, not another date. For this reason, the operations add, subtract and diff are defined rather than + or -. Date/time types, as well as the relative concept duration, are defined in [_date_time_package].

Subtypes of DV_AMOUNT are DV_PROPORTION, DV_QUANTITY, DV_COUNT, and DV_DURATION (see date_time package). The type DV_COUNT has an integer magnitude and is used to record naturally countable things such as number of previous pregnancies, number of steps taken by a recovering stroke victim and so on. There are no units or precision in a DV_COUNT. Countable quantities can be used to create instances of DV_QUANTITY, such as during a statistical study which average tobacco consumption over a time period. Such a computation might cause the creation of DV_QUANTITY objects representing values like {magnitude = 5.85, units = '/ week'}

DV_QUANTITY is used to represent amounts of measurable things, and has a real number magnitude, precision, units and accuracy. The units attribute contains the scientific unit in a parsable form defined by default by the Unified Code for Units of Measure (UCUM) (case-sensitive form), or by another system or terminology specified in the units_system attribute. In some cases, such as metric units, the UCUM code and the display form are the same, e.g. 'kg'. However this is not the general case, and many common units have different display and code forms, e.g. degrees Celcius: '°C' and 'Cel'. In general the unit display name should be looked up if it is not known in context that the code is directly displayable. The units_display_name attribute may be used if the displayable form of the units is required in the data, and/or terminology lookup is not available or desirable. Unit names may be language dependent, particularly older units.

A valid units string always implies a measured property, such as force or pressure. If unit strings are compared in the application environment to determine if they measure the same property (e.g. "bar" and "kPa" are both units of 'pressure'), which enables the is_strictly_comparable_to() function defined on DV_ORDERED to be properly specified on DV_QUANTITY.

while these semantics will allow comparison of e.g. two pressures recorded in mbar and mmHg, or even two accelerations whose units are `"m.s^-2" and "m/s^2", they provide no guarantee that this is a sensible thing to do in terms of domain semantics: comparing a blood pressure to an atmospheric pressure for example may or may not make any sense. It is not within the scope of the quantity package to express such semantics - this is up to application software which uses Quantities found in specific places in the data.

Accuracy and Uncertainty

Theoretically it might be argued that accuracy should not be included in a model for quantified values, because it is an artifact of a measuring process and/or device, not of a quantity itself. For example, a weight of "82 kg ±5%" can be represented in two parts. The "82 kg" is represented as a DV_QUANTITY, while the "±5%" could be included in the protocol description of the weighing instrument, since this is where the error comes from. For practical purposes however, (in)accuracy in a measured quantity corresponds to a range of possible values. In realistic computing in health, it is quite likely that the accuracy will be required in computations on quantities, especially for statistical population queries in which measurement error must be disambiguated from true correlation.

Accuracy is therefore introduced as the abstract feature accuracy of the DV_QUANTIFIED class. It is defined concretely in the two descendants, DV_AMOUNT, where it is of type Real, and DV_ABSOLUTE_QUANTITY, where it is of a differential type defined by subtypes. A value of 0 in either case indicates 100% accuracy, i.e. no error in measurement. Where accuracy is not recorded in a quantity, it is represented by a special value. In DV_AMOUNT, a value of -1 for the accuracy attribute is used for this purpose, and the constant unknown_accuracy_value = -1 is provided within the class to give a symbolic name for the special value. In the DV_ABSOLUTE_QUANTITY class, accuracy_unknown is represented by a Void (i.e. null) value for the accuracy attribute. An abstract Boolean feature accuracy_unknown is defined in the parent class DV_QUANTIFIED to provide a logical test of accuracy being absent, and is implemented in the respective descendants by concrete functions that check for the special values.

In addition, the class DV_AMOUNT, provides a feature accuracy_is_percent: Boolean to indicate if accuracy value is to be understood as a percentage, or an absolute value.

When two compatible quantities are added or subtracted using the + or - operators (DV_AMOUNT descendants) or add and substract (DV_ABSOLUTE_QUANTITY class), accuracy behaves in the following way:

  • if accuracies are present in both quantities, they are added in the result, for both addition and subtraction operations;

  • if either or both quantities has an unknown accuracy, the accuracy of the result is also unknown;

  • if two DV_AMOUNT descendants are added or subtracted, and only one has accuracy_is_percent = True, accuracy is expressed in the result in the form used in the larger of the two quantities.

The related notion of 'uncertainty' is understood as a subjective judgement made by the clinician, indicating that he/she is not certain of a particular statement. It is not the same as accuracy: uncertainty may apply to non-quantified values, such as subjective statements, and it is not an aspect of objective measurement processes, but of human confidence. Where the uncertainty is due to subjective memory e.g. "I think my grandfather was 56 when he died", the uncertainty is simply recorded as another value, along with the main data item being recorded. Uncertainty is therefore not directly modelled in the openEHR data types, but appears instead in particular archetypes.

Quantity Ranges

Ranges are modelled by the generic type DV_INTERVAL<T:DV_ORDERED> which enables a range of any of the other quantity types (except ratio) to be constructed. This allows any subtype of DV_ORDERED to occur as a range as well.

Proportions

The DV_PROPORTION type is provided for representing true ratios, i.e. relative values, and consists of numerator and denominator Real values, and a magnitude function which is computed as the result of the numerator/denominator division. The type attribute is used to indicate the logical type of the proportion. Supported types include:

  • percent: denominator is 100; usual presentation is "numerator %"

  • unitary: denominator is 1; usual presentation is "numerator"

  • fraction: numerator and denominator are both integer values; usual presentation is n/d, e.g. such as ½ or ¾, 1/2, 3/4 etc;

  • integer_fraction: numerator and denominator are both integer values; usual presentation is n/d; if numerator > denominator, display as "a b/c", i.e. the integer part followed by the remaining fraction part, e.g. 1½; this is the most likely form for expressing a number of tablets;

  • ratio: numerator and denominator can take any value; usual presentation is "numerator: denominator"

Lastly, the is_integral function indicates that the numerator and denominator are both integer values; this is used for fractions (the fraction and integer_fraction types above) and other commonly occurring ratios where both parts are always integer values.

Normal and Reference Ranges

Normal range for any of the quantity types (i.e. any instance of a subtype of DV_ORDERED) can be included via the attribute DV_ORDERED.normal_range, of type REFERENCE_RANGE. Other reference ranges (e.g. sub-critical, critical etc) can be included via the attribute DV_ORDERED.other_reference_ranges. The separation of normal and other reference range attributes is used because the former constitute the vast majority of ranges quoted for quantitative data.

Normal status can be included via the attribute DV_ORDERED.normal_status, which takes the form of a DV_ORDINAL, whose symbol attribute is coded according to the openEHR terminology group "normal status", and takes values "HHH" (critically high), "HH" (abnormally high), "H" (borderline high)", "N" (normal), "L" …​ "LLL".

Recording Time

Time can be recorded in two ways. Absolute times in the social time domain, such as dates and time of day are recorded using the types in the date_time package. Fine-grained 'time', which is a duration rather than a time, is recorded using a DV_QUANTITY with units = 's' or another temporal unit ('h', 'ms', 'ns' etc).

Class Descriptions

DV_ORDERED Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_ORDERED (abstract)

Description

Abstract class defining the concept of ordered values, which includes ordinals as well as true quantities. It defines the functions < and is_strictly_comparable_to(), the latter of which must evaluate to True for instances being compared with the < function, or used as limits in the DV_INTERVAL<T> class.

Data value types which are to be used as limits in the DV_INTERVAL<T> class must inherit from this class, and implement the function is_strictly_comparable_to() to ensure that instances compare meaningfully. For example, instances of DV_QUANTITY can only be compared if they measure the same kind of physical quantity.

Inherit

DATA_VALUE, Ordered

Attributes

Signature

Meaning

0..1

normal_status: CODE_PHRASE

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

0..1

normal_range: DV_INTERVAL

Optional normal range.

0..1

other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>>

Optional tagged other reference ranges for this value in its particular measurement context.

Functions

Signature

Meaning

1..1
(abstract)

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean

Test if two instances are strictly comparable. Effected in descendants.

1..1

is_simple (): Boolean

True if this quantity has no reference ranges.

1..1

is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”)

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

1..1
(abstract)

less_than alias "<" (
other: DV_ORDERED[1]
): Boolean

True if this Ordered object is less than other. Redefined in descendants.

Invariants

Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_ORDERED (abstract)

Abstract class defining the concept of ordered values, which includes ordinals as well as true quantities. It defines the functions < and is_strictly_comparable_to(), the latter of which must evaluate to True for instances being compared with the < function, or used as limits in the DV_INTERVAL<T> class.

Data value types which are to be used as limits in the DV_INTERVAL<T> class must inherit from this class, and implement the function is_strictly_comparable_to() to ensure that instances compare meaningfully. For example, instances of DV_QUANTITY can only be compared if they measure the same kind of physical quantity.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

normal_range: DV_INTERVAL [0..1]

Optional normal range.

other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

Functions

(abstract) Any.is_equal (
other: Any[1]
): Boolean [1..1]

Value equality: return True if this and other are attached to objects considered to be equal in value.

Parameters
other

Other object for comparison.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

(abstract) less_than alias "<" (
other: DV_ORDERED[1]
): Boolean [1..1]

True if this Ordered object is less than other. Redefined in descendants.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

(abstract) is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Test if two instances are strictly comparable. Effected in descendants.

is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

Invariants

Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

{
    "name": "DV_ORDERED",
    "documentation": "Abstract class defining the concept of ordered values, which includes ordinals as well as true quantities. It defines the functions  `<` and `_is_strictly_comparable_to()_`, the latter of which must evaluate to `True` for instances being compared with the  `<` function, or used as limits in the `DV_INTERVAL<T>` class. \n\nData value types which are to be used as limits in the `DV_INTERVAL<T>` class must inherit from this class, and implement the function `_is_strictly_comparable_to()_` to ensure that instances compare meaningfully. For example, instances of `DV_QUANTITY` can only be compared if they measure the same kind of physical quantity. \n",
    "is_abstract": true,
    "ancestors": [
        "DATA_VALUE",
        "Ordered"
    ],
    "properties": {
        "normal_status": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "normal_status",
            "documentation": "Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group  `normal_status`. ",
            "type": "CODE_PHRASE"
        },
        "normal_range": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "normal_range",
            "documentation": "Optional normal range. ",
            "type": "DV_INTERVAL"
        },
        "other_reference_ranges": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "other_reference_ranges",
            "documentation": "Optional tagged other reference ranges for this value in its particular measurement context.",
            "type_def": {
                "container_type": "List",
                "type_def": {
                    "_type": "P_BMM_GENERIC_TYPE",
                    "root_type": "REFERENCE_RANGE",
                    "generic_parameters": [
                        "DV_ORDERED"
                    ]
                }
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "Test if two instances are strictly comparable. Effected in descendants.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_simple": {
            "name": "is_simple",
            "documentation": "True if this quantity has no reference ranges.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_normal": {
            "name": "is_normal",
            "documentation": "Value is in the normal range, determined by comparison of the value to `_normal_range_` if present, or by the `_normal_status_` marker if present. \n",
            "pre_conditions": {
                "Pre": "normal_range /= Void or normal_status /= Void"
            },
            "post_conditions": {
                "Post_range": "normal_range /= Void implies Result = normal_range.has (self)",
                "Post_status": "normal_status /= Void implies normal_status.code_string.is_equal (“N”)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Ordered object is less than `_other_`. Redefined in descendants.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    },
    "invariants": {
        "Other_reference_ranges_validity": "other_reference_ranges /= Void implies not other_reference_ranges.is_empty",
        "Is_simple_validity": "(normal_range = Void and other_reference_ranges = Void) implies is_simple",
        "Normal_status_validity": "normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)",
        "Normal_range_and_status_consistency": "(normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))"
    }
}
DV_ORDERED

DV_INTERVAL Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_INTERVAL<T>

Description

Generic class defining an interval (i.e. range) of a comparable type. An interval is a contiguous subrange of a comparable base type. Used to define intervals of dates, times, quantities (whose units match) and so on. The type parameter, T, must be a descendant of the type DV_ORDERED, which is necessary (but not sufficient) for instances to be compared (strictly_comparable is also needed).

Without the DV_INTERVAL class, quite a few more DV_ classes would be needed to express logical intervals, namely interval versions of all the date/time classes, and of quantity classes. Further, it allows the semantics of intervals to be stated in one place unequivocally, including the conditions for strict comparison.

The basic semantics are derived from the class Interval<T>, described in the support RM.

Inherit

DATA_VALUE, Interval

Invariants

Limits_consistent: (not upper_unbounded and not lower_unbounded) implies (lower.is_strictly_comparable_to(upper) and lower <= upper)

DV_INTERVAL<T>

Generic class defining an interval (i.e. range) of a comparable type. An interval is a contiguous subrange of a comparable base type. Used to define intervals of dates, times, quantities (whose units match) and so on. The type parameter, T, must be a descendant of the type DV_ORDERED, which is necessary (but not sufficient) for instances to be compared (strictly_comparable is also needed).

Without the DV_INTERVAL class, quite a few more DV_ classes would be needed to express logical intervals, namely interval versions of all the date/time classes, and of quantity classes. Further, it allows the semantics of intervals to be stated in one place unequivocally, including the conditions for strict comparison.

The basic semantics are derived from the class Interval<T>, described in the support RM.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Interval

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

Interval.lower: T [0..1]

Lower bound.

Interval.upper: T [0..1]

Upper bound.

Interval.lower_unbounded: Boolean [1..1]

True if lower boundary open (i.e. = -infinity).

Interval.upper_unbounded: Boolean [1..1]

True if upper boundary open (i.e. = +infinity).

Interval.lower_included: Boolean [1..1]

True if lower boundary value included in range, if not lower_unbounded.

Interval.upper_included: Boolean [1..1]

True if upper boundary value included in range if not upper_unbounded.

Functions

(abstract) Interval.is_equal (
other: Any[1]
): Boolean [1..1]

True if current object’s interval is semantically same as other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

(abstract) Interval.has (
e: T[1]
): Boolean

Post_result: Result = (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 the value e is properly contained in this Interval.

(abstract) Interval.intersects (
other: Interval[1]
): Boolean [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.

(abstract) Interval.contains (
other: Interval[1]
): Boolean [1..1]

True if current interval properly contains other? True if all points of other are inside the current interval.

Invariants

Interval.Lower_included_valid: lower_unbounded implies not lower_included

Interval.Upper_included_valid: upper_unbounded implies not upper_included

Limits_consistent: (not upper_unbounded and not lower_unbounded) implies (lower.is_strictly_comparable_to(upper) and lower <= upper)

Interval.Limits_comparable: (not upper_unbounded and not lower_unbounded) implies lower.strictly_comparable_to (upper)

{
    "name": "DV_INTERVAL",
    "documentation": "Generic class defining an interval (i.e. range) of a comparable type. An interval is a contiguous subrange of a comparable base type. Used to define intervals of dates, times, quantities (whose units match) and so on. The type parameter, `T`, must be a descendant of the type `DV_ORDERED`, which is necessary (but not sufficient) for instances to be compared (`_strictly_comparable_` is also needed). \n\nWithout the `DV_INTERVAL` class, quite a few more `DV_` classes would be needed to express logical intervals, namely interval versions of all the date/time classes, and of quantity classes. Further, it allows the semantics of intervals to be stated in one place unequivocally, including the conditions for strict comparison. \n\nThe basic semantics are derived from the class `Interval<T>`, described in the support RM. ",
    "ancestors": [
        "DATA_VALUE",
        "Interval"
    ],
    "generic_parameter_defs": {
        "T": {
            "name": "T",
            "conforms_to_type": "DV_ORDERED"
        }
    },
    "invariants": {
        "Limits_consistent": "(not upper_unbounded and not lower_unbounded) implies (lower.is_strictly_comparable_to(upper) and lower <= upper)"
    }
}
DV_INTERVAL

REFERENCE_RANGE Class

  • Definition

  • Effective

  • BMM

  • UML

Class

REFERENCE_RANGE<T>

Description

Defines a named range to be associated with any DV_ORDERED datum. Each such range is particular to the patient and context, e.g. sex, age, and any other factor which affects ranges. May be used to represent normal, therapeutic, dangerous, critical etc ranges.

Attributes

Signature

Meaning

1..1

meaning: DV_TEXT

Term whose value indicates the meaning of this range, e.g. normal, critical, therapeutic etc.

1..1

range: DV_INTERVAL

The data range for this meaning, e.g. critical etc.

Functions

Signature

Meaning

1..1

is_in_range (
v: DV_ORDERED[1]
): Boolean

Indicates if the value v is inside the range.

Invariants

Range_is_simple: (range.lower_unbounded or else range.lower.is_simple) and (range.upper_unbounded or else range.upper.is_simple)

REFERENCE_RANGE<T>

Defines a named range to be associated with any DV_ORDERED datum. Each such range is particular to the patient and context, e.g. sex, age, and any other factor which affects ranges. May be used to represent normal, therapeutic, dangerous, critical etc ranges.

Attributes

meaning: DV_TEXT [1..1]

Term whose value indicates the meaning of this range, e.g. normal, critical, therapeutic etc.

range: DV_INTERVAL [1..1]

The data range for this meaning, e.g. critical etc.

Functions

is_in_range (
v: DV_ORDERED[1]
): Boolean [1..1]

Indicates if the value v is inside the range.

Invariants

Range_is_simple: (range.lower_unbounded or else range.lower.is_simple) and (range.upper_unbounded or else range.upper.is_simple)

{
    "name": "REFERENCE_RANGE",
    "documentation": "Defines a named range to be associated with any `DV_ORDERED` datum. Each such range is particular to the patient and context, e.g. sex, age, and any other factor which affects ranges. May be used to represent normal, therapeutic, dangerous, critical etc ranges.",
    "generic_parameter_defs": {
        "T": {
            "name": "T",
            "conforms_to_type": "DV_ORDERED"
        }
    },
    "properties": {
        "meaning": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "meaning",
            "documentation": "Term whose value indicates the meaning of this range, e.g.  normal,  critical,  therapeutic  etc.",
            "is_mandatory": true,
            "type": "DV_TEXT"
        },
        "range": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "range",
            "documentation": "The data range for this meaning, e.g. critical  etc.",
            "is_mandatory": true,
            "type": "DV_INTERVAL"
        }
    },
    "functions": {
        "is_in_range": {
            "name": "is_in_range",
            "documentation": "Indicates if the value  `_v_` is inside the range.\n",
            "parameters": {
                "v": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "v",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    },
    "invariants": {
        "Range_is_simple": "(range.lower_unbounded or else range.lower.is_simple) and (range.upper_unbounded or else range.upper.is_simple)"
    }
}
REFERENCE_RANGE

DV_ORDINAL Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_ORDINAL

Description

A data type that represents integral score values, e.g. pain, Apgar values, etc, where there is:

a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) integer values only.

Note that although the term 'ordinal' in mathematics means natural numbers only, here any integer is allowed, since negative and zero values are often used by medical professionals for values around a neutral point. Examples of sets of ordinal values:

  • -3, -2, -1, 0, 1, 2, 3  — reflex response values

  • 0, 1, 2  — Apgar values

This class is used for recording any clinical datum which is customarily recorded using symbolic values. Example: the results on a urinalysis strip, e.g. {neg, trace, , , } are used for leucocytes, protein, nitrites etc; for non-haemolysed blood {neg, trace, moderate}; for haemolysed blood {small, moderate, large}.

For scores or scales that include Real numbers (or might in the future, i.e. not fixed for all time, such as Apgar), use DV_SCALE. DV_SCALE may also be used in future for representing purely Integer-based scales, however, the DV_ORDINAL type should continue to be supported in software implementations in order to accommodate existing data that are instances of this type.

Inherit

DV_ORDERED

Attributes

Signature

Meaning

1..1

symbol: DV_CODED_TEXT

Coded textual representation of this value in the enumeration, which may be strings made from + symbols, or other enumerations of terms such as mild, moderate, severe, or even the same number series as the values, e.g. 1, 2, 3.

1..1

value: Integer

Value in ordered enumeration of values. Any integer value can be used.

Functions

Signature

Meaning

1..1
(effected)

less_than alias "<" (
other: DV_ORDINAL[1]
): Boolean

True if this Ordinal value is less than other.

1..1
(effected)

is_strictly_comparable_to (
other: DV_ORDINAL[1]
): Boolean

Test if this Ordinal is strictly comparable to other.

DV_ORDINAL

A data type that represents integral score values, e.g. pain, Apgar values, etc, where there is:

a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) integer values only.

Note that although the term 'ordinal' in mathematics means natural numbers only, here any integer is allowed, since negative and zero values are often used by medical professionals for values around a neutral point. Examples of sets of ordinal values:

  • -3, -2, -1, 0, 1, 2, 3  — reflex response values

  • 0, 1, 2  — Apgar values

This class is used for recording any clinical datum which is customarily recorded using symbolic values. Example: the results on a urinalysis strip, e.g. {neg, trace, , , } are used for leucocytes, protein, nitrites etc; for non-haemolysed blood {neg, trace, moderate}; for haemolysed blood {small, moderate, large}.

For scores or scales that include Real numbers (or might in the future, i.e. not fixed for all time, such as Apgar), use DV_SCALE. DV_SCALE may also be used in future for representing purely Integer-based scales, however, the DV_ORDINAL type should continue to be supported in software implementations in order to accommodate existing data that are instances of this type.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

DV_ORDERED.normal_range: DV_INTERVAL [0..1]

Optional normal range.

DV_ORDERED.other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

symbol: DV_CODED_TEXT [1..1]

Coded textual representation of this value in the enumeration, which may be strings made from + symbols, or other enumerations of terms such as mild, moderate, severe, or even the same number series as the values, e.g. 1, 2, 3.

value: Integer [1..1]

Value in ordered enumeration of values. Any integer value can be used.

Functions

(abstract) Any.is_equal (
other: Any[1]
): Boolean [1..1]

Value equality: return True if this and other are attached to objects considered to be equal in value.

Parameters
other

Other object for comparison.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_ORDINAL[1]
): Boolean [1..1]

True if this Ordinal value is less than other.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

is_strictly_comparable_to (
other: DV_ORDINAL[1]
): Boolean [1..1]

Test if this Ordinal is strictly comparable to other.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

{
    "name": "DV_ORDINAL",
    "documentation": "A data type that represents integral score values, e.g. pain, Apgar values, etc, where there is:\n\na) implied ordering, \nb) no implication that the distance between each value is constant, and \nc) the total number of values is finite;\nd) integer values only.\n\nNote that although the term 'ordinal' in mathematics means natural numbers only, here any integer is allowed, since negative and zero values are often used by medical professionals for values around a neutral point. Examples of sets of ordinal values: \n\n*   -3, -2, -1, 0, 1, 2, 3  -- reflex response values \n*    0, 1, 2                  -- Apgar values \n\nThis class is used for recording any clinical datum which is customarily recorded using symbolic values. Example: the results on a urinalysis strip, e.g. `{neg, trace, +, ++, +++}` are used for leucocytes, protein, nitrites etc; for non-haemolysed blood `{neg, trace, moderate}`; for haemolysed blood `{small, moderate, large}`.\n\nFor scores or scales that include Real numbers (or might in the future, i.e. not fixed for all time, such as Apgar), use `DV_SCALE`. `DV_SCALE` may also be used in future for representing purely Integer-based scales, however, the `DV_ORDINAL` type should continue to be supported in software implementations in order to accommodate existing data that are instances of this type.",
    "ancestors": [
        "DV_ORDERED"
    ],
    "properties": {
        "symbol": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "symbol",
            "documentation": "Coded textual representation of this value in the enumeration, which may be strings made from  +  symbols, or other enumerations of terms such as  `mild`, `moderate`, `severe`, or even the same number series as the values, e.g. 1, 2, 3.",
            "is_mandatory": true,
            "type": "DV_CODED_TEXT"
        },
        "value": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "value",
            "documentation": "Value in ordered enumeration of values. Any integer value can be used. \n",
            "is_mandatory": true,
            "type": "Integer"
        }
    },
    "functions": {
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Ordinal value is less than `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDINAL"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "Test if this Ordinal is strictly comparable to `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDINAL"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
DV_ORDINAL

DV_SCALE Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_SCALE

Description

A data type that represents scale values, where there is:

a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) non-integer values are allowed.

Example:

Borg CR 10 Scale

0    No Breathlessness at all
0.5  Very Very Slight (Just Noticeable)
1    Very Slight
2    Slight Breathlessness
3    Moderate
... etc

For scores that include only Integers, DV_SCALE may also be used, but DV_ORDINAL should be supported to accommodate existing data instances of that type.

Inherit

DV_ORDERED

Attributes

Signature

Meaning

1..1

symbol: DV_CODED_TEXT

Coded textual representation of this value in the scale range, which may be strings made from symbols or other enumerations of terms such as no breathlessness, very very slight, slight breathlessness. Codes come from archetypes.

In some cases, a scale may include values that have no code/symbol. In this case, the symbol will be a DV-CODED_TEXT including the terminology_id and a blank String value for code_string.

1..1

value: Real

Real number value of Scale item.

Functions

Signature

Meaning

1..1
(effected)

is_strictly_comparable_to (
other: DV_SCALE[1]
): Boolean

Test if this Scale value is strictly comparable to other.

1..1
(effected)

less_than alias "<" (
other: DV_SCALE[1]
): Boolean

True if this Scale value is less than other.

DV_SCALE

A data type that represents scale values, where there is:

a) implied ordering, b) no implication that the distance between each value is constant, and c) the total number of values is finite; d) non-integer values are allowed.

Example:

Borg CR 10 Scale

0    No Breathlessness at all
0.5  Very Very Slight (Just Noticeable)
1    Very Slight
2    Slight Breathlessness
3    Moderate
... etc

For scores that include only Integers, DV_SCALE may also be used, but DV_ORDINAL should be supported to accommodate existing data instances of that type.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

DV_ORDERED.normal_range: DV_INTERVAL [0..1]

Optional normal range.

DV_ORDERED.other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

symbol: DV_CODED_TEXT [1..1]

Coded textual representation of this value in the scale range, which may be strings made from symbols or other enumerations of terms such as no breathlessness, very very slight, slight breathlessness. Codes come from archetypes.

In some cases, a scale may include values that have no code/symbol. In this case, the symbol will be a DV-CODED_TEXT including the terminology_id and a blank String value for code_string.

value: Real [1..1]

Real number value of Scale item.

Functions

(abstract) Any.is_equal (
other: Any[1]
): Boolean [1..1]

Value equality: return True if this and other are attached to objects considered to be equal in value.

Parameters
other

Other object for comparison.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_SCALE[1]
): Boolean [1..1]

True if this Scale value is less than other.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

is_strictly_comparable_to (
other: DV_SCALE[1]
): Boolean [1..1]

Test if this Scale value is strictly comparable to other.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

{
    "name": "DV_SCALE",
    "documentation": "A data type that represents scale values, where there is:\n\na) implied ordering, \nb) no implication that the distance between each value is constant, and \nc) the total number of values is finite;\nd) non-integer values are allowed.\n\nExample:\n\n----\nBorg CR 10 Scale\n\n0    No Breathlessness at all\n0.5  Very Very Slight (Just Noticeable)\n1    Very Slight\n2    Slight Breathlessness\n3    Moderate\n... etc\n----\n\nFor scores that include only Integers, `DV_SCALE` may also be used, but `DV_ORDINAL` should be supported to accommodate existing data instances of that type.",
    "ancestors": [
        "DV_ORDERED"
    ],
    "properties": {
        "symbol": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "symbol",
            "documentation": "Coded textual representation of this value in the scale range, which may be strings made from symbols or other enumerations of terms such as  `no breathlessness`, `very very slight`, `slight breathlessness`. Codes come from archetypes.\n\nIn some cases, a scale may include values that have no code/symbol. In this case, the symbol will be a `DV-CODED_TEXT` including the `_terminology_id_` and a blank String value for `_code_string_`.",
            "is_mandatory": true,
            "type": "DV_CODED_TEXT"
        },
        "value": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "value",
            "documentation": "Real number value of Scale item.\n",
            "is_mandatory": true,
            "type": "Real"
        }
    },
    "functions": {
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "Test if this Scale value is strictly comparable to `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_SCALE"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Scale value is less than `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_SCALE"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
DV_SCALE

DV_QUANTIFIED Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_QUANTIFIED (abstract)

Description

Abstract class defining the concept of true quantified values, i.e. values which are not only ordered, but which have a precise magnitude.

Inherit

DV_ORDERED

Attributes

Signature

Meaning

0..1

magnitude_status: String

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

0..1

accuracy: Any

Accuracy of measurement. Exact form of expression determined in descendants.

Functions

Signature

Meaning

1..1

valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"}

Test whether a string value is one of the valid values for the magnitude_status attribute.

1..1
(abstract)

magnitude (): Ordered_Numeric

1..1

accuracy_unknown (): Boolean

True if accuracy is not known, e.g. due to not being recorded or discernable.

1..1
(abstract)

is_equal (
other: DV_QUANTIFIED[1]
): Boolean

Return True if this DV_QUANTIFIED is considered equal to other.

1..1
(redefined)

less_than alias "<" (
other: DV_QUANTIFIED[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude

True if this Quantified object is less than other, based on comparison of magnitude.

Invariants

Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

DV_QUANTIFIED (abstract)

Abstract class defining the concept of true quantified values, i.e. values which are not only ordered, but which have a precise magnitude.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

DV_ORDERED.normal_range: DV_INTERVAL [0..1]

Optional normal range.

DV_ORDERED.other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

accuracy: Any [0..1]

Accuracy of measurement. Exact form of expression determined in descendants.

Functions

(abstract) is_equal (
other: DV_QUANTIFIED[1]
): Boolean [1..1]

Return True if this DV_QUANTIFIED is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_QUANTIFIED[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this Quantified object is less than other, based on comparison of magnitude.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

(abstract) DV_ORDERED.is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Test if two instances are strictly comparable. Effected in descendants.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

(abstract) magnitude (): Ordered_Numeric [1..1]

accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

{
    "name": "DV_QUANTIFIED",
    "documentation": "Abstract class defining the concept of true quantified values, i.e. values which are not only ordered, but which have a precise magnitude.",
    "is_abstract": true,
    "ancestors": [
        "DV_ORDERED"
    ],
    "properties": {
        "magnitude_status": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "magnitude_status",
            "documentation": "Optional status of magnitude with values: \n\n* `\"=\"`   :   magnitude is a point value \n* `\"<\"`   :   value is < magnitude \n* `\">\"`   :   value is > magnitude \n* `\"<=\"` : value is <= magnitude \n* `\">=\"` : value is >= magnitude \n* `\"~\"`   :   value is approximately magnitude \n\nIf not present, assumed meaning is  `\"=\"` . \n",
            "type": "String"
        },
        "accuracy": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "accuracy",
            "documentation": "Accuracy of measurement. Exact form of expression determined in descendants.",
            "type": "Any"
        }
    },
    "functions": {
        "valid_magnitude_status": {
            "name": "valid_magnitude_status",
            "documentation": "Test whether a string value is one of the valid values for the magnitude_status attribute. ",
            "post_conditions": {
                "Post": "Result = s in {\"=\", \"<\", \">\", \"<=\", \">=\", \"~\"}"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "magnitude": {
            "name": "magnitude",
            "is_abstract": true,
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Ordered_Numeric"
            }
        },
        "accuracy_unknown": {
            "name": "accuracy_unknown",
            "documentation": "True if accuracy is not known, e.g. due to not being recorded or discernable.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_equal": {
            "name": "is_equal",
            "documentation": "Return True if this `DV_QUANTIFIED` is considered equal to `_other_`.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_QUANTIFIED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Quantified object is less than `_other_`, based on comparison of `_magnitude_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_QUANTIFIED"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable()"
            },
            "post_conditions": {
                "Post_result": "Result = magnitude < other.magnitude"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    },
    "invariants": {
        "Magnitude_status_valid": "magnitude_status /= Void implies valid_magnitude_status (magnitude_status)"
    }
}
DV_QUANTIFIED

DV_AMOUNT Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_AMOUNT (abstract)

Description

Abstract class defining the concept of relative quantified 'amounts'. For relative quantities, the + and - operators are defined (unlike descendants of DV_ABSOLUTE_QUANTITY, such as the date/time types).

Inherit

DV_QUANTIFIED

Attributes

Signature

Meaning

0..1

accuracy_is_percent: Boolean

If True, indicates that when this object was created, accuracy was recorded as a percent value; if False, as an absolute quantity value.

0..1
(redefined)

accuracy: Real

Accuracy of measurement, expressed either as a half-range percent value (accuracy_is_percent = True) or a half-range quantity. A value of 0 means that accuracy is 100%, i.e. no error.

A value of unknown_accuracy_value means that accuracy was not recorded.

Functions

Signature

Meaning

1..1

valid_percentage (
number: Ordered_Numeric[1]
): Boolean

Test whether a number is a valid percentage, i.e. between 0 and 100.

1..1

add alias "+" (
other: DV_AMOUNT[1]
): DV_AMOUNT

Pre_comparable: is_strictly_comparable_to (other)

Sum of this amount and another. The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • both operand accuracies are unknown_accuracy_value.

If the accuracy value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.

1..1

subtract alias "-" (
other: DV_AMOUNT[1]
): DV_AMOUNT

Difference of this amount and another. The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

If the accuracy value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.

1..1
(abstract)

is_equal (
other: DV_AMOUNT[1]
): Boolean

Return True if this DV_AMOUNT is considered equal to other.

1..1

multiply alias "*" (
factor: Real[1]
): DV_AMOUNT

Product of this Amount and factor.

1..1

negative alias "-" (): DV_AMOUNT

Negated version of current object, such as used for representing a difference, e.g. a weight loss.

1..1
(redefined)

less_than alias "<" (
other: DV_AMOUNT[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude

True if this object is less than other. Based on comparison of magnitude.

Invariants

Accuracy_is_percent_validity: accuracy = 0 implies not accuracy_is_percent

Accuracy_validity: accuracy_is_percent implies valid_percentage (accuracy)

DV_AMOUNT (abstract)

Abstract class defining the concept of relative quantified 'amounts'. For relative quantities, the + and - operators are defined (unlike descendants of DV_ABSOLUTE_QUANTITY, such as the date/time types).

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

DV_ORDERED.normal_range: DV_INTERVAL [0..1]

Optional normal range.

DV_ORDERED.other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

DV_QUANTIFIED.magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

accuracy: Real [0..1]

Accuracy of measurement, expressed either as a half-range percent value (accuracy_is_percent = True) or a half-range quantity. A value of 0 means that accuracy is 100%, i.e. no error.

A value of unknown_accuracy_value means that accuracy was not recorded.

accuracy_is_percent: Boolean [0..1]

If True, indicates that when this object was created, accuracy was recorded as a percent value; if False, as an absolute quantity value.

Functions

(abstract) is_equal (
other: DV_AMOUNT[1]
): Boolean [1..1]

Return True if this DV_AMOUNT is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_AMOUNT[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this object is less than other. Based on comparison of magnitude.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

(abstract) DV_ORDERED.is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Test if two instances are strictly comparable. Effected in descendants.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

DV_QUANTIFIED.valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

(abstract) DV_QUANTIFIED.magnitude (): Ordered_Numeric [1..1]

DV_QUANTIFIED.accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

valid_percentage (
number: Ordered_Numeric[1]
): Boolean [1..1]

Test whether a number is a valid percentage, i.e. between 0 and 100.

add alias "+" (
other: DV_AMOUNT[1]
): DV_AMOUNT

Pre_comparable: is_strictly_comparable_to (other) [1..1]

Sum of this amount and another. The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • both operand accuracies are unknown_accuracy_value.

If the accuracy value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.

subtract alias "-" (
other: DV_AMOUNT[1]
): DV_AMOUNT [1..1]

Difference of this amount and another. The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

If the accuracy value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.

multiply alias "*" (
factor: Real[1]
): DV_AMOUNT [1..1]

Product of this Amount and factor.

negative alias "-" (): DV_AMOUNT [1..1]

Negated version of current object, such as used for representing a difference, e.g. a weight loss.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_QUANTIFIED.Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

Accuracy_is_percent_validity: accuracy = 0 implies not accuracy_is_percent

Accuracy_validity: accuracy_is_percent implies valid_percentage (accuracy)

{
    "name": "DV_AMOUNT",
    "documentation": "Abstract class defining the concept of relative quantified  'amounts'. For relative quantities, the  `+` and  `-` operators are defined (unlike descendants of `DV_ABSOLUTE_QUANTITY`, such as the date/time types). \n",
    "is_abstract": true,
    "ancestors": [
        "DV_QUANTIFIED"
    ],
    "properties": {
        "accuracy_is_percent": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "accuracy_is_percent",
            "documentation": "If `True`, indicates that when this object was created, `_accuracy_` was recorded as a percent value; if `False`, as an absolute quantity value.",
            "type": "Boolean"
        },
        "accuracy": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "accuracy",
            "documentation": "Accuracy of measurement, expressed either as a half-range percent value (`_accuracy_is_percent_` = `True`) or a half-range quantity. A value of `0` means that accuracy is 100%, i.e. no error.\n\nA value of `_unknown_accuracy_value_` means that accuracy was not recorded.",
            "type": "Real"
        }
    },
    "functions": {
        "valid_percentage": {
            "name": "valid_percentage",
            "documentation": "Test whether a number is a valid percentage, i.e. between 0 and 100. ",
            "parameters": {
                "number": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "number",
                    "type": "Ordered_Numeric"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "add": {
            "name": "add",
            "aliases": [
                "+"
            ],
            "documentation": "Sum of this amount and another. The value of accuracy in the result is either:\n\n* the sum of the accuracies of the operands, if both present, or;\n* both operand accuracies are unknown_accuracy_value.\n\nIf the accuracy value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_AMOUNT"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable_to (other)"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_AMOUNT"
            }
        },
        "subtract": {
            "name": "subtract",
            "aliases": [
                "-"
            ],
            "documentation": "Difference of this amount and another. The value of `_accuracy_` in the result is either:\n\n* the sum of the accuracies of the operands, if both present, or;\n* unknown, if either or both operand accuracies are unknown.\n\nIf the `_accuracy_` value is a percentage in one operand and not in the other, the form in the result is that of the larger operand.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_AMOUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_AMOUNT"
            }
        },
        "is_equal": {
            "name": "is_equal",
            "documentation": "Return True if this `DV_AMOUNT` is considered equal to `_other_`.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_AMOUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "multiply": {
            "name": "multiply",
            "aliases": [
                "&#42;"
            ],
            "documentation": "Product of this Amount and `_factor_`.",
            "parameters": {
                "factor": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "factor",
                    "type": "Real"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_AMOUNT"
            }
        },
        "negative": {
            "name": "negative",
            "aliases": [
                "-"
            ],
            "documentation": "Negated version of current object, such as used for representing a difference, e.g. a weight loss.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_AMOUNT"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this object is less than `_other_`. Based on comparison of `_magnitude_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_AMOUNT"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable()"
            },
            "post_conditions": {
                "Post_result": "Result = magnitude < other.magnitude"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    },
    "invariants": {
        "Accuracy_is_percent_validity": "accuracy = 0 implies not accuracy_is_percent",
        "Accuracy_validity": "accuracy_is_percent implies valid_percentage (accuracy)"
    }
}
DV_AMOUNT

DV_QUANTITY Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_QUANTITY

Description

Quantitified type representing scientific quantities, i.e. quantities expressed as a magnitude and units. Units are expressed in the UCUM syntax (Unified Code for Units of Measure (UCUM), by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute) (case-sensitive form) by default, or another system if units_system is set.

Can also be used for time durations, where it is more convenient to treat these as simply a number of seconds rather than days, months, years (in the latter case, DV_DURATION may be used).

Inherit

DV_AMOUNT

Attributes

Signature

Meaning

1..1

magnitude: Real

Numeric magnitude of the quantity.

0..1

precision: Integer

Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places.

1..1

units: String

Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set.

In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.

If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.

Example values from UCUM: "kg/m^2", “mm[Hg]", "ms-1", "km/h".

0..1
(redefined)

normal_range: DV_INTERVAL<DV_QUANTITY>

Optional normal range.

0..1
(redefined)

other_reference_ranges: List<REFERENCE_RANGE<DV_QUANTITY>>

Optional tagged other reference ranges for this value in its particular measurement context.

0..1

units_system: String

Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list).

If not set, the UCUM standard (case-sensitive codes) is assumed as the units system.

0..1

units_display_name: String

Optional field containing the displayable form of the units field, e.g. '°C'.

If not set, the application environment needs to determine the displayable form.

The display name may be language-dependent for various older and non-systematic units. For this reason, it is not recommended to add unit display names to archetypes, only to templates (for localisation purposes).

Functions

Signature

Meaning

1..1
(redefined)

add alias "+" (
other: DV_QUANTITY[1]
): DV_QUANTITY

Sum of this DV_QUANTITY and other.

1..1
(redefined)

subtract alias "-" (
other: DV_QUANTITY[1]
): DV_QUANTITY

Difference of this DV_QUANTITY and other.

1..1
(redefined)

multiply alias "*" (
factor: Real[1]
): DV_QUANTITY

Product of this DV_QUANTITY and factor.

1..1
(redefined)

less_than alias "<" (
other: DV_QUANTITY[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude

True if this Quantity object is less than other, based on comparison of magnitude. Only valid if is_strictly_comparable_to() is True.

1..1

is_integral (): Boolean

True if precision = 0, meaning that the magnitude is a whole number.

1..1
(redefined)

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean

True if this quantity and other have the same units and also units_system if it exists.

DV_QUANTITY

Quantitified type representing scientific quantities, i.e. quantities expressed as a magnitude and units. Units are expressed in the UCUM syntax (Unified Code for Units of Measure (UCUM), by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute) (case-sensitive form) by default, or another system if units_system is set.

Can also be used for time durations, where it is more convenient to treat these as simply a number of seconds rather than days, months, years (in the latter case, DV_DURATION may be used).

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED, DV_AMOUNT

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

normal_range: DV_INTERVAL<DV_QUANTITY> [0..1]

Optional normal range.

other_reference_ranges: List<REFERENCE_RANGE<DV_QUANTITY>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

DV_QUANTIFIED.magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

DV_AMOUNT.accuracy: Real [0..1]

Accuracy of measurement, expressed either as a half-range percent value (accuracy_is_percent = True) or a half-range quantity. A value of 0 means that accuracy is 100%, i.e. no error.

A value of unknown_accuracy_value means that accuracy was not recorded.

DV_AMOUNT.accuracy_is_percent: Boolean [0..1]

If True, indicates that when this object was created, accuracy was recorded as a percent value; if False, as an absolute quantity value.

magnitude: Real [1..1]

Numeric magnitude of the quantity.

precision: Integer [0..1]

Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places.

units: String [1..1]

Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set.

In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.

If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.

Example values from UCUM: "kg/m^2", “mm[Hg]", "ms-1", "km/h".

units_system: String [0..1]

Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list).

If not set, the UCUM standard (case-sensitive codes) is assumed as the units system.

units_display_name: String [0..1]

Optional field containing the displayable form of the units field, e.g. '°C'.

If not set, the application environment needs to determine the displayable form.

The display name may be language-dependent for various older and non-systematic units. For this reason, it is not recommended to add unit display names to archetypes, only to templates (for localisation purposes).

Functions

(abstract) DV_AMOUNT.is_equal (
other: DV_AMOUNT[1]
): Boolean [1..1]

Return True if this DV_AMOUNT is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_QUANTITY[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this Quantity object is less than other, based on comparison of magnitude. Only valid if is_strictly_comparable_to() is True.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

True if this quantity and other have the same units and also units_system if it exists.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

DV_QUANTIFIED.valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

(abstract) DV_QUANTIFIED.magnitude (): Ordered_Numeric [1..1]

DV_QUANTIFIED.accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

DV_AMOUNT.valid_percentage (
number: Ordered_Numeric[1]
): Boolean [1..1]

Test whether a number is a valid percentage, i.e. between 0 and 100.

add alias "+" (
other: DV_QUANTITY[1]
): DV_QUANTITY [1..1]

Sum of this DV_QUANTITY and other.

subtract alias "-" (
other: DV_QUANTITY[1]
): DV_QUANTITY [1..1]

Difference of this DV_QUANTITY and other.

multiply alias "*" (
factor: Real[1]
): DV_QUANTITY [1..1]

Product of this DV_QUANTITY and factor.

DV_AMOUNT.negative alias "-" (): DV_AMOUNT [1..1]

Negated version of current object, such as used for representing a difference, e.g. a weight loss.

is_integral (): Boolean [1..1]

True if precision = 0, meaning that the magnitude is a whole number.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_QUANTIFIED.Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

DV_AMOUNT.Accuracy_is_percent_validity: accuracy = 0 implies not accuracy_is_percent

DV_AMOUNT.Accuracy_validity: accuracy_is_percent implies valid_percentage (accuracy)

{
    "name": "DV_QUANTITY",
    "documentation": "Quantitified type representing  scientific  quantities, i.e. quantities expressed as a magnitude and units. Units are expressed in the UCUM syntax (http://unitsofmeasure.org/ucum.html[Unified Code for Units of Measure (UCUM)], by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute)  (case-sensitive form) by default, or another system if `_units_system_` is set. \n\nCan also be used for time durations, where it is more convenient to treat these as simply a number of seconds rather than days, months, years (in the latter case, `DV_DURATION` may be used).",
    "ancestors": [
        "DV_AMOUNT"
    ],
    "properties": {
        "magnitude": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "magnitude",
            "documentation": "Numeric magnitude of the quantity.",
            "is_mandatory": true,
            "type": "Real"
        },
        "precision": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "precision",
            "documentation": "Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity.\nThe value -1 implies no limit, i.e. any number of decimal places.",
            "type": "Integer"
        },
        "units": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "units",
            "documentation": "Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in `_units_system_`, when set.\n\nIn either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.\n\nIf the `_units_display_name_` field is set, this may be used for display. If not, the implementations must effect the resolution of the `_units_` value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.\n\nExample values from UCUM: \"kg/m^2\", “mm[Hg]\", \"ms-1\", \"km/h\".",
            "is_mandatory": true,
            "type": "String"
        },
        "normal_range": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "normal_range",
            "documentation": "Optional normal range. ",
            "type_def": {
                "root_type": "DV_INTERVAL",
                "generic_parameters": [
                    "DV_QUANTITY"
                ]
            }
        },
        "other_reference_ranges": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "other_reference_ranges",
            "documentation": "Optional tagged other reference ranges for this value in its particular measurement context.",
            "type_def": {
                "container_type": "List",
                "type_def": {
                    "_type": "P_BMM_GENERIC_TYPE",
                    "root_type": "REFERENCE_RANGE",
                    "generic_parameters": [
                        "DV_QUANTITY"
                    ]
                }
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        },
        "units_system": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "units_system",
            "documentation": "Optional field used to specify a units system from which codes in `_units_` are defined. Value is a URI identifying a terminology containing units concepts from the  (https://www.hl7.org/fhir/terminologies-systems.html[HL7 FHIR terminologies list]).\n\nIf not set, the UCUM standard (case-sensitive codes) is assumed as the units system.",
            "type": "String"
        },
        "units_display_name": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "units_display_name",
            "documentation": "Optional field containing the displayable form of the `_units_` field, e.g. `'°C'`.\n\nIf not set, the application environment needs to determine the displayable form.\n\nNOTE: The display name may be language-dependent for various older and non-systematic units. For this reason, it is not recommended to add unit display names to archetypes, only to templates (for localisation purposes).",
            "type": "String"
        }
    },
    "functions": {
        "add": {
            "name": "add",
            "aliases": [
                "+"
            ],
            "documentation": "Sum of this `DV_QUANTITY` and `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_QUANTITY"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_QUANTITY"
            }
        },
        "subtract": {
            "name": "subtract",
            "aliases": [
                "-"
            ],
            "documentation": "Difference of this `DV_QUANTITY` and `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_QUANTITY"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_QUANTITY"
            }
        },
        "multiply": {
            "name": "multiply",
            "aliases": [
                "&#42;"
            ],
            "documentation": "Product of this `DV_QUANTITY` and `_factor_`.",
            "parameters": {
                "factor": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "factor",
                    "type": "Real"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_QUANTITY"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Quantity object is less than `_other_`, based on comparison of `_magnitude_`. Only valid if `_is_strictly_comparable_to()_` is True.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_QUANTITY"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable()"
            },
            "post_conditions": {
                "Post_result": "Result = magnitude < other.magnitude"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_integral": {
            "name": "is_integral",
            "documentation": "True if `_precision_` = 0, meaning that the `_magnitude_` is a whole number.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "True if this quantity and `_other_` have the same `_units_` and also `_units_system_` if it exists.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
DV_QUANTITY

DV_COUNT Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_COUNT

Description

Countable quantities. Used for countable types such as pregnancies and steps (taken by a physiotherapy patient), number of cigarettes smoked in a day.

Misuse: Not to be used for amounts of physical entities (which all have units).

Inherit

DV_AMOUNT

Attributes

Signature

Meaning

1..1

magnitude: Integer64

0..1
(redefined)

normal_range: DV_INTERVAL<DV_COUNT>

Optional normal range.

0..1
(redefined)

other_reference_ranges: List<REFERENCE_RANGE<DV_COUNT>>

Optional tagged other reference ranges for this value in its particular measurement context.

Functions

Signature

Meaning

1..1
(redefined)

add alias "+" (
other: DV_COUNT[1]
): DV_COUNT

Sum of this DV_COUNT and other.

1..1
(redefined)

subtract alias "-" (
other: DV_COUNT[1]
): DV_COUNT

Difference of this DV_COUNT and other.

1..1
(redefined)

multiply alias "*" (
factor: Real[1]
): DV_COUNT

Product of this DV_COUNT and factor.

1..1
(redefined)

less_than alias "<" (
other: DV_COUNT[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude

True if this Quantified object is less than other, based on comparison of magnitude.

1..1
(redefined)

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean

Return True.

DV_COUNT

Countable quantities. Used for countable types such as pregnancies and steps (taken by a physiotherapy patient), number of cigarettes smoked in a day.

Misuse: Not to be used for amounts of physical entities (which all have units).

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED, DV_AMOUNT

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

normal_range: DV_INTERVAL<DV_COUNT> [0..1]

Optional normal range.

other_reference_ranges: List<REFERENCE_RANGE<DV_COUNT>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

DV_QUANTIFIED.magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

DV_AMOUNT.accuracy: Real [0..1]

Accuracy of measurement, expressed either as a half-range percent value (accuracy_is_percent = True) or a half-range quantity. A value of 0 means that accuracy is 100%, i.e. no error.

A value of unknown_accuracy_value means that accuracy was not recorded.

DV_AMOUNT.accuracy_is_percent: Boolean [0..1]

If True, indicates that when this object was created, accuracy was recorded as a percent value; if False, as an absolute quantity value.

magnitude: Integer64 [1..1]

Functions

(abstract) DV_AMOUNT.is_equal (
other: DV_AMOUNT[1]
): Boolean [1..1]

Return True if this DV_AMOUNT is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_COUNT[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this Quantified object is less than other, based on comparison of magnitude.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Return True.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

DV_QUANTIFIED.valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

(abstract) DV_QUANTIFIED.magnitude (): Ordered_Numeric [1..1]

DV_QUANTIFIED.accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

DV_AMOUNT.valid_percentage (
number: Ordered_Numeric[1]
): Boolean [1..1]

Test whether a number is a valid percentage, i.e. between 0 and 100.

add alias "+" (
other: DV_COUNT[1]
): DV_COUNT [1..1]

Sum of this DV_COUNT and other.

subtract alias "-" (
other: DV_COUNT[1]
): DV_COUNT [1..1]

Difference of this DV_COUNT and other.

multiply alias "*" (
factor: Real[1]
): DV_COUNT [1..1]

Product of this DV_COUNT and factor.

DV_AMOUNT.negative alias "-" (): DV_AMOUNT [1..1]

Negated version of current object, such as used for representing a difference, e.g. a weight loss.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_QUANTIFIED.Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

DV_AMOUNT.Accuracy_is_percent_validity: accuracy = 0 implies not accuracy_is_percent

DV_AMOUNT.Accuracy_validity: accuracy_is_percent implies valid_percentage (accuracy)

{
    "name": "DV_COUNT",
    "documentation": "Countable quantities. Used for countable types such as pregnancies and steps (taken by a physiotherapy patient), number of cigarettes smoked in a day. \n\nMisuse: Not to be used for amounts of physical entities (which all have units).",
    "ancestors": [
        "DV_AMOUNT"
    ],
    "properties": {
        "magnitude": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "magnitude",
            "is_mandatory": true,
            "type": "Integer64"
        },
        "normal_range": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "normal_range",
            "documentation": "Optional normal range. ",
            "type_def": {
                "root_type": "DV_INTERVAL",
                "generic_parameters": [
                    "DV_COUNT"
                ]
            }
        },
        "other_reference_ranges": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "other_reference_ranges",
            "documentation": "Optional tagged other reference ranges for this value in its particular measurement context.",
            "type_def": {
                "container_type": "List",
                "type_def": {
                    "_type": "P_BMM_GENERIC_TYPE",
                    "root_type": "REFERENCE_RANGE",
                    "generic_parameters": [
                        "DV_COUNT"
                    ]
                }
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "add": {
            "name": "add",
            "aliases": [
                "+"
            ],
            "documentation": "Sum of this `DV_COUNT` and `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_COUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_COUNT"
            }
        },
        "subtract": {
            "name": "subtract",
            "aliases": [
                "-"
            ],
            "documentation": "Difference of this `DV_COUNT` and `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_COUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_COUNT"
            }
        },
        "multiply": {
            "name": "multiply",
            "aliases": [
                "&#42;"
            ],
            "documentation": "Product of this `DV_COUNT` and `_factor_`.",
            "parameters": {
                "factor": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "factor",
                    "type": "Real"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_COUNT"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Quantified object is less than `_other_`, based on comparison of `_magnitude_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_COUNT"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable()"
            },
            "post_conditions": {
                "Post_result": "Result = magnitude < other.magnitude"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "Return True.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
DV_COUNT

DV_PROPORTION Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_PROPORTION

Description

Models a ratio of values, i.e. where the numerator and denominator are both pure numbers. The valid_proportion_kind property of the PROPORTION_KIND class is used to control the type attribute to be one of a defined set.

Used for recording titers (e.g. 1:128), concentration ratios, e.g. Na:K (unitary denominator), albumin:creatinine ratio, and percentages, e.g. red cell distirbution width (RDW).

Misuse: Should not be used to represent things like blood pressure which are often written using a '/' character, giving the misleading impression that the item is a ratio, when in fact it is a structured value. Similarly, visual acuity, often written as (e.g.) "6/24" in clinical notes is not a ratio but an ordinal (which includes non-numeric symbols like CF = count fingers etc). Should not be used for formulations.

Inherit

PROPORTION_KIND, DV_AMOUNT

Attributes

Signature

Meaning

1..1

numerator: Real

Numerator of ratio

1..1

denominator: Real

Denominator of ratio.

1..1

type: Integer

Indicates semantic type of proportion, including percent, unitary etc.

0..1

precision: Integer

Precision to which the numerator and denominator values of the proportion are expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places.

0..1
(redefined)

normal_range: DV_INTERVAL<DV_PROPORTION>

Optional normal range.

0..1
(redefined)

other_reference_ranges: List<REFERENCE_RANGE<DV_PROPORTION>>

Optional tagged other reference ranges for this value in its particular measurement context.

Functions

Signature

Meaning

1..1
(redefined)

magnitude (): Real

Effective magnitude represented by ratio.

1..1

is_integral (): Boolean

True if the numerator and denominator values are integers, i.e. if precision is 0.

1..1
(redefined)

add alias "+" (
other: DV_PROPORTION[1]
): DV_PROPORTION

Sum of two strictly comparable proportions.

1..1
(redefined)

subtract alias "-" (
other: DV_PROPORTION[1]
): DV_PROPORTION

Difference between two strictly comparable proportions.

1..1
(effected)

is_equal (
other: DV_PROPORTION[1]
): Boolean

Return True if this DV_AMOUNT is considered equal to other.

1..1
(redefined)

multiply alias "*" (
factor: Real[1]
): DV_PROPORTION

Product of this Proportion and factor.

1..1
(redefined)

less_than alias "<" (
other: DV_PROPORTION[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude

True if this Proportion is less than other. Only valid if is_strictly_comparable_to() is True.

1..1
(redefined)

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean

Return True if the type of this proportion is the same as the type of other.

Invariants

Type_validity: valid_proportion_kind (type)

Precision_validity: precision = 0 implies is_integral

Is_integral_validity: is_integral implies (numerator.floor = numerator and denominator.floor = denominator)

Fraction_validity: (type = pk_fraction or type = pk_integer_fraction) implies is_integral

Unitary_validity: type = pk_unitary implies denominator = 1

Percent_validity: type = pk_percent implies denominator = 100

Valid_denominator: denominator /= 0.0

DV_PROPORTION

Models a ratio of values, i.e. where the numerator and denominator are both pure numbers. The valid_proportion_kind property of the PROPORTION_KIND class is used to control the type attribute to be one of a defined set.

Used for recording titers (e.g. 1:128), concentration ratios, e.g. Na:K (unitary denominator), albumin:creatinine ratio, and percentages, e.g. red cell distirbution width (RDW).

Misuse: Should not be used to represent things like blood pressure which are often written using a '/' character, giving the misleading impression that the item is a ratio, when in fact it is a structured value. Similarly, visual acuity, often written as (e.g.) "6/24" in clinical notes is not a ratio but an ordinal (which includes non-numeric symbols like CF = count fingers etc). Should not be used for formulations.

Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric, Integer, BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED, PROPORTION_KIND, DV_AMOUNT

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

normal_range: DV_INTERVAL<DV_PROPORTION> [0..1]

Optional normal range.

other_reference_ranges: List<REFERENCE_RANGE<DV_PROPORTION>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

DV_QUANTIFIED.magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

DV_AMOUNT.accuracy: Real [0..1]

Accuracy of measurement, expressed either as a half-range percent value (accuracy_is_percent = True) or a half-range quantity. A value of 0 means that accuracy is 100%, i.e. no error.

A value of unknown_accuracy_value means that accuracy was not recorded.

DV_AMOUNT.accuracy_is_percent: Boolean [0..1]

If True, indicates that when this object was created, accuracy was recorded as a percent value; if False, as an absolute quantity value.

numerator: Real [1..1]

Numerator of ratio

denominator: Real [1..1]

Denominator of ratio.

type: Integer [1..1]

Indicates semantic type of proportion, including percent, unitary etc.

precision: Integer [0..1]

Precision to which the numerator and denominator values of the proportion are expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places.

Functions

is_equal (
other: DV_PROPORTION[1]
): Boolean [1..1]

Return True if this DV_AMOUNT is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

less_than alias "<" (
other: DV_PROPORTION[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this Proportion is less than other. Only valid if is_strictly_comparable_to() is True.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

add alias "+" (
other: DV_PROPORTION[1]
): DV_PROPORTION [1..1]

Sum of two strictly comparable proportions.

subtract alias "-" (
other: DV_PROPORTION[1]
): DV_PROPORTION [1..1]

Difference between two strictly comparable proportions.

multiply alias "*" (
factor: Real[1]
): DV_PROPORTION [1..1]

Product of this Proportion and factor.

Integer.divide alias "/" (
other: Integer[1]
): Double [1..1]

Integer division.

Integer.exponent alias "^" (
other: Double[1]
): Double [1..1]

Integer exponentiation.

DV_AMOUNT.negative alias "-" (): DV_AMOUNT [1..1]

Negated version of current object, such as used for representing a difference, e.g. a weight loss.

Integer.modulo alias "mod", "\\" (
mod: Integer[1]
): Integer [1..1]

Return self modulo other.

PROPORTION_KIND.valid_proportion_kind (
nq: Integer[1]
): Boolean [1..1]

True if n is one of the defined types.

is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Return True if the type of this proportion is the same as the type of other.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

DV_QUANTIFIED.valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

magnitude (): Real [1..1]

Effective magnitude represented by ratio.

DV_QUANTIFIED.accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

DV_AMOUNT.valid_percentage (
number: Ordered_Numeric[1]
): Boolean [1..1]

Test whether a number is a valid percentage, i.e. between 0 and 100.

is_integral (): Boolean [1..1]

True if the numerator and denominator values are integers, i.e. if precision is 0.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_QUANTIFIED.Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

DV_AMOUNT.Accuracy_is_percent_validity: accuracy = 0 implies not accuracy_is_percent

DV_AMOUNT.Accuracy_validity: accuracy_is_percent implies valid_percentage (accuracy)

Type_validity: valid_proportion_kind (type)

Precision_validity: precision = 0 implies is_integral

Is_integral_validity: is_integral implies (numerator.floor = numerator and denominator.floor = denominator)

Fraction_validity: (type = pk_fraction or type = pk_integer_fraction) implies is_integral

Unitary_validity: type = pk_unitary implies denominator = 1

Percent_validity: type = pk_percent implies denominator = 100

Valid_denominator: denominator /= 0.0

{
    "name": "DV_PROPORTION",
    "documentation": "Models a ratio of values, i.e. where the numerator and denominator are both pure numbers. The `_valid_proportion_kind_` property of the `PROPORTION_KIND` class is used to control the type attribute to be one of a defined set.\n\nUsed for recording titers (e.g. 1:128), concentration ratios, e.g. Na:K (unitary denominator), albumin:creatinine ratio, and percentages, e.g. red cell distirbution width (RDW). \n \nMisuse: Should not be used to represent things like blood pressure which are often written using a  '/' character, giving the misleading impression that the item is a ratio, when in fact it is a structured value. Similarly, visual acuity, often written as (e.g.) \"6/24\" in clinical notes is not a ratio but an ordinal (which includes non-numeric symbols like CF = count fingers etc). Should not be used for formulations. ",
    "ancestors": [
        "PROPORTION_KIND",
        "DV_AMOUNT"
    ],
    "properties": {
        "numerator": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "numerator",
            "documentation": "Numerator of ratio",
            "is_mandatory": true,
            "type": "Real"
        },
        "denominator": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "denominator",
            "documentation": "Denominator of ratio.",
            "is_mandatory": true,
            "type": "Real"
        },
        "type": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "type",
            "documentation": "Indicates semantic type of proportion, including percent, unitary etc.",
            "is_mandatory": true,
            "type": "Integer"
        },
        "precision": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "precision",
            "documentation": "Precision  to  which  the  `_numerator_` and `_denominator_` values of  the  proportion are expressed, in terms of number  of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places. ",
            "type": "Integer"
        },
        "normal_range": {
            "_type": "P_BMM_GENERIC_PROPERTY",
            "name": "normal_range",
            "documentation": "Optional normal range. ",
            "type_def": {
                "root_type": "DV_INTERVAL",
                "generic_parameters": [
                    "DV_PROPORTION"
                ]
            }
        },
        "other_reference_ranges": {
            "_type": "P_BMM_CONTAINER_PROPERTY",
            "name": "other_reference_ranges",
            "documentation": "Optional tagged other reference ranges for this value in its particular measurement context.",
            "type_def": {
                "container_type": "List",
                "type_def": {
                    "_type": "P_BMM_GENERIC_TYPE",
                    "root_type": "REFERENCE_RANGE",
                    "generic_parameters": [
                        "DV_PROPORTION"
                    ]
                }
            },
            "cardinality": {
                "lower": 0,
                "upper_unbounded": true
            }
        }
    },
    "functions": {
        "magnitude": {
            "name": "magnitude",
            "documentation": "Effective magnitude represented by ratio.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Real"
            }
        },
        "is_integral": {
            "name": "is_integral",
            "documentation": "True if the `_numerator_` and `_denominator_` values are integers, i.e. if `_precision_` is 0.",
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "add": {
            "name": "add",
            "aliases": [
                "+"
            ],
            "documentation": "Sum of two strictly comparable proportions.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_PROPORTION"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_PROPORTION"
            }
        },
        "subtract": {
            "name": "subtract",
            "aliases": [
                "-"
            ],
            "documentation": "Difference between two strictly comparable proportions.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_PROPORTION"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_PROPORTION"
            }
        },
        "is_equal": {
            "name": "is_equal",
            "documentation": "Return True if this `DV_AMOUNT` is considered equal to `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_PROPORTION"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "multiply": {
            "name": "multiply",
            "aliases": [
                "&#42;"
            ],
            "documentation": "Product of this Proportion and `_factor_`.",
            "parameters": {
                "factor": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "factor",
                    "type": "Real"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_PROPORTION"
            }
        },
        "less_than": {
            "name": "less_than",
            "aliases": [
                "<"
            ],
            "documentation": "True if this Proportion is less than  `_other_`. Only valid if `_is_strictly_comparable_to()_` is True.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_PROPORTION"
                }
            },
            "pre_conditions": {
                "Pre_comparable": "is_strictly_comparable()"
            },
            "post_conditions": {
                "Post_result": "Result = magnitude < other.magnitude"
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        },
        "is_strictly_comparable_to": {
            "name": "is_strictly_comparable_to",
            "documentation": "Return True if the `_type_` of this proportion is the same as the `_type_` of `_other_`.",
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ORDERED"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    },
    "invariants": {
        "Type_validity": "valid_proportion_kind (type)",
        "Precision_validity": "precision = 0 implies is_integral",
        "Is_integral_validity": "is_integral implies (numerator.floor = numerator and denominator.floor = denominator)",
        "Fraction_validity": "(type = pk_fraction or type = pk_integer_fraction) implies is_integral",
        "Unitary_validity": "type = pk_unitary implies denominator = 1",
        "Percent_validity": "type = pk_percent implies denominator = 100",
        "Valid_denominator": "denominator /= 0.0"
    }
}
DV_PROPORTION

PROPORTION_KIND Enumeration

  • Definition

  • Effective

  • BMM

  • UML

Enumeration

PROPORTION_KIND

Description

Class of enumeration constants defining types of proportion for the DV_PROPORTION class.

Constants

Signature

Meaning

pk_ratio: Integer = 0

Ratio type. Numerator and denominator may be any value.

pk_unitary: Integer = 1

Denominator must be 1.

pk_percent: Integer = 2

Denominator is 100, numerator is understood as a percentage value.

pk_fraction: Integer = 3

Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 .

pk_integer_fraction: Integer = 4

Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 ; if the numerator is greater than the denominator, e.g. n=3, d=2, the presentation is 1 1/2 .

Functions

Signature

Meaning

1..1

valid_proportion_kind (
nq: Integer[1]
): Boolean

True if n is one of the defined types.

PROPORTION_KIND

Class of enumeration constants defining types of proportion for the DV_PROPORTION class.

Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric, Integer

Constants

pk_ratio: Integer = 0

Ratio type. Numerator and denominator may be any value.

pk_unitary: Integer = 1

Denominator must be 1.

pk_percent: Integer = 2

Denominator is 100, numerator is understood as a percentage value.

pk_fraction: Integer = 3

Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 .

pk_integer_fraction: Integer = 4

Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 ; if the numerator is greater than the denominator, e.g. n=3, d=2, the presentation is 1 1/2 .

Functions

Integer.is_equal (
other: Integer[1]
): Boolean [1..1]

Value equality: return True if this and other are attached to objects considered to be equal in value.

Integer.equal alias "=", "==" (
other: Integer[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

Integer.less_than alias "<" (
other: Integer[1]
): Boolean [1..1]

Returns True if current Integer is less than other.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

Integer.add alias "+" (
other: Integer[1]
): Integer [1..1]

Integer addition.

Integer.subtract alias "-" (
other: Integer[1]
): Integer [1..1]

Integer subtraction.

Integer.multiply alias "*" (
other: Integer[1]
): Integer [1..1]

Integer multiplication.

Integer.divide alias "/" (
other: Integer[1]
): Double [1..1]

Integer division.

Integer.exponent alias "^" (
other: Double[1]
): Double [1..1]

Integer exponentiation.

Integer.negative alias "-" (): Integer [1..1]

Generate negative of current Integer value.

Integer.modulo alias "mod", "\\" (
mod: Integer[1]
): Integer [1..1]

Return self modulo other.

valid_proportion_kind (
nq: Integer[1]
): Boolean [1..1]

True if n is one of the defined types.

{
    "_type": "P_BMM_ENUMERATION_INTEGER",
    "name": "PROPORTION_KIND",
    "documentation": "Class of enumeration constants defining types of proportion for the `DV_PROPORTION` class. ",
    "ancestors": [
        "Integer"
    ],
    "item_names": [
        "pk_ratio",
        "pk_unitary",
        "pk_percent",
        "pk_fraction",
        "pk_integer_fraction"
    ],
    "item_values": [
        0,
        1,
        2,
        3,
        4
    ],
    "item_documentations": [
        "Ratio type. Numerator and denominator may be any value.\n",
        "Denominator must be 1.",
        "Denominator is 100, numerator is understood as a percentage value.",
        "Numerator and denominator are integral, and the presentation method uses a slash, e.g.  1/2 . \n",
        "Numerator and denominator are integral, and the presentation method uses a slash, e.g.  1/2 ; if the numerator is greater than the denominator, e.g. n=3, d=2, the presentation is  1 1/2 ."
    ],
    "functions": {
        "valid_proportion_kind": {
            "name": "valid_proportion_kind",
            "documentation": "True if n is one of the defined types. ",
            "parameters": {
                "nq": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "nq",
                    "type": "Integer"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "Boolean"
            }
        }
    }
}
PROPORTION_KIND

DV_ABSOLUTE_QUANTITY Class

  • Definition

  • Effective

  • BMM

  • UML

Class

DV_ABSOLUTE_QUANTITY (abstract)

Description

Abstract class defining the concept of quantified entities whose values are absolute with respect to an origin. Dates and Times are the main example.

Inherit

DV_QUANTIFIED

Attributes

Signature

Meaning

0..1
(redefined)

accuracy: DV_AMOUNT

Functions

Signature

Meaning

1..1
(abstract)

add alias "+" (
a_diff: DV_AMOUNT[1]
): DV_ABSOLUTE_QUANTITY

Addition of a differential amount to this quantity.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

1..1
(abstract)

subtract alias "-" (
a_diff: DV_AMOUNT[1]
): DV_ABSOLUTE_QUANTITY

Result of subtracting a differential amount from this quantity.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

1..1
(abstract)

diff alias "-" (
other: DV_ABSOLUTE_QUANTITY[1]
): DV_AMOUNT

Difference of two quantities.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

DV_ABSOLUTE_QUANTITY (abstract)

Abstract class defining the concept of quantified entities whose values are absolute with respect to an origin. Dates and Times are the main example.

Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED

Constants

BASIC_DEFINITIONS.CR: Character = '\015' [1..1]

Carriage return character.

BASIC_DEFINITIONS.LF: Character = '\012' [1..1]

Line feed character.

BASIC_DEFINITIONS.Any_type_name: String = "Any" [1..1]

BASIC_DEFINITIONS.Regex_any_pattern: String = ".*" [1..1]

BASIC_DEFINITIONS.Default_encoding: String = "UTF-8" [1..1]

BASIC_DEFINITIONS.None_type_name: String = "None" [1..1]

OPENEHR_DEFINITIONS.Local_terminology_id: String = "local" [1..1]

Predefined terminology identifier to indicate it is local to the knowledge resource in which it occurs, e.g. an archetype

Attributes

DV_ORDERED.normal_status: CODE_PHRASE [0..1]

Optional normal status indicator of value with respect to normal range for this value. Often included by lab, even if the normal range itself is not included. Coded by ordinals in series HHH, HH, H, (nothing), L, LL, LLL; see openEHR terminology group normal_status.

DV_ORDERED.normal_range: DV_INTERVAL [0..1]

Optional normal range.

DV_ORDERED.other_reference_ranges: List<REFERENCE_RANGE<DV_ORDERED>> [0..1]

Optional tagged other reference ranges for this value in its particular measurement context.

DV_QUANTIFIED.magnitude_status: String [0..1]

Optional status of magnitude with values:

  • "=" : magnitude is a point value

  • "<" : value is < magnitude

  • ">" : value is > magnitude

  • "<=" : value is <= magnitude

  • ">=" : value is >= magnitude

  • "~" : value is approximately magnitude

If not present, assumed meaning is "=" .

accuracy: DV_AMOUNT [0..1]

Functions

(abstract) DV_QUANTIFIED.is_equal (
other: DV_QUANTIFIED[1]
): Boolean [1..1]

Return True if this DV_QUANTIFIED is considered equal to other.

Any.equal alias "=", "==" (
other: Any[1]
): Boolean [1..1]

Reference equality for reference types, value equality for value types.

Parameters
other

Other object for comparison.

Any.instance_of (
a_type: String[1]
): Any [1..1]

Create new instance of a type.

Any.type_of (
an_object: Any[1]
): String [1..1]

Type name of an object as a string. May include generic parameters, as in "Interval<Time>".

Any.not_equal alias "!=", "≠" (
other: Ordered[1]
): Boolean [1..1]

True if current object not equal to other. Returns not equal().

DV_QUANTIFIED.less_than alias "<" (
other: DV_QUANTIFIED[1]
): Boolean

Pre_comparable: is_strictly_comparable()

Post_result: Result = magnitude < other.magnitude [1..1]

True if this Quantified object is less than other, based on comparison of magnitude.

Ordered.less_than_or_equal alias "⇐", "≤" (
other: Ordered[1]
): Boolean

Post_result: not (other < self) [1..1]

True if current object less than or equal to other.

Ordered.greater_than alias ">" (
other: Ordered[1]
): Boolean

Post_result: Result = (other < self) [1..1]

True if current object greater than other.

Ordered.greater_than_or_equal alias ">=", "≥" (
other: Ordered[1]
): Boolean

Post_result: Result = (other <= self) [1..1]

True if current object greater than or equal to other.

(abstract) DV_ORDERED.is_strictly_comparable_to (
other: DV_ORDERED[1]
): Boolean [1..1]

Test if two instances are strictly comparable. Effected in descendants.

DV_ORDERED.is_simple (): Boolean [1..1]

True if this quantity has no reference ranges.

DV_ORDERED.is_normal (): Boolean

Pre: normal_range /= Void or normal_status /= Void

Post_range: normal_range /= Void implies Result = normal_range.has (self)
Post_status: normal_status /= Void implies normal_status.code_string.is_equal (“N”) [1..1]

Value is in the normal range, determined by comparison of the value to normal_range if present, or by the normal_status marker if present.

DV_QUANTIFIED.valid_magnitude_status (): Boolean

Post: Result = s in \{"=", "<", ">", "<=", ">=", "~"} [1..1]

Test whether a string value is one of the valid values for the magnitude_status attribute.

(abstract) DV_QUANTIFIED.magnitude (): Ordered_Numeric [1..1]

DV_QUANTIFIED.accuracy_unknown (): Boolean [1..1]

True if accuracy is not known, e.g. due to not being recorded or discernable.

(abstract) add alias "+" (
a_diff: DV_AMOUNT[1]
): DV_ABSOLUTE_QUANTITY [1..1]

Addition of a differential amount to this quantity.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

(abstract) subtract alias "-" (
a_diff: DV_AMOUNT[1]
): DV_ABSOLUTE_QUANTITY [1..1]

Result of subtracting a differential amount from this quantity.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

(abstract) diff alias "-" (
other: DV_ABSOLUTE_QUANTITY[1]
): DV_AMOUNT [1..1]

Difference of two quantities.

The value of accuracy in the result is either:

  • the sum of the accuracies of the operands, if both present, or;

  • unknown, if either or both operand accuracies are unknown.

Invariants

DV_ORDERED.Other_reference_ranges_validity: other_reference_ranges /= Void implies not other_reference_ranges.is_empty

DV_ORDERED.Is_simple_validity: (normal_range = Void and other_reference_ranges = Void) implies is_simple

DV_ORDERED.Normal_status_validity: normal_status /= Void implies code_set (Code_set_id_normal_statuses).has_code (normal_status)

DV_ORDERED.Normal_range_and_status_consistency: (normal_range /= Void and normal_status /= Void) implies (normal_status.code_string.is_equal (“N”) xor not normal_range.has (self))

DV_QUANTIFIED.Magnitude_status_valid: magnitude_status /= Void implies valid_magnitude_status (magnitude_status)

{
    "name": "DV_ABSOLUTE_QUANTITY",
    "documentation": "Abstract class defining the concept of quantified entities whose values are absolute with respect to an origin. Dates and Times are the main example.",
    "is_abstract": true,
    "ancestors": [
        "DV_QUANTIFIED"
    ],
    "properties": {
        "accuracy": {
            "_type": "P_BMM_SINGLE_PROPERTY",
            "name": "accuracy",
            "type": "DV_AMOUNT"
        }
    },
    "functions": {
        "add": {
            "name": "add",
            "aliases": [
                "+"
            ],
            "documentation": "Addition of a differential amount to this quantity. \n\nThe value of accuracy in the result is either:\n\n* the sum of the accuracies of the operands, if both present, or;\n* unknown, if either or both operand accuracies are unknown.",
            "is_abstract": true,
            "parameters": {
                "a_diff": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "a_diff",
                    "type": "DV_AMOUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_ABSOLUTE_QUANTITY"
            }
        },
        "subtract": {
            "name": "subtract",
            "aliases": [
                "-"
            ],
            "documentation": "Result of subtracting a differential amount from this quantity.\n\nThe value of `_accuracy_` in the result is either:\n\n* the sum of the accuracies of the operands, if both present, or;\n* unknown, if either or both operand accuracies are unknown.",
            "is_abstract": true,
            "parameters": {
                "a_diff": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "a_diff",
                    "type": "DV_AMOUNT"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_ABSOLUTE_QUANTITY"
            }
        },
        "diff": {
            "name": "diff",
            "aliases": [
                "-"
            ],
            "documentation": "Difference of two quantities.\n\nThe value of accuracy in the result is either:\n\n* the sum of the accuracies of the operands, if both present, or;\n* unknown, if either or both operand accuracies are unknown.",
            "is_abstract": true,
            "parameters": {
                "other": {
                    "_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
                    "name": "other",
                    "type": "DV_ABSOLUTE_QUANTITY"
                }
            },
            "result": {
                "_type": "P_BMM_SIMPLE_TYPE",
                "type": "DV_AMOUNT"
            }
        }
    }
}
DV_ABSOLUTE_QUANTITY

Syntaxes

Units Syntax

The BNF syntax specification of the units string, adapted from UCUM (case-sensitive form) is as follows:

units = '/' exp_units | units '.' exp_units | units '/' exp_units | exp_units ;
exp_units = unit_group exponent | unit_group ;
unit_group = PREFIX annot_unit | annot_unit | '(' exp_units ')' | factor ;
annot_unit = unit_name [ '{' ANNOTATION '}' ] | '{' ANNOTATION '}' ;
factor = Integer ;
exponent = [ SIGN ] Integer ;

PREFIX = 'Y' |'Z' | 'E' | 'P' | 'T' | 'G' | 'M' | 'k' | 'h' | 'da' | 'd' | 'c' | 'm' | 'μ' | 'n' | 'p' | 'f' | 'a' | 'z' | 'y' ;
UNIT_NAME = ? [a-zA-Z_%]+ ?;   (* replace regex with values from unit tables *)
ANNOTATION = ? [a-zA-Z'.]+ ?;  (* replace regex with values from unit tables *)
SUFFIX = ? [a-zA-Z0-9'_]+ ?;   (* replace regex with values from unit tables *)
SIGN = '+' | '-' ;
Integer = ? [0-9]+ ?;          (* regex *)

This proposal is comprehensive, covering all useful unit systems, including SI, various imperial, customary mesaures, and some obscure measures, as well as clinically specific additions. Metric prefixes, meaning-changing textual suffixes (e.g. "[Hg]" in "mm[Hg]") and non-meaning-changing annotations (e.g. "kg {total}") are recognised. With this syntax, units can be simply expressed in strings such as:

"kg/m^2", "m.s^-1", "km/h", "mm[Hg]"

and so on.