aeat.domain.modelos package

Public facade for modelo filing domain records and repository boundaries.

The public surface exposes ModeloCode, WorkUnit, CalculationRevision, ModeloRecord, VerificationReport, their in-memory catalogues, encrypted repository boundaries, repository protocols, row DTOs, derivation and upsert helpers, ExternalEvidence, and WorkUnitId. ModeloCode validates identifier shape only; filing availability and revision targeting are resolved through registry-aware flows anchored on domain.calculations.registry.ModeloRevision.

These records are the domain aggregate carried by application.modelo: a WorkUnit fixes the bucket/modelo/year/period/registry-revision target and carries current/filed pointers, while a CalculationRevision is content-addressed, stateful, source-transaction aware, and records domain.calculations.registry.CasillaObservation values plus ModeloDetailRow rows. A ModeloRecord is the durable filing-record receipt paired with a filed revision. Local filing writes keep aeat_accepted=False and no ExternalEvidence; only the external import path may stamp AEAT-attested evidence, validated against domain.justificante.Justificante metadata for receipt-bound evidence kinds, and turn that record into an amendment baseline.

The package also owns the transaction participation index. A TransactionRevisionParticipationIndex is a rebuildable read-side cache keyed by ledger transaction id; verified and filed writes co-emit TransactionRevisionParticipation entries, and the index can be rebuilt from the calculation-revision, work-unit, and filing-record catalogues. The live catalogues remain the source of truth.

Informational-declaration row models also live here: Modelo184MemberRow, Modelo232VinculadaRow, Modelo347ContraparteRow, Modelo349OperadorRow, Modelo349RectificacionRow, and ModeloDetailRow, plus the Modelo 349 NIF and country-prefix validators exposed by this root facade. Regulatory constants such as the Modelo 347 declarability threshold remain in core.external_constants.

See also

application.modelo

Application facade that creates, calculates, verifies, files, exports, reconciles, and rebuilds this aggregate.

CalculationRevision

Immutable calculation attempt with lifecycle state, source transaction ids, typed casilla observations, and content-addressed identity.

ModeloRecord

Filing event record paired with the filed calculation revision.

ExternalEvidence

Official evidence metadata carried only by imported AEAT-attested filing records.

application.modelo.file_modelo_revision()

Application service that records a verified revision as local/internal filed state without AEAT acceptance.

application.modelo.import_external_filing_evidence()

Application service that imports AEAT-attested evidence into a current filing record.

application.modelo.amend_modelo_revision()

Application service that consumes an externally evidenced current filing record as the amendment baseline.

domain.justificante

Receipt metadata domain referenced by justificante PDF, CSV-register, and live-capture evidence kinds.

TransactionRevisionParticipationIndex

Rebuildable inverse index from ledger transaction ids to finalized calculation revisions and filing records.

domain.calculations.registry

Registry snapshots, formulas, bindings, and observation types that produce the calculation payload stored on a revision.

Submodules