Certain conformance-statement patterns have emerged and can be documented in a “pseudo” language. The pseudo language provides the mechanisms to construct conformance statements in a manner that provides the readability of a natural language while being machine computable. The outcome is a set of conformance-statement patterns and building blocks that provides a mechanism for specifiers to create and use a set of conformance statements. Using the conformance statements language provides consistency within and across HL7 v2 implementation guides. The pseudo language is not comprehensive (nor formal) and is intended for use in HL7 v2 for convenience. Constraints that cannot be represented within the pseudo language are written in “free-text”. Free-text conformance statements are not conducive to automated machine computability. Computability greatly enhances processing of the constraints used, for example, in validation tools. The HL7 v2 Pseudo Constraint Language is the preferred constraint language for HL7 v2 message profiles but is not required.
The HL7 v2 Pseudo Constraint Language is composed of building blocks that are linked together to create conformance statements. The building blocks include:
Element Location
Propositions
Context
Conformance Verbs
Declarative Statements
Occurrence Declarative Statement (ODS)
Content Declarative Statement (CDS)
Comparison Content Declarative Statement (CCDS)
Connectors
An example template for the conformance-statement builder is given below:
Conformance Statement Example using a template pattern:
IF LOCATION (DESCRIPTION) contains the value 'VALUE', THEN at least one occurrence of LOCATION (DESCRIPTION) of the SEGMENT segment VERB contain the value ‘VALUE’.
Instance Example:
IF MSA-1 (Acknowledgment Code) contains the value 'AR', THEN at least one occurrence of ERR-4 (Severity) of the ERR segment SHALL contain the value ‘E’.
Table 13.1 shows the template pattern broken up into its building-block parts. Additionally, a usage is given for each building block. Some building blocks are a part of all conformance statements (required), and others may be part of the conformance statement (optional).
Pattern Part |
Template Example |
Example |
Usage |
---|---|---|---|
Proposition |
IF LOCATION (DESCRIPTION) contains the value 'VALUE', THEN |
IF MSA-1 (Acknowledgment Code) contains the value 'AR', THEN |
Optional |
ODS |
at least one occurrence of |
at least one occurrence of |
Optional |
Location |
LOCATION (DESCRIPTION) |
ERR-4 (Severity) |
Required |
Context |
of the SEGMENT segment |
of the ERR segment |
Optional |
Verb |
VERB |
SHALL |
Required |
CDS or CCDS |
contain the value ‘VALUE’. |
contain the value ‘E’. |
Required |
An example of a conformance statement with the minimal required building blocks is:
Example:
OBX-11 (Observation Result Status) SHALL contain the value ‘F’.
The Element Location indicates the location in the message that is being addressed. The location can reference a group, segment, field, component, or sub-component and includes a description. For details of how an element location is represented, see Section 1.2.3.
A conformance statement may be predicated on a condition, which is a building block called a proposition. Table 13.2 shows the list of pre-defined proposition patterns and their meanings.
Propositions (Predicates) |
Description |
---|---|
IF LOCATION (DESCRIPTION) is valued, THEN |
"is valued" predicate |
IF LOCATION (DESCRIPTION) is not valued, THEN |
"is not valued" predicate |
IF LOCATION (DESCRIPTION) contains the value 'VALUE', THEN |
"dependent value" predicate |
IF LOCATION (DESCRIPTION) contains the value 'VALUE' (DESCRIPTION), THEN |
"dependent value with description" predicate |
IF LOCATION (DESCRIPTION) does not contain the value 'VALUE', THEN |
"not dependent value" predicate |
IF LOCATION (DESCRIPTION) does not contain the value 'VALUE' (DESCRIPTION), THEN |
"not dependent value with description" predicate |
IF LOCATION (DESCRIPTION) contains one of the values in the list { 'VALUE 1', 'VALUE 2', 'VALUE N' }, THEN |
"dependent value in list" predicate |
IF LOCATION (DESCRIPTION) contains one of the values in the list { 'VALUE 1' (DESCRIPTION) , 'VALUE 2' (DESCRIPTION), 'VALUE N' (DESCRIPTION) }, THEN |
"dependent value in list with description" predicate |
IF LOCATION (DESCRIPTION) does not contain one of the values in the list { 'VALUE 1', 'VALUE 2', 'VALUE N' }, THEN |
"not dependent value in list" predicate |
IF LOCATION (DESCRIPTION) does not contain one of the values in the list { 'VALUE 1' (DESCRIPTION) , 'VALUE 2' (DESCRIPTION) , 'VALUE N' (DESCRIPTION) }, THEN |
"not dependent value in list with description" predicate |
The key phrases in the proposition are “is valued” and “contains the value”; a brief definition follows:
is-valued: Any non-empty value satisfies the predicate proposition.
contains the value: A value that is an exact match of value satisfies the predicate proposition. An indication of whether the exact match is case sensitive can be noted.
A conformance statement may refer to a specific instance of an element or to a group of element instances. Identifying an instance or instances is accomplished with the occurrence-declarative statement. Table 13.3 shows the list of pre-defined occurrence-declarative statement patterns and their meanings.
Occurrence Declarative Statement |
Description |
---|---|
At least one occurrence of |
One or more occurrence(s) of a repeating element can satisfy the predicate. |
The 'INSTANCE' occurrence of |
The occurrence indicated by the INSTANCE of a repeating element must satisfy the predicate. Other instances may also satisfy the predicate. |
No occurrence of |
No occurrence of a repeating element can satisfy the predicate. |
Exactly one occurrence of |
One and only one occurrence of a repeating element can satisfy the predicate. |
'COUNT' occurrences of |
Exactly COUNT occurrences of a repeating element can satisfy the predicate. |
All occurrences of |
All occurrences of a repeating element must satisfy the predicate. |
An example of a conformance statement using an occurrence-declarative statement is:
Example:
Exactly one occurrence of MSH-21.1 (Entity Identifier) SHALL contain the value ‘Z22r1.0’.
The meaning of a conformance statement can be different depending on the context or scope to which it applies. Table 13.4 shows the list of pre-defined context patterns and their meanings. Note that the context of “LOCATION” indicates the location at any level. To indicate a specific context, the conformance statement may be enhanced with the contexts provided in Table 13.4.
Context (Scope/Location) |
Description |
---|---|
of the SEGMENT segment |
"segment", e.g., “ERR segment” |
in the same GROUP group |
"same group", e.g., “in the same ORDER group” |
Conformance statements indicate the strength of the constraint with the use of the conformance verbs (See Table 13.5). The “SHALL” and “SHALL NOT” verbs indicate that the constraint must be implemented. The other verbs indicate constraints that may be applied. The “SHOULD” and “SHOULD NOT” verbs indicate constraints that are recommended but are not mandated.
Verbs |
Description |
---|---|
SHALL |
Requirement to implement the constraint statement. |
SHALL NOT |
Requirement not to implement the constraint statement. |
SHOULD |
Recommendation to implement the constraint statement. |
SHOULD NOT |
Recommendation not to implement the constraint statement. |
MAY |
An indication that the constraint statement can be implemented. |
Content-declarative statements ask whether an element contains certain content. The values can be arbitrary values, coded values, or restricted values based on a format. The values may or may not contain an associated description.
Declarative Statement |
Description |
---|---|
contain the value ‘VALUE’. |
Simple Value |
contain the value ‘VALUE’ (DESCRIPTION). |
Simple Value with Description |
contain the value ‘VALUE’ drawn from the code system 'CODE SYSTEM'. |
Code Value from Code System |
contain the value ‘VALUE’ (DESCRIPTION) drawn from the code system 'CODE SYSTEM'. |
Code Value with Description from Code System |
contain one of the values in the list: { ‘VALUE 1’, 'VALUE 2', 'VALUE N' }. |
Simple Value in List |
contain one of the values in the list: { ‘VALUE 1’ (DESCRIPTION), 'VALUE 2' (DESCRIPTION), 'VALUE N' (DESCRIPTION) }. |
Simple Value with Description in List |
contain one of the values in the list: { ‘VALUE 1’, 'VALUE 2', 'VALUE N' } drawn from the code system 'CODE SYSTEM'. |
Code Value in List from Code System |
contain one of the values in the list: { ‘VALUE 1’ (DESCRIPTION), 'VALUE 2 (DESCRIPTION)', 'VALUE N' (DESCRIPTION) } drawn from the code system 'CODE SYSTEM'. |
Code Value with Description in List from Code System |
match the regular expression ‘REGULAR EXPRESSION’. |
Content is required to match the regular expression. Regular expressions of “MR\d{5}” indicates that the content must start with “MR” and be followed with 5 digits. Example is “MR83452”. |
contain a positive integer. |
Content is required to be a positive integer. This is a specific instance of a regular expression and provided for convenience. |
be valued sequentially starting with the value ‘1'. |
Content of the first occurrence of an element must be ‘1’, subsequent occurrences are required to increase by 1. Used for identifying instances of segments using the Set ID field. |
be valued with an ISO-compliant OID. |
Content is required to be a regular expression that represents the format of an ISO-compliant OID. This is a specific instance of a regular expression and provided for convenience. |
Comparison-content declarative statements ask whether the content of one element matches that of another element based on a comparator. Table 13.7 lists each of the statements along with a description and examples.
Comparative Statement |
Description |
Examples |
---|---|---|
be identical to LOCATION 2 (DESCRIPTION). |
Content is the same in meaning and representation (a literal identical to). Applies to general, coded values, and date/time content. This concept can also be applied at the complex element level (e.g., compare ORC-12 and OBX-16). |
General: 3 is identical to 3. Coded Value: The LOINC code of 30963-3 is identical to 30963-3 Date/Time: 201103041023-0400 is identical to 201803041023-0400 (unlikely to be used for time) Complex element: Each constitute part of the complex element are compared for identical content. |
be earlier than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a data/time that occurs before the date/time of the element it is compared to. The comparison is a “meaning” comparison. |
Date/Time: 201803041021-0400 is earlier than 201803040823-0600 |
be earlier than or equivalent to LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs before or at the date/time of the element it is compared to. The comparison is a “meaning” comparison. |
Date/Time: 201803041021-0400 is earlier than 201803040823-0600 Date/Time: 201803041023-0400 is equivalent to 201803040823-0600 |
be truncated earlier than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs before the date/time of the element it is compared to. The comparison is a “meaning” comparison and is at the coarsest level (i.e., the more detailed element is truncated to the resolution of the less detailed element). |
Date/Time: 20180302 is earlier than 201803040823-0600 |
be truncated earlier than or truncated equivalent to LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs before or at the date/time of the element it is compared to. The comparison is a “meaning” comparison and is at the coarsest level (i.e., the more detailed element is truncated to the resolution of the less detailed element). |
Date/Time: 20180304 is equivalent to 201803040823-0600 Date/Time: 20180302 is earlier than 201803040823-0600 |
be equivalent to LOCATION 2 (DESCRIPTION). |
Content is the same in meaning but not representation. Applies to general, coded values, and data/time content. This concept can also be applied at the complex element level (e.g., compare ORC-12 and OBX-16). |
General: 3.00 is equivalent to 3. Coded Value: C38288 (NCIT) is equivalent to PO (HL70162). Oral-administered by mouth. Note: A concept map must be specified. Date/Time: 201803041023-0400 is equivalent to 201803040823-0600 Complex element: Each constitute part of the complex element are compared for identical content. |
be truncated equivalent to LOCATION 2 (DESCRIPTION). |
Content is the same in meaning but not represented in the same manner and/or having the same resolution. Applies to general and date/time content. The comparison is at the coarsest level (i.e., the more detailed element is truncated to the resolution of the less detailed element). |
General: 3.56 is truncated equivalent to 3. Date/Time: 20180304 is equivalent to 201803040823-0600 |
be equivalent to or later than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs after or at the date/time of the element it is compared to. The comparison is a “meaning” comparison. |
Date/Time: 201803041023-0400 is equivalent to 201803040823-0600
Date/Time: 201803041025-0400 is later than 201803040823-0600 |
be later than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs after the date/time of the element it is compared to. The comparison is a “meaning” comparison. |
Date/Time: 201803041025-0400 is later than 201803040823-0600 |
be truncated equivalent to or truncated later than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs after or at the date/time of the element it is compared to. The comparison is a “meaning” comparison and is at the coarsest level (i.e., the more detailed element is truncated to the resolution of the less detailed element). |
Date/Time: 20180304 is equivalent to 201803040823-0600
Date/Time: 20180305 is later than 201803040823-0600 |
be truncated later than LOCATION 2 (DESCRIPTION). |
Applies to date/time content only and indicates a date/time that occurs after the date/time of the element it is compared to. The comparison is a “meaning” comparison and is at the coarsest level (i.e., the more detailed element is truncated to the resolution of the less detailed element). |
Date/Time: 20180305 is later than 201803040823-0600 |
Conformance statements can be combined to make complex conformance statements with a set of connectors (See Table 13.8). Multiple connectors can be used, and connectors can be used in propositions and/or content-declarative statements and comparison-declarative statements.
Connectors |
Description |
---|---|
AND |
Both predicates must be satisfied |
OR |
One predicate must be satisfied; both may be satisfied |
XOR |
Exclusive OR–one predicate must be satisfied; both must not be satisfied |
An example of a complex conformance statement is:
Example:
IF RXA-20 (Completion Status) contains one of the values in the list { 'CP', 'PA' } AND RXA-9.1 (Administration Notes) contains the value '00' THEN exactly one occurrence of OBX-3.1 (Entity Identifier) in the same ORDER Group SHALL contain the value "30963-3" (Funding Source) drawn from the LN code system.
The pseudo language presented is not intended to cover all possible constraints a specifier may wish to provide. In situations in which the language does not support a constraint, the specifier may use a free-text expression. The expression is not conducive to automatic translation into a machine-processable assertion.