cadrumo.application.aggregation.percepciones_observations_repository module¶
Application-owned capabilities for Modelo 190 percepciones observations.
The percepciones source stores one WithholdingObservation for every
(perceptor, clave, subclave) in a (modelo, filing_year, period) window.
The application owns the key grammar and the required read/write capability;
the encrypted persistence implementation is bound by an outer composition
root. Keeping this module free of storage imports makes the calculate mesh
usable with an inward fake and prevents persistence details from becoming an
implicit application dependency.
- percepcion_observation_key(modelo, filing_year, period, perceptor_tax_id, clave, subclave)[source]¶
Build the opaque per-perceptor-clave observation key.
The NIF is hashed because object keys are storage metadata.
claveandsubclaveremain explicit because they are non-identifying AEAT codes and distinguish the separate registro-tipo-2 observations.
- exception PercepcionObservationPersistenceError(operation)[source]¶
Bases:
CadrumoErrorTranslated failure from the perceptor-observation persistence port.
- Parameters:
operation (str)
- Return type:
None
- code¶
- class PercepcionObservationRepository(*args, **kwargs)[source]¶
Bases:
ProtocolApplication-facing read/write capability for percepciones windows.
- class PercepcionObservationPorts(repository)[source]¶
Bases:
objectRequired percepciones capabilities for one profile calculation context.
- Parameters:
repository (PercepcionObservationRepository)
-
repository:
PercepcionObservationRepository¶
- class PercepcionObservationPortsFactory(*args, **kwargs)[source]¶
Bases:
ProtocolConstruct the percepciones capabilities for one profile bucket.
- persist_percepcion_observations(*, ports, modelo, filing_year, period, observations, source_kind=AggregationCaptureKind.AGGREGATE_PULL)[source]¶
Persist the complete per-perceptor-clave window through the required port.
- Return type:
- Parameters:
ports (PercepcionObservationPorts)
modelo (str)
filing_year (int)
period (Period)
observations (Sequence[WithholdingObservation])
source_kind (AggregationCaptureKind)