cadrumo.domain.calculations.registry.orden_applicability module¶
The orden_aplicabilidad gate for a ModeloRevision.
Every revision’s orden_aplicabilidad field declares the legal-catalogue
LegalReference id(s) of
the ordenes ministeriales that approve or amend the modelo form for this
revision’s applicability window. The gate is strict:
Every revision MUST declare at least one entry; missing entries are a hard failure.
Every declared entry MUST resolve in the legal catalogue with a
corpus_ref(peraeat-calculation-grounding).Every declared entry MUST also appear in (or be merged into)
legal_refsso existing snapshot ref-collection carries it.
For *-y-siguientes (open-ended) revisions the orden_aplicabilidad
MUST cite the orden establishing the open-ended applicability — the
connective gate ensuring even the “y siguientes” claim is BOE-anchored.
Per-year norm values inside the open-ended revision (rate brackets,
thresholds) are the parameter-bracket layer’s responsibility gated by
cadrumo.domain.calculations.registry.validate_revision_rules.validate_bracket_table_temporal_coverage;
a wrong-but-present bracket value is a legal-grounding defect, NOT a
resolution defect.
- class RevisionLegalApplicabilityWindow(starts_on, closes_on)[source]¶
Bases:
objectPresentation-aware interval an applicability authority must overlap.
ModeloRevision.valid_from/valid_todescribe the tax-period revision, while annual and informative forms are commonly approved and filed in the following calendar year. Declared deadline windows therefore extend a bounded revision through its latest legally grounded presentation close. An open-ended revision keeps an open upper bound: a later amendment can legitimately be one of its applicability authorities.- classmethod from_revision(revision)[source]¶
Derive the inclusive revision-plus-presentation interval for a
ModeloRevision.- Return type:
- Parameters:
revision (ModeloRevision)
- overlaps(reference)[source]¶
Return whether
referencereaches anywhere in this interval.A norm that takes effect AFTER this window closes can still ground it: an informativa Orden published at the end of December is effective the following January while governing the ejercicio just ended. The catalogue states that explicitly through
governs_periods_from, which the reference schema enforces to be strictly earlier thaneffective_fromprecisely because it declares retroactive reach. Comparingeffective_fromalone therefore refuses a citation the catalogue already says governs these periods.- Return type:
- Parameters:
reference (LegalReference)
- validate_orden_aplicabilidad(scope, modelo_id, revision, legal_catalogue)[source]¶
Validate the
orden_aplicabilidadgate for one revision.Returned failures MUST block registry load: missing applicability Ordenes, dangling entries, corpus-less entries, and entries absent from
legal_refsare all current-data defects.- Connective gate:
For open-ended
*-y-siguientesrevisions (valid_to is Noneandperiod_selector.year_fromis set) theorden_aplicabilidadMUST be non-empty — the open-ended applicability claim MUST be BOE-anchored.
- Parameters:
scope (
str) – Diagnostic scope string prefixed to each message.modelo_id (
str) – The modelo identifier.revision (
ModeloRevision) – TheModeloRevisionto validate.legal_catalogue (
Mapping[str,LegalReference]) – The loaded legal-reference catalogue mapping.
- Return type:
- Returns:
A list of load-blocking failures.
- orden_aplicabilidad_hard_failures(scope, modelo_id, revision, legal_catalogue)[source]¶
Return load-blocking failures of the
orden_aplicabilidadgate.- Parameters:
scope (
str) – Diagnostic scope string prefixed to each message.modelo_id (
str) – The modelo identifier.revision (
ModeloRevision) – TheModeloRevisionto validate.legal_catalogue (
Mapping[str,LegalReference]) – The loadedLegalReferencecatalogue mapping.
- Return type:
- Returns:
A list of load-blocking failures.