aeat.application.ledger._evidence_split module

Deterministic child-amount derivation for evidence-driven splits.

The model proposes per-child proportions (fractions); the system derives the per-child euro amounts in derive_child_amounts() so they sum EXACTLY to the parent gross to the cent (the remainder lands on the last child). The model never emits a euro amount (llm-selects-system-derives-tax-numbers). This bridges suggest_evidence_split() to split_transaction(), whose children must sum to the parent magnitude exactly.

derive_child_amounts(gross, proportions)[source]

Split gross into per-child amounts matching proportions.

Each amount is round_to_cents() applied to gross * proportion; the final child absorbs the rounding remainder so the amounts sum to gross exactly. Flow direction is inherited from the parent transaction outside this helper, never encoded in the amount sign.

Parameters:
  • gross (Decimal) – The parent transaction gross as a non-negative magnitude.

  • proportions (Sequence[Decimal]) – Per-child fractions (each in (0, 1], summing to ~1.0).

Return type:

tuple[Decimal, …]

A single proportion (1.0) is the “no split warranted” verdict and yields (gross,) — the whole amount on one child. The caller (suggest_evidence_split()) surfaces that verdict for review and never drives a one-way split through split_transaction(); apply_evidence_split() refuses a single-child suggestion.

Return type:

tuple[Decimal, ...]

Returns:

Per-child amounts, in child order, summing exactly to gross.

Raises:

ValueError – When no proportions are supplied or gross is negative.

Parameters: