HL7 Message Profile Conformance / Constraint Rules
Assumptions:
-
message profiles are described in XML in accordance to the Conformance
DTD, and are well-formed XML documents.
-
message profiles have been validated against the Conformance DTD. The initial version of the constraint
checking application will require that the message profiles have an additional
element directly after the <?xml> declaration. This element will be of the form
<!DOCTYPE [doc_name] SYSTEM=[dtd_filename_and_path]>, and informs
the Xerces parser to use the DTD specified by the SYSTEM attribute.
-
the rules below are applied to two message profiles, unless otherwise
noted.
-
a message profile is either of "constrainable" type, which
can be constrained further, or of "implementation" type, which cannot
be constrained further.
-
the message profiles used below are denoted as ProA and ProB, such that
ProB is a constrained version of ProA.
ProA cannot be a message profile of "implementation" type.
Conformance/Specification
Element Constraints
The format of the Conformance/Specification elements in the Conformance
DTD is currently unstable, hence the rules that compare the attributes of these
entities will not be extensive and are merely interpretations based on chapter
2 of the v2.5 HL7 Standard and the HL7 v2.x Message Profiling Specification
v2.2.
<SPECIFICATION>
Element Constraints
Rule 1: <SPECIFICATION>
attribute "ConformanceType"
ProA.ConformanceType = "Constrainable" &&
ProB.ConformanceType = "Constrainable"|"Implementation".
<SEGMENT> Element
Constraints
Rule 1: The number of segments in
ProA >= The number of segments in ProB.
Rule 2: The Name attribute of segments in ProB must
match the Name attribute of the corresponding segment in ProA.
Rule 3: <SEGMENT> elements in ProB
must exist in ProA, following the same nested structure.
Rule 4: ProB segments cannot have an Optionality
attribute that is "lower" than the Optionality attribute in a
corresponding segment in ProA. The
Optionality attribute can be "equal".
The precedence of
Optionality values is as follows:
Usage/Optionality IS: |
Usage/Optionality CAN BECOME: |
X |
X |
R |
R |
RE |
R, RE |
C |
C, R |
CE |
CE, RE, R |
O |
O, X, R, RE, C, CE |
Rule 5: In the case of Optionality values
"C" and "CE", a <Predicate> element will exist.
It will be nested within the <SEGMENT>. The <Predicate> in ProB for a particular segment must be
"stronger" than the <Predicate> in ProB for the corresponding
segment. These may be difficult to test.
Rule 6: ProA segment cardinality attribute Min must be
<= ProB segment cardinality attribute Min.
Note: there are special cardinality values for "one or
zero", "many", etc. that shall be considered.*
Rule 7: ProA segment cardinality attribute Max must be
>= ProB segment cardinality attribute Max.
Note: there are special
cardinality values for "one or zero", "many", etc. that
shall be considered.*
<SEGGROUP> Element
Constraints
Rule 1: The number of segment groups in ProA >= The
number of segment groups in ProB.
Rule 2: The Name
attribute of segment groups in ProB must match the Name attribute of the corresponding
segment group in ProA.
Rule 3: <SEGROUP> elements in ProB
must exist in ProA, following the same nested structure.
Rule 4: ProB segment groups cannot have an Optionality
attribute that is "lower" than the Optionality attribute in a
corresponding segment group in ProA.
The Optionality attribute can be "equal". The precedence of Optionality values is as
follows:
Usage/Optionality IS: |
Usage/Optionality CAN BECOME: |
X |
X |
R |
R |
RE |
R, RE |
C |
C, R |
CE |
CE, RE, R |
O |
O, X, R, RE, C, CE |
Rule 5: In the case of Optionality values
"C" and "CE", a <Predicate> element will exist.
It will be nested within the <SEGGROUP>. The <Predicate> in ProB for a particular segment group must
be "stronger" than the <Predicate> in ProB for the corresponding
segment group. These may be difficult
to test.
Rule 6: ProA segment cardinality attribute Min must be
<= ProB segment cardinality attribute Min.
Note: there are special cardinality values for "one or zero",
"many", etc. that shall be considered.*
Rule 7: ProA segment cardinality attribute Max must be
>= ProB segment cardinality attribute Max.
Note: there are special cardinality values for "one or zero",
"many", etc. that shall be considered.*
<FIELD> Element
Constraints
Rule 1: The number of <FIELD> elements in a
segment in ProA is >= The number of <FIELD> elements in a segment in
ProB.
Rule 2: <FIELD> elements in ProB must
exist in ProA, following the same nested structure.
Rule 3: The Name attribute of <FIELD> elements
in ProB must match the Name attribute of the corresponding <FIELD>
element in ProA.
Rule 5: The ItemNo attribute of <FIELD> elements
in ProB must match the ItemNo attribute of the corresponding <FIELD>
element in ProA.
Rule 6: The Table attribute of <FIELD> elements
in ProB must match the Table attribute of the corresponding <FIELD>
element in ProA.
Rule 7: The Datatype attribute of <FIELD>
elements in ProB must match the Datatype attribute of the corresponding
<FIELD> element in ProA.
Rule 8: The Length attribute of <FIELD> elements in ProA are >= the
Length attribute of the corresponding <FIELD> element in ProB, if it
exists.
Rule 9: The ConstantValue of <FIELD> elements in
ProA are >= the ConstantValue attribute of the corresponding <FIELD>
element in ProB, if it exists.
Rule 10: ProB
<FIELD> elements cannot have an Optionality attribute that is "lower"
than the Optionality attribute in a corresponding <FIELD> element in
ProA. The Optionality attribute can be
"equal". The precedence of
Optionality values is as follows:
Usage/Optionality IS: |
Usage/Optionality CAN BECOME: |
X |
X |
R |
R |
RE |
R, RE |
C |
C, R |
CE |
CE, RE, R |
O |
O, X, R, RE, C, CE |
Rule 11:In the
case of Optionality values "C" and "CE", a
<Predicate> element will
exist. It will be nested within the
<FIELD> element. The
<Predicate> in ProB for a particular <FIELD> element must be
"stronger" than the <Predicate> in ProB for the corresponding
<FIELD>. These may be difficult
to test.
Rule 12:ProA
<FIELD> element cardinality attribute Min must be <= ProB
<FIELD> element cardinality attribute Min.
Note: there are special cardinality values for
"one or zero", "many", etc. that shall be considered.*
Rule 13:ProA
segment cardinality attribute Max must be >= ProB <FIELD> element
cardinality attribute Max.
Note: there
are special cardinality values for "one or zero", "many",
etc. that shall be considered.*
<COMPONENT>
Element Constraints
Rule 1: The number of <COMPONENT> elements in a
<FIELD> in ProA is >= The number of <COMPONENT> elements in the
corresponding <FIELD> in ProB.
Rule 2: <COMPONENT> elements in ProB
must exist in ProA, following the same nested structure.
Rule 3: The Name attribute of <COMPONENT>
elements in ProB must match the Name attribute of the corresponding
<COMPONENT> element in ProA.
Rule 4: The Table attribute of <COMPONENT>
elements in ProB must match the Table attribute of the corresponding
<COMPONENT> element in ProA.
Rule 5: The Datatype attribute of <COMPONENT>
elements in ProB must match the Datatype attribute of the corresponding
<COMPONENT> element in ProA.
Rule 6: The Length attribute of <COMPONENT> elements in ProA are >=
the Length attribute of the corresponding <COMPONENT> element in ProB, if
it exists.
Rule 7: The ConstantValue of <COMPONENT>
elements in ProA are >= the ConstantValue attribute of the corresponding
<COMPONENT> element in ProB, if it exists.
Rule 8: ProB <COMPONENT> elements cannot have an
Optionality attribute that is "lower" than the Optionality attribute
in a corresponding <COMPONENT> element in ProA. The Optionality attribute can be "equal". The precedence of Optionality values is as
follows:
Usage/Optionality IS: |
Usage/Optionality CAN BECOME: |
X |
X |
R |
R |
RE |
R, RE |
C |
C, R |
CE |
CE, RE, R |
O |
O, X, R, RE, C, CE |
Rule 9: In the case of Optionality values
"C" and "CE", a <Predicate> element will exist.
It will be nested within the <COMPONENT> element. The <Predicate> in ProB for a
particular <COMPONENT> element must be "stronger" than the
<Predicate> in ProB for the corresponding <COMPONENT>. These may be difficult to test.
<SUBCOMPONENT> Element
Constraints
Rule 1: The number of <SUBCOMPONENT> elements in
a <COMPONENT> in ProA is >= The number of <SUBCOMPONENT>
elements in the corresponding <COMPONENT> in ProB.
Rule 2: <SUBCOMPONENT> elements in
ProB must exist in ProA, following the same nested structure.
Rule 3: The Name attribute of <SUBCOMPONENT>
elements in ProB must match the Name attribute of the corresponding
<SUBCOMPONENT> element in ProA.
Rule 4: The Table attribute of <SUBCOMPONENT>
elements in ProB must match the Table attribute of the corresponding
<SUBCOMPONENT> element in ProA.
Rule 5: The Datatype attribute of <SUBCOMPONENT>
elements in ProB must match the Datatype attribute of the corresponding
<SUBCOMPONENT> element in ProA.
Rule 6: The Length attribute of <SUBCOMPONENT> elements in ProA are
>= the Length attribute of the corresponding <SUBCOMPONENT> element in
ProB, if it exists.
Rule 7: The ConstantValue of <SUBCOMPONENT>
elements in ProA are >= the ConstantValue attribute of the corresponding
<SUBCOMPONENT> element in ProB, if it exists.
Rule 8: ProB <SUBCOMPONENT> elements cannot have
an Optionality attribute that is "lower" than the Optionality
attribute in a corresponding <SUBCOMPONENT> element in ProA. The Optionality attribute can be "equal". The precedence of Optionality values is as
follows:
Usage/Optionality IS: |
Usage/Optionality CAN BECOME: |
X |
X |
R |
R |
RE |
R, RE |
C |
C, R |
CE |
CE, RE, R |
O |
O, X, R, RE, C, CE |
Rule 9: In the case of Optionality values
"C" and "CE", a <Predicate> element will exist.
It will be nested within the <SUBCOMPONENT> element. The <Predicate> in ProB for a particular
<SUBCOMPONENT> element must be "stronger" than the
<Predicate> in ProB for the corresponding <SUBCOMPONENT>. These may be difficult to test.
Other Elements
<ImpNote>, <Description>, <Reference>, and
<Predicate> elements in <SEGMENT>, <SEGGROUP>, <FIELD>,
<COMPONENT>, and <SUBCOMPONENT> elements are optional according to
the Conformance DTD. With the exception
of the <Predicate> element, these elements may or may not appear in
either ProA or ProB and cannot be compared.
<Predicate> elements may be tied into "C" and
"CE" Optionality values, so they could be compared if the logic used
in the predicate can be proved (e.g., the element exists if another element
exists in the message profile. A
stronger predicate could be testing the existence of two more elements in the
message profile). At the moment, these
comparisons will probably be done manually.
<DataValues> elements are example values that are placed within
the the element of interest. It is
assumed that these values will not be compared or evaluated.
------
* Note: If Optionality is
"R", then Min attribute is
"1". If Optionality is not
"R", Min attribute is "0" except when Optionality is
"RE" and Min attribute is not "0". In the case where ProA has an Optionality
attribute value of "RE", the Min attribute value for ProA will be
>= the Min attribute value of ProB.
ProB can incidentally have an Optionality attribute value of
"R" with a Min attribute value of "1" or an Optionality
attribute value of "RE" with a Min attribute value that follows the
>= rule above.