aeat.application.review._adapters module

Read-only source adapters for the unified review queue.

Each adapter loads pending items from one on-disk source and emits a tuple of typed ReviewItem records. Adapters are pure and stateless; they tolerate missing source files by returning an empty tuple. Severity is derived per source via a first-match-wins predicate table.

The transaction adapter loads a TransactionCatalogue via TransactionCatalogueRepository; the invoice adapter loads an InvoiceCatalogue via InvoiceCatalogueRepository. Draft findings are sourced from the ModeloDraft store via the review imports.

transactions_pending(settings, *, bucket_id, catalogue=None)[source]

Return one TransactionReviewItem per pending-review transaction.

catalogue is an optional TransactionCatalogue override; the repository is loaded when None.

Skips fully-classified rows (BUSINESS / PERSONAL / MIXED), rows explicitly skipped by rule (SKIPPED_BY_RULE), and rows the operator reviewed and deliberately excluded (REVIEWED_EXCLUDED) — those have a final disposition and do not want the operator’s attention.

Return type:

tuple[TransactionReviewItem, ...]

Parameters:
transactions_low_confidence(settings, *, bucket_id, threshold, catalogue=None)[source]

Return transactions whose decision confidence sits below a threshold.

Parameters:
  • settings (Settings) – Active application settings.

  • bucket_id (str) – Stable bucket identifier for the ledger to inspect.

  • threshold (Decimal) – Minimum acceptable confidence; transactions strictly below this value are included.

  • catalogue (TransactionCatalogue | None) – Optional TransactionCatalogue override; when None the catalogue is loaded from the encrypted store.

Return type:

tuple[TransactionReviewItem, ...]

Surfaces every transaction whose classification_confidence is non-None and strictly less than the threshold, regardless of classification state. Transactions with None confidence are excluded because they have no claim to filter against.

Each element in the returned tuple is a TransactionReviewItem.

invoices_pending(settings, *, bucket_id, catalogue=None)[source]

Return InvoiceReviewItem records for unmatched / disputed / pending invoices.

Parameters:
  • settings (Settings) – Active application settings.

  • bucket_id (str) – Stable bucket identifier for the invoice catalogue to inspect.

  • catalogue (InvoiceCatalogue | None) – Optional InvoiceCatalogue override; the repository is loaded when None.

Return type:

tuple[InvoiceReviewItem, ...]

drafts_pending(settings, *, bucket_id, drafts=None)[source]

Return FindingReviewItem records for findings + unready drafts.

Parameters:
  • settings (Settings) – Active application settings.

  • bucket_id (str) – Stable bucket identifier for the draft repository to inspect.

  • drafts (tuple[tuple[Path, ModeloDraft], ...] | None) – Optional pre-loaded sequence of (path, draft) pairs where each draft is a ModeloDraft; when None drafts are loaded from that bucket’s secure storage.

Return type:

tuple[FindingReviewItem, ...]

A draft whose profile_tax_id does not match the active profile’s tax id is not the active profile’s data and is skipped. Callers see only drafts owned by the active profile.