Goods Nomenclature

Business rules for commodities/goods nomenclatures.

class commodities.business_rules.NIG1(transaction=None)[source]

The validity period of the goods nomenclature must not overlap any other goods nomenclature with the same SID.

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

The validity period of the goods nomenclature must not overlap any other goods nomenclature with the same SID.

class commodities.business_rules.NIG10(transaction=None)[source]

The successor must be applicable the day after the end date of the old code.

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

The successor must be applicable the day after the end date of the old code.

validate(successor)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class commodities.business_rules.NIG11(transaction=None)[source]

At least one indent record is mandatory.

The start date of the first indentation must be equal to the start date of the nomenclature. No two associated indentations may have the same start date. The start date must be less than or equal to the end date of the nomenclature.

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

At least one indent record is mandatory.

The start date of the first indentation must be equal to the start date of the nomenclature. No two associated indentations may have the same start date. The start date must be less than or equal to the end date of the nomenclature.

class commodities.business_rules.NIG12(transaction=None)[source]

At least one description is mandatory.

The start date of the first description period must be equal to the start date of the nomenclature. No two associated description periods may have the same start date. The start date must be less than or equal to the end date of the nomenclature.

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

At least one description is mandatory.

The start date of the first description period must be equal to the start date of the nomenclature. No two associated description periods may have the same start date. The start date must be less than or equal to the end date of the nomenclature.

class commodities.business_rules.NIG18(transaction=None)[source]

Footnotes with a footnote type for which the application type = “CN footnotes” must be linked to CN lines (all codes up to 8 digits).

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

Footnotes with a footnote type for which the application type = “CN footnotes” must be linked to CN lines (all codes up to 8 digits).

class commodities.business_rules.NIG2(transaction=None)[source]

The validity period of the goods nomenclature must be within the validity period of the product line above in the hierarchy.

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

The validity period of the goods nomenclature must be within the validity period of the product line above in the hierarchy.

validate(indent)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class commodities.business_rules.NIG22(transaction=None)[source]

The period of the association with a footnote must be within the validity period of the nomenclature.

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

The period of the association with a footnote must be within the validity period of the nomenclature.

class commodities.business_rules.NIG23(transaction=None)[source]

The period of the association with a footnote must be within the validity period of the footnote.

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

The period of the association with a footnote must be within the validity period of the footnote.

class commodities.business_rules.NIG24(transaction=None)[source]

When the same footnote is associated more than once with the same nomenclature then there may be no overlap in their association periods.

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

When the same footnote is associated more than once with the same nomenclature then there may be no overlap in their association periods.

validate(association)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class commodities.business_rules.NIG30(transaction=None)[source]

When a goods nomenclature is used in a goods measure then the validity period of the goods nomenclature must span the validity period of the goods measure.

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

When a goods nomenclature is used in a goods measure then the validity period of the goods nomenclature must span the validity period of the goods measure.

class commodities.business_rules.NIG31(transaction=None)[source]

When a goods nomenclature is used in an additional nomenclature measure then the validity period of the goods nomenclature must span the validity period of the additional nomenclature measure.

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

When a goods nomenclature is used in an additional nomenclature measure then the validity period of the goods nomenclature must span the validity period of the additional nomenclature measure.

class commodities.business_rules.NIG34(transaction=None)[source]

A goods nomenclature cannot be deleted if it is used in a goods measure.

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

A goods nomenclature cannot be deleted if it is used in a goods measure.

class commodities.business_rules.NIG35(transaction=None)[source]

A goods nomenclature cannot be deleted if it is used in an additional nomenclature measure.

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

A goods nomenclature cannot be deleted if it is used in an additional nomenclature measure.

validate(good)[source]

Perform business rule validation.

Raises

NotImplementedError – Must be overridden by subclasses

class commodities.business_rules.NIG5(transaction=None)[source]

When creating a goods nomenclature code, an origin must exist.

This rule is only applicable to update extractions.

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

When creating a goods nomenclature code, an origin must exist.

This rule is only applicable to update extractions.

validate(good)[source]

Almost all goods nomenclatures must have an origin, excluding two scenarios:

  1. They are a top level code (depth/indent of 1)

  2. They were made before 2010-01-01 (legacy data)

Therefore check for these two conditions, and if neither are met ensure an origin exists.

class commodities.business_rules.NIG7(transaction=None)[source]

The origin must be applicable the day before the start date of the new code entered.

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

The origin must be applicable the day before the start date of the new code entered.

validate(origin)[source]

By default the upper bound is exclusive whilst the lower bound is inclusive.

So we just need to make sure the bounds match.