Geographical Areas

Business rules for geographical areas.

class geo_areas.business_rules.DescriptionNotEmpty(transaction=None)[source]

A description cannot be blank.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

A description cannot be blank.

validate(description)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA1(transaction=None)[source]

The combination of geographical area id + validity start date must be unique.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The combination of geographical area id + validity start date must be unique.

class geo_areas.business_rules.GA10(transaction=None)[source]

When a geographical area is referenced in a measure then the validity period of the geographical area must span the validity period of the measure.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

When a geographical area is referenced in a measure then the validity period of the geographical area must span the validity period of the measure.

class geo_areas.business_rules.GA11(transaction=None)[source]

If a geographical area is referenced as an excluded geographical area in a measure then the membership period of the geographical area must span the validity period of the measure.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If a geographical area is referenced as an excluded geographical area in a measure then the membership period of the geographical area must span the validity period of the measure.

class geo_areas.business_rules.GA12(transaction=None)[source]

The referenced geographical area id (member) must exist.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The referenced geographical area id (member) must exist.

class geo_areas.business_rules.GA13(transaction=None)[source]

Group member must be a Country or Region, not a Group.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

Group member must be a Country or Region, not a Group.

validate(membership)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA14(transaction=None)[source]

The referenced geographical area group id must exist.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The referenced geographical area group id must exist.

class geo_areas.business_rules.GA16(transaction=None)[source]

The validity period of the geographical area group must span all membership periods of its members.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The validity period of the geographical area group must span all membership periods of its members.

class geo_areas.business_rules.GA17(transaction=None)[source]

The membership period of a geographical area (member) must be within (inclusive) the validity period of the geographical area group (geographical area’s start and end date).

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The membership period of a geographical area (member) must be within (inclusive) the validity period of the geographical area group (geographical area’s start and end date).

class geo_areas.business_rules.GA18(transaction=None)[source]

When a geographical area is more than once member of the same group then there may be no overlap in their membership periods.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

When a geographical area is more than once member of the same group then there may be no overlap in their membership periods.

validate(membership)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA19(transaction=None)[source]

If the associated geographical area group has a parent geographical area group then all the members of the geographical area group must also be members of the parent geographical area group.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If the associated geographical area group has a parent geographical area group then all the members of the geographical area group must also be members of the parent geographical area group.

validate(membership)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA20(transaction=None)[source]

If the associated geographical area group has a parent geographical area group then the membership period of each member of the parent group must span the membership period of the same geographical area in the geographical area group.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If the associated geographical area group has a parent geographical area group then the membership period of each member of the parent group must span the membership period of the same geographical area in the geographical area group.

validate(membership)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA21(transaction=None)[source]

If a geographical area is referenced in a measure then it may not be deleted.

The geographical area may be referenced in a measure as the origin/destination or as an excluded geographical area.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If a geographical area is referenced in a measure then it may not be deleted.

The geographical area may be referenced in a measure as the origin/destination or as an excluded geographical area.

class geo_areas.business_rules.GA22(transaction=None)[source]

A geographical area cannot be deleted if it is referenced as a parent geographical area group.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

A geographical area cannot be deleted if it is referenced as a parent geographical area group.

class geo_areas.business_rules.GA23(transaction=None)[source]

If a geographical area is referenced as an excluded geographical area in a measure, the membership association with the measure geographical area group cannot be deleted.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If a geographical area is referenced as an excluded geographical area in a measure, the membership association with the measure geographical area group cannot be deleted.

class geo_areas.business_rules.GA3(transaction=None)[source]

At least one description record is mandatory.

The start date of the first description period must be equal to the start date of the geographical area. Two descriptions may not have the same start date. The start date of the description must be less than or equal to the end date of the geographical area.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

At least one description record is mandatory.

The start date of the first description period must be equal to the start date of the geographical area. Two descriptions may not have the same start date. The start date of the description must be less than or equal to the end date of the geographical area.

class geo_areas.business_rules.GA4(transaction=None)[source]

The referenced parent geographical area group must be an existing geographical area with area code = 1 (geographical area group).

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The referenced parent geographical area group must be an existing geographical area with area code = 1 (geographical area group).

validate(geo_area)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA5(transaction=None)[source]

If a geographical area has a parent geographical area group then the validity period of the parent geographical area group must span the validity period of the geographical area.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

If a geographical area has a parent geographical area group then the validity period of the parent geographical area group must span the validity period of the geographical area.

class geo_areas.business_rules.GA6(transaction=None)[source]

Loops in the parent relation between geographical areas and parent geographical area groups are not allowed.

If a geographical area A is a parent geographical area group of B then B cannot be a parent geographical area group of A (loops can also exist on more than two levels, e.g. level 3; If A is a parent of B and B is a parent of C then C cannot be a parent of A).

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

Loops in the parent relation between geographical areas and parent geographical area groups are not allowed.

If a geographical area A is a parent geographical area group of B then B cannot be a parent geographical area group of A (loops can also exist on more than two levels, e.g. level 3; If A is a parent of B and B is a parent of C then C cannot be a parent of A).

validate(geo_group)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class geo_areas.business_rules.GA7(transaction=None)[source]

The validity period of geographical area must not overlap any other geographical area with the same geographical area id.

exception Violation(model: common.models.trackedmodel.TrackedModel, message: Optional[str] = None)

The validity period of geographical area must not overlap any other geographical area with the same geographical area id.