When we talk about HL7 conformance, we often conflate the concept of whether a field is mandatory along with its conformance level.
Strictly from a conformance point of view, there are three valid values:
- Required: any conformant application must support the field. It is perfectly acceptable for the field to be absent in a message, but if it is there then the application must deal with appropriately (i.e., it must capture and/or display the information as appropriate).
- Optional: any conformant application may or may not support this field.
- Not permitted: the field should never be included in the message.
There are only two values that are valid along this axis. Well, three if you’re in Canada, but we’ll get to that.
- Mandatory: the field must have a value.
- Not mandatory: the field does not need to be included in the message.
Canadian schemas also have the concept of Populated. This means that the element must be there even if it is blank with a null flavor.
We’ve sort of combined these two concepts into one concept, confusingly enough called conformance in our code base.
|What we say||What we mean||Notes|
|Mandatory||Required, mandatory||Value may not be null.|
|Populated||Required, not mandatory, 1..n cardinality||Element must always be there, may have a null flavour.|
|Required||Required, not mandatory, 0..n cardinality||Element may be absent, but the application must be able to deal with it.|
|Optional||Optional, not mandatory||Element may be absent.|
|Not allowed||Not permitted, not mandatory||Element must not be present.|