aeat.adapters.inbound.borrador._parser module

Public parse_borrador() entry point for Modelo 100 PDFs.

Composes the artefact-kind detector (detect_artefact_kind()) with the per-año extractor registry (adapters.inbound.borrador._extractors) into the single function callers should depend on. The parser does not infer the tax year from the PDF today; callers that need a non-default year must pass año_override explicitly.

Unlike the declaración parser, this adapter does not resolve registry snapshots. The default parse mode returns observed PDF rows. Registry-profile validation is available only when the caller supplies a BorradorExtractionProfile projection explicitly.

parse_borrador(pdf_path, *, artefact_kind_override=None, año_override=None, extraction_profile=None, parse_mode=BorradorParseMode.OBSERVED)[source]

Parse an observed AEAT Modelo 100 artefact PDF.

Parameters:
  • pdf_path (Path) – Path to the borrador / predeclaración / declaración PDF.

  • artefact_kind_override (ArtefactKind | None) – Skip auto-detection and force the ArtefactKind.

  • año_override (int | None) – Select the year-keyed extractor explicitly. When omitted, the parser uses the current default extractor year (2025).

  • extraction_profile (BorradorExtractionProfile | None) – Optional caller-supplied registry extraction-profile projection. When provided, parsing filters to the profile’s target casillas and fails when coverage is below the profile minimum.

  • parse_mode (BorradorParseMode) – OBSERVED returns observed PDF rows. REGISTRY_PROFILE requires extraction_profile and validates coverage.

Return type:

InboundBorradorObservation

Returns:

A strict InboundBorradorObservation with observed casilla rows extracted.

Raises:

BorradorParseError – When the PDF has no recognisable VISTA PREVIA / BORRADOR / CSV marker and artefact_kind_override is not supplied, or for other parse errors (PDF not found, empty text, missing header fields, missing registry profile in REGISTRY_PROFILE mode, or coverage below the supplied profile minimum).