aeat.application.modelo._participation_index_rebuild module¶
Rebuild the transaction participation index from the revision catalogue.
The participation index is a derived, read-side cache co-written atomically with
revision persistence; the calculation-revision catalogue is the authoritative
source of truth. This module regenerates the index from scratch by iterating the
full finalized-revision catalogue, so a stale or corrupt index can be replaced
without data loss, in line with the
ledger-participation-index-is-derived-rebuildable project rule.
The rebuild reads the CalculationRevisionCatalogue (the finalized
revisions and their source_transaction_ids), the work-unit catalogue (for the
modelo / filing_year / period axis per revision), and the
ModeloRecordCatalogue / ModeloRecord rows (to attach the
filing_record_id and any justificante reference to filed participations).
Borrador and discarded revisions are excluded — the index records only the
finalized audit surface.
See also
TransactionRevisionParticipationIndex:Per-transaction secure object rebuilt by this module.
aeat.application.modelo._verification_actions._build_participation_writes():Write-time co-emission path that keeps the index current during verification persistence.
- class ParticipationRebuildStats(**data)[source]¶
Bases:
BaseModelOutcome of one participation-index rebuild pass.
- Variables:
transaction_count – Number of distinct ledger transactions that gained at least one participation entry.
participation_count – Total number of (transaction, finalized-revision) participation entries written across all transactions.
revision_count – Number of finalized revisions folded into the index.
- Parameters:
- transaction_count: int¶
- participation_count: int¶
- revision_count: int¶
- rebuild_participation_index(*, bucket_id=None, calculation_repository=None, work_unit_repository=None, filing_repository=None, participation_index_repository=None)[source]¶
Regenerate the participation index from the finalized-revision catalogue.
Iterates every finalized
CalculationRevision, resolves itsmodelo/filing_year/periodfrom the work-unit catalogue and itsfiling_record_idfrom the filing-record catalogue, and writes oneTransactionRevisionParticipationIndexper contributing transaction. Borrador and discarded revisions are excluded. Returns aParticipationRebuildStatssummary.- Return type:
- Parameters:
bucket_id (str | None)
calculation_repository (CalculationRevisionCatalogueRepositoryProtocol | None)
work_unit_repository (WorkUnitCatalogueRepositoryProtocol | None)
filing_repository (ModeloRecordCatalogueRepositoryProtocol | None)
participation_index_repository (TransactionParticipationIndexRepository | None)