aeat.application.modelo._official_box_advisory module

Calculate-path collector for registry-authored official-box advisories.

The collector is intentionally revision-driven: it scans the ModeloRevision for ADVISORY implies_any_nonzero verification predicates and mirrors the same predicate shape as a non-blocking CalculationSourceDiagnostic on the calculate path. The verification predicate remains the single source of truth for any total-to-official-box mapping, so calculate diagnostics and verify findings cannot drift.

Modelo 303’s 2023-y-siguientes revision used this mechanism in Stage 1, when ledger-backed semantic totals could be positive while manual official Diseño-de-Registros cuota boxes stayed zero. Stage 2 now projects those boxes from their semantic sources and retired the Stage-1 ADVISORY predicates, so this collector normally emits no M303 official-box diagnostics for that revision.

See also

_calculation_diagnostics

Post-calculation coordinator that calls this collector with the engine casilla values.

_verification_actions

Verification predicate parser/evaluator whose implies_any_nonzero shape this collector mirrors.

collect_official_box_unpopulated_diagnostics(revision, casilla_values)[source]

Return advisories for ADVISORY implies_any_nonzero predicates that fire.

A predicate fires when its antecedent (a computed total) is strictly positive while every listed consequent (the official numbered boxes) is zero. Each fired predicate yields one CalculationSourceDiagnostic with reason = "official_box_unpopulated", naming the positive antecedent casilla and the unpopulated official boxes so the operator-facing surface can instruct the transcription.

Parameters:
  • revision (ModeloRevision) – The ModeloRevision whose ADVISORY implies_any_nonzero predicates are evaluated. If the revision has retired those predicates, no diagnostic is emitted.

  • casilla_values (Mapping[TypeAliasType, Decimal]) – The computed engine values keyed by CasillaId and used to test the predicates, so both the semantic antecedent (e.g. iva.cuota-devengada-total) and the official box ids (e.g. 09) resolve.

Return type:

tuple[CalculationSourceDiagnostic, ...]

See also

_evaluate_predicate_expression():

Verification-side evaluator for the same predicate DSL.