cadrumo.application.aggregation.irnr_income_ledger module

Repository-backed IRNR income ledger mechanics.

The module retains transaction filtering, classification folding, period partitioning, and typed issue/provenance mechanics. Target coordinates, income-type namespaces, model applicability, source-scope membership, and binding/legal declarations belong to the selected registry revision and are read at the registry seam below.

No target, parameter prefix, applicability set, or binding identifier is declared as a Python fallback.

class IrnrIncomeLedgerAggregationIssueReason(*values)[source]

Bases: StrEnum

Machine-readable reasons why a row did not reach the M210 gross-income fact.

OUTSIDE_PERIOD
UNSUPPORTED_PERIOD
FOREIGN_SOURCE_OUT_OF_SCOPE
SOURCE_JURISDICTION_UNRESOLVED
INCOMPLETE_M210_CLASSIFICATION
class IrnrIncomeLedgerAggregationIssue(**data)[source]

Bases: BaseModel

Traceable exclusion emitted while resolving the M210 ledger projection.

Parameters:

data (Any)

model_config: ClassVar[ConfigDict]

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

transaction_id: TransactionId
reason: IrnrIncomeLedgerAggregationIssueReason
detail: IssueDetail
rejected_source_jurisdiction: str | None
class IrnrIncomeObservation(**data)[source]

Bases: BaseModel

One selected, ES-source, explicitly M210-classified income observation.

Parameters:

data (Any)

model_config: ClassVar[ConfigDict]

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

transaction_id: TransactionId
target_casilla_id: CasillaId
official_tipo_renta_code: str
gross_income_amount: Decimal
applicable_rate: UnitProportion
payer_mode: M210PayerMode
payer_id: str | None
asset_or_right_id: str | None
filing_date: date
source_jurisdiction: CountryCodeAlpha2
class IrnrIncomeLedgerAggregation(**data)[source]

Bases: LedgerAggregationResultBase[IrnrIncomeObservation, IrnrIncomeLedgerAggregationIssue]

Selected-code M210 observations for one filing period.

Parameters:
selected_official_tipo_renta_code: str
out_of_window_summary: OutOfWindowTransactionSummary | None
model_config: ClassVar[ConfigDict]

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

aggregate_irnr_income_ledger_from_repositories(*, bucket_id, period, revision, modelo, target_casilla_id, selected_official_tipo_renta_code, transaction_repository, operation=None)[source]

Load an injected secure transaction catalogue and aggregate one selected M210 code.

revision is the ModeloRevision that declares the binding. transaction_repository is the composition-root-owned TransactionCatalogueRepositoryProtocol for bucket_id.

The repository date partition limits decryption/classification to the filing span and returns a compact, provenance-free summary for the other dates. Full-catalogue callers retain the per-row OUTSIDE_PERIOD issues instead.

Return type:

IrnrIncomeLedgerAggregation

Parameters:
aggregate_irnr_income_ledger(transactions, *, bucket_id, period, revision, modelo, target_casilla_id, selected_official_tipo_renta_code, operation=None)[source]

Aggregate selected-code, incoming, registry-admitted IRNR income.

transactions is the TransactionCatalogue to aggregate. revision is the ModeloRevision that declares the binding. modelo and target_casilla_id are selected-revision coordinates; neither has a Python fallback.

The classification’s gross_income_amount is the declared M210 fact; it is intentionally not derived from the signed raw ledger amount. This preserves explicit operator evidence for deductions, partial rights, and the official code while leaving registry formula evaluation as the one arithmetic path after the gross-income binding has been resolved.

Return type:

IrnrIncomeLedgerAggregation

Parameters: