aeat.application.modelo._local_observation_actions module

Operator-supplied local filed observations for calculation prefill.

This module records local, non-official observations in the existing cross-period calculation observation store. It deliberately does not create a ModeloRecord and does not stamp ExternalEvidence: the values are operator-supplied scratch/local inputs that can feed relation and previous_filing calculation prefill, but they must never satisfy the filing-grade clean-state proof that requires AEAT-backed evidence.

Each persisted observation is grounded against the law-determined RegistrySnapshot and stored as provenance-bearing CasillaObservation rows, while the source kind stays explicitly non-official.

See also

persist_filed_revision_observation():

Local-filing projection that uses app_filing rather than operator-manual source.

_cross_period_clean_state:

Classifies local observations as non-official for filing-grade readiness.

OPERATOR_MANUAL_OBSERVATION_SOURCE_KIND: Final

Non-official source kind for operator-supplied local observations.

class ModeloLocalObservationResult(**data)[source]

Bases: BaseModel

Result of recording one operator-supplied local observation.

Parameters:
modelo: str
filing_year: int
period: Period
revision_id: str
observation_key: str
source_kind: str
casilla_values: dict[CasillaId, Decimal]
captured_at: datetime
captured_by: str
official_evidence: bool
filing_record_created: bool
aeat_accepted: bool
record_operator_local_observation(*, modelo, filing_year, period, casilla_values, actor='operator-manual', repository=None, clock=None)[source]

Persist an operator-supplied local observation for later calculation prefill.

The observation is grounded against the law-determined RegistrySnapshot for modelo / filing_year / period. Every supplied casilla id must be a canonical numeric casilla declared by that snapshot; printed-number aliases and unknown ids are refused before the observation store is touched.

The persisted row uses source_kind="operator_manual" and carries the snapshot revision id as its stamp. Calculation prefill can then resolve the CasillaObservation values, while cross-period clean-state verification still treats it as non-official local evidence.

Return type:

ModeloLocalObservationResult

Returns:

A ModeloLocalObservationResult describing the persisted local observation stamp.

Parameters: