aeat.core._casilla_id module

Canonical casilla-id primitive shared across architecture layers.

The CasillaId alias is the shared key for registry casillas, CLI --casilla inputs, parser observations, and calculation payloads. It is re-exported by domain.calculations.registry and anchors CasillaDefinition, CalculationCompletenessCasilla, and filing snapshot facts such as ManualFactBasisEntry.

Use validated_casilla_id() or validated_casilla_id_map() at boundaries so display numbers, labels, and export metadata do not masquerade as canonical registry identifiers. Registry membership helpers such as casillas_by_id() and declared_casilla_ids() then compare only declared casilla.id values.

The alias is a structural token, not a registry lookup. It can prove that a string is shaped like a canonical casilla.id; only a selected ModeloRevision can prove that the id is declared for a filing context.

validated_casilla_id(value, *, surface='casilla.id')[source]

Return value as a canonical CasillaId, failing at the declaring surface.

This validates the token shape only. Callers that need revision membership must also compare against declared_casilla_ids() or undeclared_casilla_ids().

Parameters:
  • value (object) – Candidate boundary value.

  • surface (str) – Human-readable source used in the failure message.

Raises:

ValueError – When value is not a string or fails the canonical casilla.id shape.

Return type:

TypeAliasType

validated_casilla_id_map(values, *, surface='casilla.id map')[source]

Return values keyed by validated CasillaId declarations.

Mapping validators feed registry and filing surfaces that accept dict[CasillaId, T] inputs, including calculation-revision snapshots and registry filing test helpers. Like validated_casilla_id(), this checks key shape only; the caller remains responsible for validating membership against the selected ModeloRevision.

Return type:

dict[TypeAliasType, TypeVar(T)]

Parameters: