cadrumo.application.overview._calendar_evidence_sources module

Source-specific reconciliation for calendar filing evidence.

These adapters project already-loaded local, filed-declaration, calculation, and justificante-capture observations. The calendar evidence facade owns precedence, merging, and event enrichment; this module owns source-shape validation and evidence-row construction.

justificantes_by_csv(justificantes)[source]

Index loaded justificante metadata by CSV/reference identifier.

Return type:

dict[str, tuple[Justificante, ...]]

Parameters:

justificantes (tuple[Justificante, ...])

justificante_csv_key(csv)[source]

Return the canonical lookup key for AEAT CSV identifiers.

Delegates to the one comparison form rather than restating it. This site previously casefolded, which produced a lowercase key that the canonical uppercase contract refuses – so one identifier had two keys depending on which surface built it.

Return type:

str

Parameters:

csv (str)

filing_evidence_from_modelo_record(record, *, justificantes_by_csv, expected_tax_id)[source]

Project one local Modelo filing record into calendar evidence.

Core types: ModeloRecord.

Return type:

OverviewCalendarFilingEvidence | None

Parameters:
filing_axes_from_modelo_record(record, *, justificantes_by_csv, expected_tax_id)[source]

Return the local and AEAT filing axes for one Modelo filing record.

Core types: ModeloRecord.

Return type:

OverviewCalendarFilingEvidence

Parameters:
filing_evidence_from_observed_event(event, *, expected_tax_id)[source]

Project an active filing event into AEAT-side obligation evidence.

Return type:

OverviewCalendarFilingEvidence | None

Parameters:
authenticated_identity_matches_expected(authenticated_identity, expected_tax_id)[source]
Return type:

bool

Parameters:
  • authenticated_identity (str | None)

  • expected_tax_id (str | None)

filing_evidence_from_filed_declaration_observation(observation, *, expected_tax_id, verified_artefact_refs, verified_artefact_csv_by_ref)[source]

Project one captured filed-declaration observation into evidence.

The observation must belong to the expected authenticated identity and must be an active ALTA register row. Justificante verification is granted only when the storage layer has already verified and supplied the encrypted justificante artefact reference and CSV.

Return type:

OverviewCalendarFilingEvidence | None

Parameters:
is_active_aeat_filing_status(status)[source]

Return whether an AEAT register row represents the current accepted filing.

Return type:

bool

Parameters:

status (str | None)

filing_evidence_from_calculation_observation(payload, *, expected_tax_id, justificantes_by_csv)[source]

Project official calculation observations into AEAT-submitted evidence.

Only official AEAT source kinds with active register metadata are accepted. A matching loaded Justificante upgrades the row to OverviewAeatSubmissionState.JUSTIFICANTE_VERIFIED; otherwise the row remains submitted-observed evidence.

Return type:

OverviewCalendarFilingEvidence | None

Parameters:
filing_evidence_from_justificante_capture_snapshot(snapshot, *, justificantes_by_csv, expected_tax_id)[source]

Project one verified live justificante capture into AEAT-side evidence.

The persisted snapshot is accepted only when it is active, carries a typed Period, and resolves to loaded Justificante metadata for the same filing target.

Return type:

OverviewCalendarFilingEvidence | None

Parameters: