aeat.application.filing package

Public application facade for registry-backed filing drafts.

This package builds, reviews, approves, exports, verifies, imports, and summarises local filing artefacts. All draft creation and validation consume a RegistrySnapshot to resolve the active ModeloRevision, its casilla schema, relation inputs, and formula graph.

Major entry points:

The facade deliberately separates local filing state from live submission. Remote AEAT submission is not exposed here; attempted live writes are refused by LiveSubmitForbiddenError.

Imports from external PDFs stay evidence-scoped. A justificante import creates a local draft plus submission-audit baseline, while casilla-complete declaration and borrador parsing enter through the inbound adapter surfaces before application services decide how that evidence participates in a work-unit workflow.

Work-unit filing records for calculation revisions live in modelo and domain.modelos. This package owns draft-level construction, review, export, verification, justificante import, local amendment construction, and lightweight local history; it does not create ModeloRecord entries or stamp ExternalEvidence.

See also

modelo

Operator-facing modelo facade that carries calculation revisions into this filing surface.

file_modelo_revision()

Work-unit action that records a verified calculation revision as a current local ModeloRecord.

import_external_filing_evidence()

External-evidence import path that creates an evidenced ModeloRecord baseline for amendments.

domain.justificante

Receipt-metadata domain used by justificante PDF imports and receipt-bound external evidence.

domain.filing

Canonical draft records, values, provenance, validation findings, and review helpers.

domain.submission

Local-only submission audit records populated by justificante import; this is not an AEAT live-submit path.

domain.calculations.registry

Registry authority, snapshots, export layouts, and formula execution used by this application facade.

build_draft(*, modelo, period, profile, inputs, schema_provider, deadline_checker=None, fail_on_warning=False)[source]

Build and validate a filing draft from a registry snapshot.

Parameters:
Return type:

ModeloDraft

Returns:

A fully constructed and validated ModeloDraft.

Raises:

ModeloBuilderError – If the registry has no matching snapshot, inputs are malformed, or strict validation fails.

validate_draft(draft, *, bucket_id, schema_provider, deadline_checker=None)[source]

Re-run validation against an existing draft.

The returned draft preserves draft_id because the hash excludes findings, status, updated_at and notes.

Parameters:
Return type:

ModeloDraft

Returns:

A new ModeloDraft with refreshed findings, status and updated_at.

iter_findings(draft, *, severity_at_least='WARNING')[source]

Yield findings filtered by minimum severity.

Parameters:
  • draft (ModeloDraft) – The ModeloDraft to scan for validation findings.

  • severity_at_least (str) – Minimum severity to yield, one of "INFO", "WARNING", "ERROR". Defaults to "WARNING".

Yields:

Each ModeloValidationFinding whose severity meets or exceeds the threshold, in declaration order.

Raises:

ModeloCalculateError – When severity_at_least is not a known severity name ("INFO", "WARNING", or "ERROR").

Return type:

Iterator[ModeloValidationFinding]

Submodules