cadrumo.application.live.filed_observation_ports module¶
Application-owned ports for filed-observation persistence.
The filed-history use case consumes an authenticated declaration observation, turns it into calculation evidence, and records the resulting local evidence. This module names the small surfaces that use case needs. Sede readers, receipt parsers, and encrypted repositories are composed outside the application layer and implement these ports there.
Core types:
ModeloRecord.
- class FiledObservationArtefactProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolThe captured artefact facts read by persistence and receipt matching.
- class FiledObservedCasillaProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolThe observed casilla facts used by baseline and skip projections.
- property value_kind: CasillaValueKind¶
Return the parser’s value-kind classification.
- class FiledObservationProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolApplication view of one authenticated filed declaration observation.
- property artefacts: Sequence[FiledObservationArtefactProtocol]¶
Return the captured artefact manifest.
- property casillas: Sequence[FiledObservedCasillaProtocol]¶
Return observed casilla values.
- property headers: tuple[ObservedHeaderFact, ...]¶
Return typed submitted-file header facts.
- property registry_snapshot_ref: RegistrySnapshotRef¶
Return the registry revision selected for this observation.
- class FiledDeclarationProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolPeriod-bearing register row facts used for latest-row selection.
- class FiledObservationSkipProtocol(*args, **kwargs)[source]¶
Bases:
ProtocolNon-numeric casilla projection returned for the operator report.
- property value_kind: CasillaValueKind¶
Return the skipped value-kind classification.
- class FiledObservationParserPort(*args, **kwargs)[source]¶
Bases:
ProtocolParse receipt bytes and recover the independent AEAT CSV witness.
- class FiledDeclarationTransformationPort(*args, **kwargs)[source]¶
Bases:
ProtocolTranslate filed evidence into application/domain projections.
- registry_observation(observation)[source]¶
Translate one filed observation into a registry-grounded row.
- Return type:
- Parameters:
observation (FiledObservationProtocol)
- non_numeric_casillas(observation)[source]¶
Return non-numeric casillas for the operator skip report.
- Return type:
- Parameters:
observation (FiledObservationProtocol)
- class FiledObservationPersistencePort(*args, **kwargs)[source]¶
Bases:
ProtocolEncrypted custody of captured observation manifests and artefacts.
- persist_observation(observation)[source]¶
Persist an observation manifest and return its logical path.
- Return type:
Path- Parameters:
observation (FiledObservationProtocol)
- class FiledCalculationObservationRepositoryPort(*args, **kwargs)[source]¶
Bases:
ProtocolCalculation-observation repository operations used by this capability.
- load_observation(modelo, period)[source]¶
Load one existing calculation-observation envelope before replacement.
- Return type:
- Parameters:
- prepare_observation_envelope(observation, *, source_kind, stamped_revision_id, captured_at=None, source_metadata=None, source_headers=())[source]¶
Build a validated calculation-observation envelope.
- Return type:
- Parameters:
observation (RegistryModeloObservation)
source_kind (ObservationSourceKind | str)
stamped_revision_id (str)
captured_at (datetime | None)
source_headers (tuple[ObservedHeaderFact, ...])
- save(payload)[source]¶
Persist a prepared calculation-observation envelope.
- Return type:
- Parameters:
payload (ObservationEnvelopePayload)
- class FiledIvaHistoryRepositoryPort(*args, **kwargs)[source]¶
Bases:
ProtocolRead the persisted IVA history row after a M303 co-commit.
- class FiledIvaObservationPersistencePort(*args, **kwargs)[source]¶
Bases:
ProtocolAtomically persist a calculation envelope and its M303 history state.
- persist(*, observation_repository, history_repository, envelope, taxpayer_nif, source_observation_key, expediente_id, status, source_artefact_sha256)[source]¶
Atomically persist the calculation envelope and IVA history state.
- Return type:
- Parameters:
observation_repository (FiledCalculationObservationRepositoryPort)
history_repository (FiledIvaHistoryRepositoryPort)
envelope (ObservationEnvelopePayload)
taxpayer_nif (str)
source_observation_key (str)
expediente_id (str | None)
status (str | None)
source_artefact_sha256 (str | None)
- class FiledFilingReconciliationPort(*args, **kwargs)[source]¶
Bases:
ProtocolApply one AEAT register entry to the filing chain of its period.
- reconcile(entry, *, actor, clock)[source]¶
Reconcile
entryand return the chain decision.- Return type:
- Parameters:
entry (AeatRegisterEntry)
actor (str)
clock (datetime)
- class FiledObservationPersistencePorts(parser, transformation, observation_persistence, calculation_repository, iva_history_repository, iva_observation_persistence, justificante_repository, filing_repository, bucket_event_repository, filing_reconciliation)[source]¶
Bases:
objectImmutable dependency bundle for the filed-observation capability.
- Parameters:
parser (FiledObservationParserPort)
transformation (FiledDeclarationTransformationPort)
observation_persistence (FiledObservationPersistencePort)
calculation_repository (FiledCalculationObservationRepositoryPort)
iva_history_repository (FiledIvaHistoryRepositoryPort)
iva_observation_persistence (FiledIvaObservationPersistencePort)
justificante_repository (JustificanteRepositoryProtocol)
filing_repository (ModeloRecordCatalogueRepositoryProtocol)
bucket_event_repository (BucketEventHistoryRepositoryProtocol)
filing_reconciliation (FiledFilingReconciliationPort)
-
parser:
FiledObservationParserPort¶
-
transformation:
FiledDeclarationTransformationPort¶
-
observation_persistence:
FiledObservationPersistencePort¶
-
calculation_repository:
FiledCalculationObservationRepositoryPort¶
-
iva_history_repository:
FiledIvaHistoryRepositoryPort¶
-
iva_observation_persistence:
FiledIvaObservationPersistencePort¶
-
justificante_repository:
JustificanteRepositoryProtocol¶
-
filing_repository:
ModeloRecordCatalogueRepositoryProtocol¶
-
bucket_event_repository:
BucketEventHistoryRepositoryProtocol¶
-
filing_reconciliation:
FiledFilingReconciliationPort¶