aeat.domain.renta._first_slice_routing module

First-slice Modelo 100 expense routing table.

This is the BOE-prescribed routing table from SpendingCategory to the Modelo 100 estimacion directa expense casilla that receives the deductible amount for that category.

The mapping is canonical: it stores the registry casilla.id values for the Modelo 100 instructions. Every consumer (the renta-deductibility observation validator, the renta-ledger aggregator, the snapshot-time referential-integrity gate) reads from the single FIRST_SLICE_EXPENSE_CASILLAS constant declared here.

The companion _first_slice_routing_integrity module registers a snapshot-time referential-integrity check, but it validates a NARROWER claim than “every casilla this table mentions exists on every revision”: casilla ids are added, split, and renumbered across Modelo 100 revisions (e.g. “Aportaciones a mutualidades alternativas” shares casilla 0186 with Seguridad Social contributions on the 2020-2022 revisions but gets its own dedicated casilla 0195 from 2023 onward), so a target this table names may legitimately be absent from an older revision that predates the split. The registered check instead asserts that every casilla a REVISION’S OWN ledger_renta_expense_aggregation bindings target actually exists on that same revision – see aeat.domain.calculations.registry.renta_first_slice_binding_target_casillas(). A regression in either the registry or a revision’s own bindings surfaces as a typed RegistryValidationError at snapshot construction.

FIRST_SLICE_EXPENSE_CASILLAS: Mapping[SpendingCategory, CasillaId]

SpendingCategory -> Modelo 100 estimacion directa expense casilla.

Every SpendingCategory member routes to a real Modelo 100 estimacion_directa expense casilla; the table is total (see aeat.domain.renta.tests.test_first_slice_routing), so no member is silently unrouted (no-silent-under-declaration, no-dormant-source-resolvers).

expected_casilla_for_category(category)[source]

Return the routed casilla id for category, or None if outside the first slice.

Return type:

TypeAliasType | None

Parameters:

category (SpendingCategory)

first_slice_target_casillas()[source]

Return every casilla id this routing table references.

Used by the snapshot-time referential-integrity gate to confirm that every target the table can route to is a real casilla on the modelo-100 registry. A casilla id removed from the registry without a corresponding update here is a snapshot-build error.

Return type:

frozenset[TypeAliasType]