aeat.adapters.inbound.borrador._schema module¶
Strict pydantic v2 records for the Renta / Modelo 100 parser.
Defines the inbound data shapes that the borrador pipeline produces. These
records are observed-data contracts; registry authority stays with callers that
project a profile into BorradorExtractionProfile.
ArtefactKind— three Modelo 100 PDF flavours.BorradorParseMode— observed rows versus caller-supplied registry-profile validation.BorradorExtractionProfile— lightweight protocol projected by the caller from registry metadata when completeness checks are required.InboundBorradorObservation— parsed observed record with printed casillas, source provenance and per-casilla advisory warnings.
- class ArtefactKind(*values)[source]¶
Bases:
StrEnumThe three Modelo 100 PDF artefact types the operator encounters.
- Variables:
BORRADOR – Pre-filing draft from Portal Renta; carries casillas but no CSV.
PREDECLARACION – Simulación (Renta Web Open) watermarked
VISTA PREVIA; carries no CSV.DECLARACION – Post-filing copy with an AEAT CSV stamp.
- BORRADOR¶
- PREDECLARACION¶
- DECLARACION¶
- class BorradorParseMode(*values)[source]¶
Bases:
StrEnumParser authority mode requested by the caller.
- Variables:
OBSERVED – Return the casilla rows printed in the PDF without minimum coverage enforcement.
REGISTRY_PROFILE – Require a caller-supplied
BorradorExtractionProfile, filter to its target casillas, and enforce its minimum coverage without consulting a registry snapshot inside the adapter.
- OBSERVED¶
- REGISTRY_PROFILE¶
- class BorradorExtractionTarget(*args, **kwargs)[source]¶
Bases:
ProtocolPer-target descriptor surface the parser reads from a profile.
This protocol is intentionally narrow so callers can project registry targets without making the inbound adapter depend on registry internals. Only the stable casilla identifier is needed by the observed-value filter.
- property casilla_id: CasillaId¶
- class BorradorExtractionProfile(*args, **kwargs)[source]¶
Bases:
ProtocolRegistry extraction-profile surface consumed by the parser.
The parser consumes this structural protocol only when
BorradorParseMode.REGISTRY_PROFILEis requested. It is supplied by the caller; the inbound adapter does not look upRegistrySnapshotdata itself.- property target_casillas: tuple[BorradorExtractionTarget, ...]¶
- class InboundBorradorObservation(**data)[source]¶
Bases:
BaseModelObserved Modelo 100 PDF data.
Strict, frozen pydantic record produced by
adapters.inbound.borrador.parse_borrador().- Variables:
modelo – Always
"100"for this record.ejercicio – Four-digit tax year.
tax_id – NIF / NIE of the filer.
artefact_kind – Which of the three PDF types was detected.
values – Tuple of
ExtractedCasillarecords observed in the PDF.registry_extraction_profile_id – Registry extraction profile applied to this parse, when the caller requested coverage validation.
extraction_coverage – Observed target-casilla coverage when a registry extraction profile was supplied.
source_pdf_path – Privacy-preserving
.secure-source/<sha256>.pdfreference derived from the parsed PDF digest.source_pdf_sha256 – Lowercase hex SHA-256 of source bytes.
parsed_at – UTC timestamp at parse completion.
csv – AEAT CSV if the artefact is a
DECLARACION;Nonefor borrador / predeclaración.warnings – Per-casilla advisory messages emitted by the extractor (for example
"casilla 0622: value 'unparseable' is not a number").
- Parameters:
- modelo: Literal[Modelo.M100]¶
- ejercicio: str¶
- tax_id: str¶
- artefact_kind: ArtefactKind¶
- values: tuple[ExtractedCasilla, ...]¶
- registry_extraction_profile_id: str | None¶
- extraction_coverage: Decimal | None¶
- source_pdf_path: Path¶
- source_pdf_sha256: str¶
- parsed_at: datetime¶
- csv: str | None¶
- warnings: tuple[str, ...]¶