aeat.application.overview._data_prep module¶
Data-prep walkthrough: ordered readiness checklist for one (modelo, period).
build_data_prep_walkthrough() is the application service backing
aeat app overview prepare --modelo MODELO --year YEAR --period PERIOD. It
walks the operator through the data-preparation phase that precedes a modelo
calculation - import transactions, classify them, attach purchase-invoice
evidence, register business invoices, resolve ledger readiness gaps, then start
or resume a modelo work unit - showing each step’s current state against the
active profile bucket and the exact next command to run.
The builder is READ-ONLY: it inspects the transaction catalogue, the invoice
catalogue, the purchase-invoice evidence store, the ledger preflight report,
and the modelo work-unit catalogue for the requested (modelo, filing_year,
period) scope. It persists nothing and never contacts AEAT. Every counter it
reports is already produced by an existing read model
(preflight_ledger_tax_readiness(),
list_work_units()) or a direct repository read;
this module composes them into one ordered checklist rather than introducing a
new aggregation.
See also
overviewSibling read-only overview builders (
status,calendar,agenda,backlog,explain) this module follows the same shape as.ledgerOwns
preflight_ledger_tax_readiness(), the classification/category/IVA-fact readiness gate this walkthrough’s “classify” step reuses rather than re-deriving.WorkUnitThe modelo work-unit record the final step resolves against.
- class DataPrepStepState(*values)[source]¶
Bases:
StrEnumClosed lifecycle state for one data-prep walkthrough step.
- Variables:
DONE – The step’s readiness condition is fully satisfied for the requested scope.
IN_PROGRESS – Some but not all of the step’s underlying facts are present (e.g. some transactions classified, others not).
PENDING – The step has not been started for the requested scope.
BLOCKED – The step cannot proceed because an upstream capability the step depends on is not yet available in this application.
- DONE¶
- IN_PROGRESS¶
- PENDING¶
- BLOCKED¶
- class DataPrepStepId(*values)[source]¶
Bases:
StrEnumClosed identifier for one ordered data-prep walkthrough step.
- IMPORT_TRANSACTIONS¶
- CLASSIFY_TRANSACTIONS¶
- ATTACH_EVIDENCE¶
- REGISTER_INVOICES¶
- RESOLVE_READINESS¶
- START_MODELO_WORK¶
- class DataPrepStep(**data)[source]¶
Bases:
BaseModelOne ordered row in the data-prep walkthrough.
- Variables:
step_id – Closed
DataPrepStepIdfor this row.state – Current
DataPrepStepStateagainst the active profile bucket and the requested scope.summary – Human-readable progress counter (e.g. “247 transactions ingested”, “14 unclassified”).
next_command – The exact next
aeatcommand to run to advance this step, or resolve its current gap. Always populated so the operator (human or autonomous agent) never has to guess.
- Parameters:
step_id (DataPrepStepId)
state (DataPrepStepState)
summary (str)
next_command (str)
- step_id: DataPrepStepId¶
- state: DataPrepStepState¶
- summary: str¶
- next_command: str¶
- class DataPrepWalkthrough(**data)[source]¶
Bases:
BaseModelOutcome of
build_data_prep_walkthrough().- Variables:
modelo – Registry-validated AEAT modelo code the walkthrough targets.
filing_year – Filing year for the requested scope.
period – Registry period token for the requested scope (e.g.
1T).steps – Ordered
DataPrepSteprows; step 1 is alwaysimport_transactions, the final step is alwaysstart_modelo_work.ready_for_calculation –
Trueonly when every step isDONE.
- Parameters:
- modelo: str¶
- filing_year: int¶
- period: str¶
- steps: tuple[DataPrepStep, ...]¶
- ready_for_calculation: bool¶
- build_data_prep_walkthrough(*, bucket_id, modelo, period, transaction_repository, invoice_catalogue, evidence_records, preflight_report, work_units)[source]¶
Build the ordered data-prep checklist for one (modelo, period) scope.
- Parameters:
bucket_id (
str) – Active profile bucket the walkthrough is scoped to.modelo (
str) – Registry-validated AEAT modelo code (already resolved by the caller through the registry describe surface).period (
Period) – Typed filingPeriodfor the requested scope.transaction_repository (
TransactionCatalogueRepositoryProtocol) – BoundTransactionCatalogueRepositoryProtocolforbucket_id.invoice_catalogue (
InvoiceCatalogue) – LoadedInvoiceCatalogueforbucket_id.evidence_records (
tuple[PurchaseInvoiceEvidence,...]) – Loaded purchase-invoice evidence rows (tuple[PurchaseInvoiceEvidence, ...]) forbucket_id.preflight_report (
LedgerPreflightReport) – LoadedLedgerPreflightReportfor(bucket_id, period).work_units (
tuple[WorkUnit,...]) – Active (non-discarded)WorkUnitrows forbucket_id.
- Return type:
- Returns:
A
DataPrepWalkthroughwith one ordered step per data-prep phase and the exact next command for each.