aeat.application.modelo._calculation_diagnostics module¶
Post-calculation advisory coordination for bucket aggregation calculations.
The bucket aggregation calculate path first resolves source-backed values,
executes the registry formula engine, and persists the calculated revision. This
module then fans out advisory-only checks over the loaded
ModeloRevision and the computed CasillaId value map, returning
non-blocking
CalculationSourceDiagnostic rows for the
caller to append to source mesh diagnostics. It does not compute, override, or
persist casilla values.
The prior-payment collectors need persisted filing observations, so the
coordinator shares one
CalculationObservationRepository instance
across them. The official-box and settlement collectors read only the revision
structure and calculated casilla values. Together the collectors extend the
source mesh’s no-silent-under-declaration diagnostics with checks whose evidence
only exists after the revision has been calculated.
See also
calculate_modelo_revision_from_bucket_aggregation_with_diagnostics():Calls this coordinator after the calculation revision has been created.
collect_official_box_unpopulated_diagnostics():Mirrors registry-authored ADVISORY predicates as calculate diagnostics.
_prior_payment_advisory:Emits Modelo 130 prior-payment carry degradation advisories.
collect_settlement_not_computed_diagnostics():Emits structural settlement-completeness advisories for partially modelled revisions.
collect_bienes_inversion_regularizacion_diagnostics():Emits the Modelo 303 capital-goods IVA regularización proposed-casilla-43 advisory.
collect_prorrata_regularizacion_diagnostics():Emits the Modelo 303 annual prorrata-general regularización proposed-casilla-44 advisory.
- collect_bucket_aggregation_advisory_diagnostics(revision, casilla_values, *, modelo, period_token, filing_year, bucket_id)[source]¶
Return advisory diagnostics raised after bucket aggregation calculation.
Runs the calculate-path advisory collectors in tuple order: official-box transcription, Modelo 130 prior-payment under-deduction, Modelo 130 prior-payment minoracion capture, settlement-not-computed structure, the Modelo 100 mínimo-por-descendientes undeclared-facts advisory, the Modelo 303 capital-goods IVA regularización (LIVA arts. 107-110) proposed-casilla-43 advisory, and the Modelo 303 annual prorrata-general regularización (LIVA arts. 104-105) proposed-casilla-44 advisory. These diagnostics are informational and non-blocking; the calculation result already exists, and the caller merely appends these rows to the source mesh’s existing
CalculationSourceDiagnosticsequence.The Modelo 100 mínimo-por-descendientes casillas (0513/0514) are no longer advisory-only for the halving/blank-entry checks the prior interim Option B module raised: the
modelo-100-minimo-descendientes-engineADR’s Option A landed a computed engine (inject_derived_minimo_descendientes_facts()) that derives the Art. 58/61 LIRPF aggregate — including the custodia-compartida halving — directly from the active profile, so those two checks are structurally unreachable and were retired. A new, narrower advisory (collect_minimo_descendientes_undeclared_diagnostics()) replaces them: because a genuinely childless profile and a profile that simply never declared its descendientes both resolve 0513 to the same zero, this collector flags the ambiguous case (0513 = 0 and no descendiente facts declared at all) and points the operator ataeat config profile descendiente add.- Parameters:
revision (
ModeloRevision) – TheModeloRevisionwhose predicates, casillas, and formulas are inspected.casilla_values (
Mapping[TypeAliasType,Decimal]) – Computed engine values keyed byCasillaId.modelo (
str) – Target modelo identifier used by modelo-specific advisory collectors.period_token (
str) – Bare registry period token for the filing being calculated.filing_year (
int) – Filing year whose same-ejercicio prior observations may be inspected.bucket_id (
str) – Bucket identifier used by profile-backed advisory collectors.
- Return type:
- Returns:
Tuple of
CalculationSourceDiagnosticadvisory rows, or an empty tuple when no post-calculation advisory fires.
See also
CalculationObservationRepository:Supplies the prior-filing observation catalogue used by the Modelo 130 prior-payment advisory collectors.
calculate_modelo_revision_from_bucket_aggregation_with_diagnostics():Appends this tuple to the source mesh diagnostics on the returned bucket aggregation result.