Quantity Package
Overview
The data_types.quantity package is illustrated below. Dates and Times are found in the
next section.
Requirements
Ordinal Values
Medicine is one domain in which symbols representing relative magnitudes are commonly used, without exact values being known. The main purpose is usually to classify patients into groups for which different decisions might be made. Thus, while approximate ranges (technically speaking - "fuzzy intervals") might be stated (such as for a urinalysis), concrete values are not of interest, only categories are. Take for example the characterisation of pain as being "mild", "medium", "severe", or the reflex response to tendon percussion as "-", "+/-", "+", "++", "+++", "++++". There may be no way to scientifically precisely quantify such values because they reflect a subjective experience of the patient or informal judgement by clinician. However, they are understood as being ordered, e.g. "++" is '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 ordinal values is that in many cases there is a need to associate integer 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). Integer values may be negative, 0 and positive, typically to allow the 0 value to correspond to a neutral value in a range.
| 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
An 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 and true quantities, represented by the classes DV_ORDINAL and DV_QUANTIFIED
respectively. DV_ORDINAL represents data values whose exact numeric values are not known, and
which use symbolic renderings instead, such as "+", "++", "+++", or "mild", "medium", "severe".
Each symbol can be assigned any integer value, providing a basis for computable comparison. In contrast,
instances of DV_QUANTIFIED and all its subtypes have precise numeric magnitudes.
DV_QUANTIFIED itself introduces the concepts of 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 nonquantified
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, 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 the Unified Code for Units of Measure (UCUM). A valid units string always implies a
measured property, such as "force" or "pressure". The property of a Quantity can conveniently constrained in archetypes, e.g. to "pressure", which would allow any pressure unit. Unit strings can be
compared to determine if they measure the same property (e.g. "bar" and "kPa" are both units corresponding
to the property "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_AMOUNTdescendants are added or subtracted, and only one hasaccuracy_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 Data value types which are to be used as limits in the |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
normal_status: |
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 |
0..1 |
normal_range: |
Optional normal range. |
0..1 |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
Functions |
Signature |
Meaning |
1..1 |
is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
1..1 |
is_simple (): |
True if this quantity has no reference ranges. |
1..1 |
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
1..1 |
||
Invariants |
Other_reference_ranges_validity: |
|
Is_simple_validity: |
||
Normal_status_validity: |
||
Normal_range_and_status_consistency: |
||
| DV_ORDERED (abstract) | |||
|---|---|---|---|
Abstract class defining the concept of ordered values, which includes ordinals as well as true quantities. It defines the functions Data value types which are to be used as limits in the |
|||
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered |
|||
Constants |
|||
CR: |
Carriage return character. |
||
LF: |
Line feed character. |
||
Attributes |
|||
normal_status: |
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_range: |
Optional normal range. |
||
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
||
is_simple (): |
True if this quantity has no reference ranges. |
||
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
||
Invariants |
|||
Other_reference_ranges_validity: |
|||
Is_simple_validity: |
|||
Normal_status_validity: |
|||
Normal_range_and_status_consistency: |
|||
{
"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.",
"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 the 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"
}
},
"infix <": {
"name": "infix <",
"is_abstract": true,
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "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_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, Without the The basic semantics are derived from the class |
|
Inherit |
||
Invariants |
Limits_consistent: |
|
| 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, Without the The basic semantics are derived from the class |
|||
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Interval |
|||
Constants |
|||
CR: |
Carriage return character. |
||
LF: |
Line feed character. |
||
Attributes |
|||
lower: |
Lower bound. |
||
upper: |
Upper bound. |
||
lower_unbounded: |
|
||
upper_unbounded: |
|
||
lower_included: |
|
||
upper_included: |
|
||
Functions |
|||
True if current object’s interval is semantically same as |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
has ( |
True if |
||
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. |
|||
True if current interval properly contains |
|||
Invariants |
|||
Lower_included_valid: |
|||
Upper_included_valid: |
|||
Limits_consistent: |
|||
Limits_comparable: |
|||
{
"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)"
}
}
REFERENCE_RANGE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
REFERENCE_RANGE<T> |
|
|---|---|---|
Description |
Defines a named range to be associated with any |
|
Attributes |
Signature |
Meaning |
1..1 |
meaning: |
Term whose value indicates the meaning of this range, e.g. normal, critical, therapeutic etc. |
1..1 |
range: |
The data range for this meaning, e.g. critical etc. |
Functions |
Signature |
Meaning |
1..1 |
is_in_range ( |
Indicates if the value val' is inside the range. |
Invariants |
Range_is_simple: |
|
| REFERENCE_RANGE<T> | |
|---|---|
Defines a named range to be associated with any |
|
Attributes |
|
meaning: |
Term whose value indicates the meaning of this range, e.g. normal, critical, therapeutic etc. |
range: |
The data range for this meaning, e.g. critical etc. |
Functions |
|
is_in_range ( |
Indicates if the value val' is inside the range. |
Invariants |
|
Range_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 val' 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)"
}
}
DV_ORDINAL Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
DV_ORDINAL |
|
|---|---|---|
Description |
Models rankings and scores, 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. 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:
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. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
symbol: |
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 . Codes come from archetype. |
1..1 |
value: |
Value in ordered enumeration of values. Any integer value can be used. |
Functions |
Signature |
Meaning |
1..1 |
limits (): |
Limits of the ordinal enumeration, to allow comparison of an ordinal value to its limits. |
1..1 |
is_strictly_comparable_to ( |
|
1..1 |
< ( |
|
| DV_ORDINAL | |||
|---|---|---|---|
Models rankings and scores, 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. 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:
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. |
|||
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED |
|||
Constants |
|||
CR: |
Carriage return character. |
||
LF: |
Line feed character. |
||
Attributes |
|||
normal_status: |
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_range: |
Optional normal range. |
||
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
||
symbol: |
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 . Codes come from archetype. |
||
value: |
Value in ordered enumeration of values. Any integer value can be used. |
||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
+ Inherited from DV_ORDERED |
|||
is_strictly_comparable_to ( |
|||
is_simple (): |
True if this quantity has no reference ranges. |
||
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
||
limits (): |
Limits of the ordinal enumeration, to allow comparison of an ordinal value to its limits. |
||
< ( |
|||
Invariants |
|||
Other_reference_ranges_validity: |
|||
Is_simple_validity: |
|||
Normal_status_validity: |
|||
Normal_range_and_status_consistency: |
|||
{
"name": "DV_ORDINAL",
"documentation": "Models rankings and scores, 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. \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}`. ",
"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 . Codes come from archetype. ",
"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": {
"limits": {
"name": "limits",
"documentation": "\nLimits of the ordinal enumeration, to allow comparison of an ordinal \nvalue to its limits. \n",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "DV_ORDINAL"
}
},
"is_strictly_comparable_to": {
"name": "is_strictly_comparable_to",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "DV_ORDERED"
}
},
"post_conditions": {
"Post": "symbol.is_comparable (other.symbol) implies Result"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"<": {
"name": "<",
"parameters": {
"other": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "other",
"type": "Ordered"
}
},
"post_conditions": {
"Post": "Result = value < other.value"
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
}
}
}
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 |
||
Attributes |
Signature |
Meaning |
0..1 |
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
0..1 |
accuracy: |
Accuracy of measurement. Exact form of expression determined in descendants. |
Functions |
Signature |
Meaning |
1..1 |
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
1..1 |
magnitude (): |
|
1..1 |
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
Invariants |
Magnitude_status_valid: |
|
| 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 |
|||
CR: |
Carriage return character. |
||
LF: |
Line feed character. |
||
Attributes |
|||
normal_status: |
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_range: |
Optional normal range. |
||
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
||
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
||
accuracy: |
Accuracy of measurement. Exact form of expression determined in descendants. |
||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
+ Inherited from DV_ORDERED |
|||
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
||
is_simple (): |
True if this quantity has no reference ranges. |
||
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
||
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
||
(abstract) magnitude (): |
|||
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
||
Invariants |
|||
Other_reference_ranges_validity: |
|||
Is_simple_validity: |
|||
Normal_status_validity: |
|||
Normal_range_and_status_consistency: |
|||
Magnitude_status_valid: |
|||
{
"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.is_equal (“=”) or s.is_equal (“<”) or s.is_equal (“>”) or s.is_equal (“<=”) or s.is_equal (“>=”) or s.is_equal (“~”)"
},
"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"
}
}
},
"invariants": {
"Magnitude_status_valid": "magnitude_status /= Void implies valid_magnitude_status (magnitude_status)"
}
}
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 |
|
Inherit |
||
Attributes |
Signature |
Meaning |
0..1 |
accuracy_is_percent: |
If |
0..1 |
accuracy: |
Accuracy of measurement, expressed either as a half-range percent value ( A value of |
Functions |
Signature |
Meaning |
1..1 |
valid_percentage ( |
Test whether a number is a valid percentage, i.e. between 0 and 100. |
1..1 |
||
1..1 |
Sum of this quantity and another whose formal type must be the difference type of this quantity. The value of accuracy in the result is either:
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 |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. The value of accuracy in the result is either:
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 |
prefix - (): |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. |
Invariants |
Accuracy_is_percent_validity: |
|
Accuracy_validity: |
||
| DV_AMOUNT (abstract) | |
|---|---|
Abstract class defining the concept of relative quantified 'amounts'. For relative quantities, the |
|
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED |
|
Constants |
|
CR: |
Carriage return character. |
LF: |
Line feed character. |
Attributes |
|
normal_status: |
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_range: |
Optional normal range. |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
accuracy: |
Accuracy of measurement, expressed either as a half-range percent value ( A value of |
accuracy_is_percent: |
If |
Functions |
|
Value equality. |
|
Create new instance of a type. |
|
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|
+ Inherited from DV_ORDERED |
|
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
is_simple (): |
True if this quantity has no reference ranges. |
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
(abstract) magnitude (): |
+ Inherited from DV_QUANTIFIED |
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
valid_percentage ( |
Test whether a number is a valid percentage, i.e. between 0 and 100. |
Sum of this quantity and another whose formal type must be the difference type of this quantity. The value of accuracy in the result is either:
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. |
|
Negated version of current object, such as used for representing a difference, e.g. a weight loss. The value of accuracy in the result is either:
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. |
|
prefix - (): |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. |
Invariants |
|
Other_reference_ranges_validity: |
|
Is_simple_validity: |
|
Normal_status_validity: |
|
Normal_range_and_status_consistency: |
|
Magnitude_status_valid: |
|
Accuracy_is_percent_validity: |
|
Accuracy_validity: |
|
{
"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"
}
},
"infix =": {
"name": "infix =",
"parameters": {
"source": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "source",
"type": "DV_AMOUNT"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "DV_AMOUNT"
}
},
"infix +": {
"name": "infix +",
"documentation": "Sum of this quantity and another whose formal type must be the difference type of this quantity. 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"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "DV_AMOUNT"
}
},
"infix -": {
"name": "infix -",
"documentation": "Negated version of current object, such as used for representing a difference, e.g. a weight loss.\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.\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"
}
},
"prefix -": {
"name": "prefix -",
"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"
}
}
},
"invariants": {
"Accuracy_is_percent_validity": "accuracy = 0 implies not accuracy_is_percent",
"Accuracy_validity": "accuracy_is_percent implies valid_percentage (accuracy)"
}
}
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 were inspired by the Unified Code for Units of Measure (UCUM), developed by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute. 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. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
magnitude: |
Numeric magnitude of the quantity. |
0..1 |
precision: |
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: |
Stringified units, expressed in UCUM unit syntax, e.g. "kg/m2", “mm[Hg]", "ms-1", "km/h". Implemented accordingly in subtypes. |
0..1 |
normal_range: |
Optional normal range. |
0..1 |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
Functions |
Signature |
Meaning |
1..1 |
is_integral (): |
True if precision = 0, meaning that the magnitude is a whole number. |
| DV_QUANTITY | |
|---|---|
Quantitified type representing scientific quantities, i.e. quantities expressed as a magnitude and units. Units were inspired by the Unified Code for Units of Measure (UCUM), developed by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute. 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. |
|
Inherits: BASIC_DEFINITIONS, OPENEHR_DEFINITIONS, Any, DATA_VALUE, Ordered, DV_ORDERED, DV_QUANTIFIED, DV_AMOUNT |
|
Constants |
|
CR: |
Carriage return character. |
LF: |
Line feed character. |
Attributes |
|
normal_status: |
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_range: |
Optional normal range. |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
accuracy: |
Accuracy of measurement, expressed either as a half-range percent value ( A value of |
accuracy_is_percent: |
If |
magnitude: |
Numeric magnitude of the quantity. |
precision: |
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: |
Stringified units, expressed in UCUM unit syntax, e.g. "kg/m2", “mm[Hg]", "ms-1", "km/h". Implemented accordingly in subtypes. |
Functions |
|
Value equality. |
|
+ Inherited from DV_AMOUNT |
|
Create new instance of a type. |
|
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|
+ Inherited from DV_ORDERED |
|
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
is_simple (): |
True if this quantity has no reference ranges. |
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
(abstract) magnitude (): |
+ Inherited from DV_QUANTIFIED |
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
valid_percentage ( |
Test whether a number is a valid percentage, i.e. between 0 and 100. |
Sum of this quantity and another whose formal type must be the difference type of this quantity. The value of accuracy in the result is either:
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. |
|
Negated version of current object, such as used for representing a difference, e.g. a weight loss. The value of accuracy in the result is either:
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. |
|
prefix - (): |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. |
is_integral (): |
True if precision = 0, meaning that the magnitude is a whole number. |
Invariants |
|
Other_reference_ranges_validity: |
|
Is_simple_validity: |
|
Normal_status_validity: |
|
Normal_range_and_status_consistency: |
|
Magnitude_status_valid: |
|
Accuracy_is_percent_validity: |
|
Accuracy_validity: |
|
{
"name": "DV_QUANTITY",
"documentation": "Quantitified type representing scientific quantities, i.e. quantities expressed as a magnitude and units. Units were inspired by the http://unitsofmeasure.org/ucum.html[Unified Code for Units of Measure (UCUM)], developed by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute. \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. ",
"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": "Stringified units, expressed in UCUM unit syntax, e.g. \"kg/m2\", “mm[Hg]\", \"ms-1\", \"km/h\". Implemented accordingly in subtypes.",
"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
}
}
},
"functions": {
"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"
}
}
}
}
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 |
||
Attributes |
Signature |
Meaning |
1..1 |
magnitude: |
|
0..1 |
normal_range: |
Optional normal range. |
0..1 |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
| 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 |
|
CR: |
Carriage return character. |
LF: |
Line feed character. |
Attributes |
|
normal_status: |
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_range: |
Optional normal range. |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
accuracy: |
Accuracy of measurement, expressed either as a half-range percent value ( A value of |
accuracy_is_percent: |
If |
magnitude: |
|
Functions |
|
Value equality. |
|
+ Inherited from DV_AMOUNT |
|
Create new instance of a type. |
|
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|
+ Inherited from DV_ORDERED |
|
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
is_simple (): |
True if this quantity has no reference ranges. |
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
(abstract) magnitude (): |
+ Inherited from DV_QUANTIFIED |
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
valid_percentage ( |
Test whether a number is a valid percentage, i.e. between 0 and 100. |
Sum of this quantity and another whose formal type must be the difference type of this quantity. The value of accuracy in the result is either:
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. |
|
Negated version of current object, such as used for representing a difference, e.g. a weight loss. The value of accuracy in the result is either:
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. |
|
prefix - (): |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. |
Invariants |
|
Other_reference_ranges_validity: |
|
Is_simple_validity: |
|
Normal_status_validity: |
|
Normal_range_and_status_consistency: |
|
Magnitude_status_valid: |
|
Accuracy_is_percent_validity: |
|
Accuracy_validity: |
|
{
"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
}
}
}
}
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 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 |
||
Attributes |
Signature |
Meaning |
1..1 |
numerator: |
Numerator of ratio |
1..1 |
denominator: |
Denominator of ratio. |
1..1 |
type: |
Indicates semantic type of proportion, including percent, unitary etc. |
0..1 |
precision: |
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 |
normal_range: |
Optional normal range. |
0..1 |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
Functions |
Signature |
Meaning |
1..1 |
magnitude (): |
Effective magnitude represented by ratio. |
1..1 |
is_integral (): |
True if the numerator and denominator values are integers, i.e. if the precision is 0. |
1..1 |
infix = ( |
Assignment operator |
Invariants |
Type_validity: |
|
Precision_validity: |
||
Is_integral_validity: |
||
Fraction_validity: |
||
Unitary_validity: |
||
Percent_validity: |
||
Valid_denominator: |
||
| DV_PROPORTION | |
|---|---|
Models a ratio of values, i.e. where the numerator and denominator are both pure numbers. The 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: PROPORTION_KIND, DV_AMOUNT |
|
Constants |
|
CR: |
Carriage return character. |
LF: |
Line feed character. |
Attributes |
|
normal_status: |
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_range: |
Optional normal range. |
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
accuracy: |
Accuracy of measurement, expressed either as a half-range percent value ( A value of |
accuracy_is_percent: |
If |
numerator: |
Numerator of ratio |
denominator: |
Denominator of ratio. |
type: |
Indicates semantic type of proportion, including percent, unitary etc. |
precision: |
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 |
|
Value equality. |
|
infix = ( |
Assignment operator |
Create new instance of a type. |
|
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|
+ Inherited from DV_ORDERED |
|
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|
Sum of this quantity and another whose formal type must be the difference type of this quantity. The value of accuracy in the result is either:
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. |
|
Negated version of current object, such as used for representing a difference, e.g. a weight loss. The value of accuracy in the result is either:
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. |
|
True if n is one of the defined types. |
|
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
is_simple (): |
True if this quantity has no reference ranges. |
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
magnitude (): |
Effective magnitude represented by ratio. |
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
valid_percentage ( |
Test whether a number is a valid percentage, i.e. between 0 and 100. |
prefix - (): |
Negated version of current object, such as used for representing a difference, e.g. a weight loss. |
is_integral (): |
True if the numerator and denominator values are integers, i.e. if the precision is 0. |
Invariants |
|
Other_reference_ranges_validity: |
|
Is_simple_validity: |
|
Normal_status_validity: |
|
Normal_range_and_status_consistency: |
|
Magnitude_status_valid: |
|
Accuracy_is_percent_validity: |
|
Accuracy_validity: |
|
Type_validity: |
|
Precision_validity: |
|
Is_integral_validity: |
|
Fraction_validity: |
|
Unitary_validity: |
|
Percent_validity: |
|
Valid_denominator: |
|
{
"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 the precision is 0.",
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "Boolean"
}
},
"infix =": {
"name": "infix =",
"documentation": "Assignment operator",
"parameters": {
"source": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "source",
"type": "DV_PROPORTION"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "DV_PROPORTION"
}
}
},
"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"
}
}
PROPORTION_KIND Enumeration
-
Definition
-
Effective
-
BMM
-
UML
Enumeration |
PROPORTION_KIND |
|
|---|---|---|
Description |
Class of enumeration constants defining types of proportion for the |
|
Constants |
Signature |
Meaning |
pk_ratio: |
Ratio type. Numerator and denominator may be any value. |
|
pk_unitary: |
Denominator must be 1. |
|
pk_percent: |
Denominator is 100, numerator is understood as a percentage value. |
|
pk_fraction: |
Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 . |
|
pk_integer_fraction: |
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 |
True if n is one of the defined types. |
|
| PROPORTION_KIND | |
|---|---|
Class of enumeration constants defining types of proportion for the |
|
Inherits: Any, Any, Ordered, Numeric, Ordered_Numeric, Integer |
|
Constants |
|
pk_ratio: |
Ratio type. Numerator and denominator may be any value. |
pk_unitary: |
Denominator must be 1. |
pk_percent: |
Denominator is 100, numerator is understood as a percentage value. |
pk_fraction: |
Numerator and denominator are integral, and the presentation method uses a slash, e.g. 1/2 . |
pk_integer_fraction: |
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 |
|
Value equality. |
|
Reference equality. |
|
Create new instance of a type. |
|
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|
Arithmetic comparison. In conjunction with ‘=’, enables the definition of the operators ‘>’, ‘>=’, ‘<=’, ‘<>’. In real type systems, this operator might be defined on another class for comparability. |
|
Product by `other'. Actual type of result depends on arithmetic balancing rules. |
|
Sum with `other' (commutative). Actual type of result depends on arithmetic balancing rules. |
|
Result of subtracting `other'. Actual type of result depends on arithmetic balancing rules. |
|
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"
}
}
}
}
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 |
||
Attributes |
Signature |
Meaning |
0..1 |
accuracy: |
|
Functions |
Signature |
Meaning |
1..1 |
diff ( |
Difference of two quantities. The value of accuracy in the result is either:
|
1..1 |
add ( |
Addition of a differential amount to this quantity. The value of accuracy in the result is either:
|
1..1 |
subtract ( |
Result of subtracting a differential amount from this quantity. The value of accuracy in the result is either:
|
| 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 |
|||
CR: |
Carriage return character. |
||
LF: |
Line feed character. |
||
Attributes |
|||
normal_status: |
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_range: |
Optional normal range. |
||
other_reference_ranges: |
Optional tagged other reference ranges for this value in its particular measurement context. |
||
magnitude_status: |
Optional status of magnitude with values:
If not present, assumed meaning is |
||
accuracy: |
|||
Functions |
|||
Value equality. |
|||
Reference equality. Parameters
|
|||
Create new instance of a type. |
|||
Type name of an object as a string. May include generic parameters, as in "Interval<Time>". |
|||
+ Inherited from DV_ORDERED |
|||
(abstract) is_strictly_comparable_to ( |
Test if two instances are strictly comparable. |
||
is_simple (): |
True if this quantity has no reference ranges. |
||
is_normal (): |
Value is in the normal range, determined by comparison of the value to the normal_range if present, or by the normal_status marker if present. |
||
valid_magnitude_status (): |
Test whether a string value is one of the valid values for the magnitude_status attribute. |
||
(abstract) magnitude (): |
+ Inherited from DV_QUANTIFIED |
||
accuracy_unknown (): |
True if accuracy is not known, e.g. due to not being recorded or discernable. |
||
(abstract) diff ( |
Difference of two quantities. The value of accuracy in the result is either:
|
||
(abstract) add ( |
Addition of a differential amount to this quantity. The value of accuracy in the result is either:
|
||
(abstract) subtract ( |
Result of subtracting a differential amount from this quantity. The value of accuracy in the result is either:
|
||
Invariants |
|||
Other_reference_ranges_validity: |
|||
Is_simple_validity: |
|||
Normal_status_validity: |
|||
Normal_range_and_status_consistency: |
|||
Magnitude_status_valid: |
|||
{
"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": {
"diff": {
"name": "diff",
"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"
}
},
"add": {
"name": "add",
"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",
"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_diif": {
"_type": "P_BMM_SINGLE_FUNCTION_PARAMETER",
"name": "a_diif",
"type": "DV_AMOUNT"
}
},
"result": {
"_type": "P_BMM_SIMPLE_TYPE",
"type": "DV_ABSOLUTE_QUANTITY"
}
}
}
}
Syntaxes
Units Syntax
The BNF syntax specification of the units string, adapted from UCUM 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.