cadrumo.application.aggregation.evidence_advisory module

Evidence-presence diagnostics for IVA-bearing ledger rows.

The diagnostics pair a transaction’s IVA settlement side with its evidence presence: a positive deductible input-IVA row must carry supplier evidence, while a positive output-IVA row without a linked document remains visible to the operator. This is the ledger-evidence counterpart of the calculate-path unconsumed-declarable-IVA advisory and follows the no-silent-under-declaration discipline: never let a missing-evidence row pass in silence, and let the filing-grade verification layer decide which legally grounded side blocks.

What counts as evidence differs by side, and the difference is statutory rather than a severity preference. LIVA art. 97 is enumerative — “únicamente se considerarán documentos justificativos del derecho a la deducción” followed by a closed list — so only the purchase-invoice evidence axis or a linked, validated reconciliation-catalogue invoice silences the deductible side. The output side has no equivalent constitutive requirement and no CLI path that mints issued-invoice evidence, so any linked document silences it. Holding the deductible side to the looser test would leave the blocking gate laxer than the statute it cites.

The trigger set is deliberately narrow. A diagnostic fires only on an ACTIVE business/mixed row with a strictly-positive IVA quota that lacks the evidence its side requires. Explicit exempt / zero-rated / not-subject IVA categories and non-declarable sentinels are excluded because they do not route an M303 quota. Rows with no explicit iva_category but with a positive iva_amount remain in scope: the IVA aggregation layer derives their domestic category from the stored rate and bank direction before feeding M303.

MISSING_DEDUCTIBLE_IVA_EVIDENCE_SOURCE_KIND

Diagnostic source_kind for missing supplier evidence on positive deductible input IVA. Verification treats this as filing-grade blocking.

MISSING_OUTPUT_IVA_EVIDENCE_SOURCE_KIND

Diagnostic source_kind for missing linked evidence on positive output IVA. The current transaction model cannot yet distinguish all valid issued-invoice evidence paths, so verification keeps this visible but non-blocking.

missing_evidence_advisory_observations(transactions)[source]

Return missing-evidence diagnostics for positive IVA rows.

A CalculationSourceDiagnostic (reason missing_transaction_evidence) is emitted for each ACTIVE business/mixed row with a strictly-positive IVA quota that lacks the evidence its settlement side requires:

  • a deductible input-IVA row carrying no purchase-invoice evidence and no linked, validated reconciliation-catalogue invoice. A generic attachment does NOT satisfy this side: LIVA art. 97 enumerates the documents that establish the right to deduct and an attachment is not among them. This diagnostic blocks verification downstream.

  • an output-IVA row whose IVA category is legally expected to bear a devengada cuota — i.e. not in the published 0084 evidence-exempt projection — carrying no linked evidence of any kind (the issued-invoice evidence gap remains visible but advisory).

Rows that legitimately bear no evidence requirement — non-business / personal, exempt / zero-rated / not-subject / sentinel IVA categories, no positive IVA quota, and non-ACTIVE lifecycle states — are excluded and never fire.

Parameters:

transactions (Iterable[Transaction]) – The revision’s source transactions to inspect.

Return type:

tuple[CalculationSourceDiagnostic, ...]

Returns:

A tuple of non-blocking missing-evidence diagnostics, in input order.