aeat.adapters.inbound.pdf._shared module¶
Shared strict+frozen records for casilla-bearing PDF imports.
ExtractedCasilla is the boundary-crossing record produced by
declaracion and borrador extractors after they find a printed casilla value.
It pairs the stable casilla identifier with the typed value and extraction
provenance (page, optional bounding box, confidence) so downstream consumers
can classify discrepancies and attach warnings without re-parsing the PDF.
Justificante PDFs do not carry per-casilla values; that receipt surface shares the package’s error and text/provenance helpers, but not this record.
- class ExtractedCasilla(**data)[source]¶
Bases:
BaseModelOne casilla ID + printed value extracted from a filing PDF.
- Variables:
casilla_id – Stable casilla identifier (e.g.
"01","071"). Aligned to the canonicalCasillaIdconstraint (max_length=64, pattern[A-Za-z0-9][A-Za-z0-9._:-]*).printed_value – Typed value as printed on the PDF.
Nonewhen the casilla was located but blank on the page. Monetary values are parsed intodecimal.Decimal; non-monetary casillas may retain typed integers, strings, booleans, or dates.source_page – 1-based page number the value was read from.
source_bbox – Optional
(x0, y0, x1, y1)bounding box in pdfplumber coordinates. Populated by the bbox-anchored extraction primitive;Nonefor label-regex / AcroForm extractions where coordinates are not captured.extraction_confidence – Float in
[0.0, 1.0].1.0for AcroForm + unambiguous label-regex hits; lower when the extractor fell back to bbox-anchored recovery or had to disambiguate competing label candidates.
- Parameters:
- casilla_id: CasillaId¶
- printed_value: Decimal | int | str | bool | date | None¶
- source_page: int¶
- source_bbox: tuple[float, float, float, float] | None¶
- extraction_confidence: float¶