Skip to main content

Validity contained

When one record is being referenced by another record, the validity period of the latter must be contained within the validity period of the former.

A record is being referenced by another record if its identifying fields are present in the current version of the other record and the other record is in a different record type.

Validity period refers to the period that the record is valid, i.e. the period between the record’s validity start and validity end dates.

This is implemented by checking if the following is true:

for contained_object in contained_objects:
    container_object.valid_between contains 
    contained_object.valid_between

Where the container_object is the record being referenced by the contained_object.

A record may be both a contained_object and a container_object, i.e. a record that is referenced by one record may itself reference another record.

A record does not need to be directly referenced by another record in order for this rule to apply, it can also apply where the contained_object indirectly references the container_object. See the examples for more detail.

Previous versions of the records are not considered. The rule checks against the validity periods of the current versions of the records. therefore, if the validity period of the container_object is updated in a future version, the validity periods of any contained_object must also be updated.

Examples

In the measures table, a individual measure may reference a geographical area. In this case the measure is the contained_object and the geographical area is the container_object. The validity start date of the measure must be greater than or equal to the validity start date of the geographical area, similarly the validity end date of the measure must be less than or equal to the validity end date of the geographical area. In the case of an open ended conatainer_object (i.e. one where the validity end is ‘null’), the latter constraint would not apply.

Geographical areas are also refrenced by other records, not just measures, making them an example of a container_object that has several contained_objects.

Measure types are an example of an object that is both container and contained. A measure type is referenced by a measure, making it a container_object to the contained_object that is the measure, but in turn reference a measure type series, making the measure type also a contained_object of the container_object that is the measure type series. Note there is no explicit rule saying the measure must be contained by the measure type series, but it is implied by the strucutre of the data. (i.e. if A must be contained by B, and B must be contained by C, by implication A will be contained by C).

Measure components are an example of indirect referencing. Measures do not directly reference objects such as duty expression or duty amount within the measures table, but do so through the measure components table. In these cases the validity contained rule applies, the validity period of a measure must be contained by the validity period of the duty expression, etc.