aeat.domain.calculations.registry._constructs module¶
Construct resolution for registry revisions.
Resolves named construct groups declared on a ModeloRevision into
typed ResolvedConstruct records that list every member (casilla, formula,
binding, etc.) with its id and value.
- class ResolvedConstructMember(kind, id, value)[source]¶
Bases:
objectOne member resolved from a registry construct group.
A construct group bundles heterogeneous registry entities (casillas, formulas, parameters, bindings, etc.) under a common id. Each member records the entity
kind(e.g."casilla","formula"), its registryidstring, and the fully-typedvalueobject retrieved from the revision index.
- class ResolvedConstruct(**data)[source]¶
Bases:
RegistryModelA fully-resolved registry construct group for one
ModeloRevision.A construct is a named thematic bundle declared in the registry TOML that groups related revision entities (casillas, formulas, bindings, etc.) so that consumers can iterate over them without knowing the full revision schema. After resolution every member carries its typed value object, not just its id string.
legal_refsandsource_refscarry the provenance declared on the construct entry in the TOML tree; they are propagated unchanged from theModeloRevisionconstruct record.- Parameters:
id (str)
title (str)
legal_refs (Annotated[tuple[LegalRefId, ...], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])])
source_refs (Annotated[tuple[SourceRefId, ...], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])])
members (tuple[ResolvedConstructMember, ...])
- id: str¶
- title: str¶
- legal_refs: LegalRefs¶
- source_refs: SourceRefs¶
- members: tuple[ResolvedConstructMember, ...]¶
- members_of_kind(kind)[source]¶
Return every member whose
kindmatches the given string.- Parameters:
kind (
str) – Entity kind to filter on, e.g."casilla"or"formula".- Return type:
- Returns:
A tuple of matching
ResolvedConstructMemberinstances, empty if no members carry the requested kind.
- resolve_revision_constructs(revision)[source]¶
Resolve all construct groups declared on a revision.
Iterates over
revision.constructsin declaration order and callsresolve_constructfor each entry.- Parameters:
revision (
ModeloRevision) – TheModeloRevision(a dated version of an AEAT modelo — tax form) whose construct groups should be resolved.- Return type:
- Returns:
A tuple of
ResolvedConstructrecords in the same order asrevision.constructs.- Raises:
RegistrySnapshotError – if any construct or its member references are missing from the revision.
- resolve_construct(revision, construct_id)[source]¶
Resolve a single named construct group from a revision.
Looks up
construct_idinrevision.constructs, then iterates every member collection declared on the construct (casillas, formulas, parameters, bindings, and the remaining entity kinds in_CONSTRUCT_MEMBER_INDEXES) to build the typedResolvedConstructMemberlist. Each member id is looked up in a pre-built revision index; an unknown id raisesRegistrySnapshotErrorimmediately.- Parameters:
revision (
ModeloRevision) – TheModeloRevisionto resolve against.construct_id (
str) – The registry-declared id of the construct group to resolve.
- Return type:
- Returns:
A
ResolvedConstructcarrying all members with their typed values.- Raises:
RegistrySnapshotError – if
construct_idis not declared on the revision, or if any member id does not exist in the corresponding revision collection.