aeat.adapters.inbound.borrador._detect module

Artefact-kind detection for observed Modelo 100 PDFs.

This module classifies the printed text extracted from a Renta borrador, predeclaración, or declaración PDF into an ArtefactKind. It is a local adapter helper: it reads PDF text through adapters.inbound.borrador._parsers.extract_pages_text(), applies the documented marker precedence ladder, and returns the artefact kind consumed by parse_borrador().

detect_artefact_kind(pdf_path)[source]

Return the detected Modelo 100 artefact kind for pdf_path.

Precedence when markers overlap is PREDECLARACION > DECLARACION > BORRADOR. The VISTA PREVIA watermark is the strongest signal of non-binding status; the CSV stamp trumps the BORRADOR header because a filed declaración always ships with a CSV.

Parameters:

pdf_path (Path) – Path to the Modelo 100 PDF to inspect.

Return type:

ArtefactKind

Returns:

The detected ArtefactKind.

Raises:

ArtefactNotRecognisedError – When none of the three markers (VISTA PREVIA watermark, BORRADOR header, CSV stamp) match.