aeat.domain.calculations.registry._schema_extraction module¶
Extraction-profile schema contracts for registry revisions.
These RegistryModel
definitions describe how a registry revision maps declaration PDFs, submitted
files, justificantes, and official workbooks into target casillas. The contract
records parser identity, accepted artefact kind, match strategy, confidence,
coverage, legal grounding, source grounding, and the explicit specimen /
round-trip flags that prevent silent provisional extraction.
The schema remains declarative authority only: it does not import parser
adapters, read artefacts, or run extraction. Registry validation checks local
reference closure and evidence sufficiency before
RegistrySnapshot exposes the profiles to
application and adapter consumers.
See also
ModeloRevisionRevision record that owns committed extraction-profile rows.
RegistrySnapshotValidated filing-context view that exposes extraction profiles by id.
validate_extraction_profile_section()Record-section validator that checks casilla, export-field, legal, and source closure for each profile.
_validate_extraction_profilesArtefact-kind, dotted-parser, bbox-anchor, specimen, and round-trip validator helpers for these contracts.
CasillaDefinitionTarget casilla metadata each extraction target must reference.
LegalReferenceLegal evidence rows cited through
legal_refs.SourceReferenceSource evidence rows cited through
source_refs.
- class BboxAnchorSpec(**data)[source]¶
Bases:
RegistryModelSpatial anchor configuration for the
bbox_anchoredextraction strategy.- Parameters:
- box_number_pattern: str¶
- value_offset: Literal['left_of_number', 'above_number', 'right_of_number']¶
- anchor_x_min: float | None¶
- anchor_x_max: float | None¶
- value_x_max: float | None¶
- column_anchor: str | None¶
- class ExtractionTargetDefinition(**data)[source]¶
Bases:
RegistryModelPer-target descriptor for a registry extraction profile.
- Parameters:
casilla_id (CasillaId)
match_strategy (Literal['numeric_casilla', 'named_label', 'bbox_anchored'])
value_kind (Literal['amount', 'text', 'enum'])
label_pattern (str | None)
bbox_anchor (BboxAnchorSpec | None)
- casilla_id: CasillaId¶
- match_strategy: Literal['numeric_casilla', 'named_label', 'bbox_anchored']¶
- value_kind: Literal['amount', 'text', 'enum']¶
- label_pattern: str | None¶
- bbox_anchor: BboxAnchorSpec | None¶
- class ExtractionProfileDefinition(**data)[source]¶
Bases:
RegistryModelRegistry extraction profile for declaration/borrador/workbook artefacts.
- Parameters:
id (ExtractionProfileId)
surface (Literal['borrador_pdf', 'declaracion_pdf', 'justificante_pdf', 'export_record', 'official_workbook'])
artefact_kind (str)
accepted_artefact_kinds (tuple[Literal['submitted_file', 'declaration_pdf', 'justificante_pdf', 'official_workbook'], ...])
parser (str)
target_casillas (tuple[ExtractionTargetDefinition, ...])
confidence (Literal['strict', 'review_required'])
provisional_pending_specimen (bool)
corpus_round_trip_verified (bool)
verification_source (Literal['real_aeat_corpus_pdf', 'synthetic_from_aeat_published_text', 'historical_suppression', 'not_applicable'] | None)
min_coverage (Annotated[Decimal, BeforeValidator(func=~aeat.domain.calculations.registry._schema_scalars._coerce_decimal, json_schema_input_type=PydanticUndefined)])
failure_semantics (Literal['fail_hard'])
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)])])
- id: ExtractionProfileId¶
- surface: Literal['borrador_pdf', 'declaracion_pdf', 'justificante_pdf', 'export_record', 'official_workbook']¶
- artefact_kind: str¶
- accepted_artefact_kinds: tuple[Literal['submitted_file', 'declaration_pdf', 'justificante_pdf', 'official_workbook'], ...]¶
- parser: str¶
- target_casillas: tuple[ExtractionTargetDefinition, ...]¶
- confidence: Literal['strict', 'review_required']¶
- provisional_pending_specimen: bool¶
- corpus_round_trip_verified: bool¶
- verification_source: Literal['real_aeat_corpus_pdf', 'synthetic_from_aeat_published_text', 'historical_suppression', 'not_applicable'] | None¶
- min_coverage: DecimalValue¶
- failure_semantics: Literal['fail_hard']¶
- legal_refs: LegalRefs¶
- source_refs: SourceRefs¶