aeat.domain.transactions package

Public facade for immutable ledger transactions.

This package re-exports the transaction domain boundary used by ledger: Transaction wraps an upstream RawTransaction and its RawProvenance, while TransactionCatalogue keeps the immutable mapping keyed by the content-derived transaction id. Import helpers such as derive_transaction_id(), derive_import_fingerprint(), and normalise_movement_reference() are the public identity helpers.

The row model separates amount magnitude from TransactionDirection; downstream tax calculations route by direction rather than by signed amounts. It carries classification, tax substrate, evidence, split, edit, lifecycle, FX, jurisdiction, and timestamp provenance through typed records such as ClassificationHistoryEntry, TransactionEvidenceProvenanceEntry, TransactionEditLineageEntry, and TransactionLifecycleLineageEntry. Classification helpers set_classification(), snapshot_classification_state(), and link_invoice() return fresh catalogues instead of mutating callers’ instances.

Persistence is served by the read-side TransactionCatalogueRepositoryProtocol port; the concrete encrypted implementation lives in the persistence adapter TransactionCatalogueRepository. It stores each transaction under the bucket-scoped transaction namespace as FINANCIAL SensitivityClass rows wrapped in Envelope through SecureObjectRepository; callers should not write plaintext catalogues or reach into private modules. The pure port surface (ImportSummary, the key-derivation helpers, and the namespace constant) remains exposed lazily here.

LLM-facing LLMClassifier, LLMSplitProposer, PromptSpec, LedgerClassificationRule, and ledger_irpf_category_catalogue() also live behind this facade. They constrain model choices to typed BusinessClassification, CategoryChoice, and IvaCategoryChoice allow-lists; regulated tax numbers are derived by application services, not originated by this package.

Downstream modelo calculation records keep only forward transaction ids on CalculationRevision. Aggregation services consume this catalogue to produce registry binding values and ledger filing snapshots, while TransactionRevisionParticipationIndex provides the rebuildable inverse audit lookup from one ledger transaction to finalized revisions and filing records.

See also

ledger

Operator-facing lifecycle that creates, edits, classifies, splits, attaches evidence, and preflights bucket-scoped transactions.

aggregation

Source resolvers that turn transaction catalogues into CalculationSourceResolution payloads for modelo calculation.

compute_ledger_filing_snapshot()

Captures tax-relevant transaction fields for finalized calculation revisions.

invoices

Invoice catalogue and reconciliation records referenced by invoice_id and purchase_invoice_evidence_id.

usage_ratios

Proportionality profiles referenced by ledger rows before aggregation.

2026-06-10-ledger-amount-direction-adr

Decision making amount magnitude absolute and direction authoritative.

2026-06-10-ledger-modelo-crossref-adr

Decision for the rebuildable transaction participation index.

Submodules