aeat.application.live._borrador_100 module¶
Application-live persistence for captured Modelo 100 borrador snapshots.
Borrador100 is the proof-of-concept consumer of the shared
_snapshot_base lifecycle abstraction. The public exception class names
(BorradorSnapshotNotFoundError on lookup miss,
LiveApplicationInputError on input-validation failures),
Borrador100SnapshotService class identity, storage namespace,
object-key layout, and method signatures are preserved exactly; only
the inline state-machine, supersession, and content-id helpers have
been routed through the shared base.
Snapshot records are wrapped in an
Envelope and persisted through a
SecureObjectRepository at
FINANCIAL SensitivityClass
under the borrador namespace.
- exception BorradorSnapshotNotFoundError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
SnapshotNotFoundErrorRaised when a Modelo 100 borrador snapshot lookup misses by id.
SnapshotNotFoundErrorinheritsAeatErrorfirst, so MRO routes__init__through the structured constructor (acceptssuggestion=/context=kwargs) rather thanKeyError’s C-level constructor. ListingAeatErrorexplicitly here would violate C3 linearization.- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
- class Borrador100Snapshot(**data)[source]¶
Bases:
BaseModelCaptured Modelo 100 borrador values available to application consumers.
- Parameters:
snapshot_id (str)
bucket_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=128, pattern=None, ascii_only=None)])
modelo (str)
filing_year (int)
period (Period)
captured_at (datetime)
source_url (str)
state (SnapshotLifecycleState)
binding_values (Mapping[BindingId, _BorradorValue])
superseded_by_snapshot_id (str | None)
discarded_at (datetime | None)
discarded_by (str)
discard_reason (str)
- snapshot_id: str¶
- bucket_id: BucketId¶
- modelo: str¶
- filing_year: int¶
- period: Period¶
- captured_at: datetime¶
- source_url: str¶
- state: SnapshotLifecycleState¶
- binding_values: Mapping[BindingId, _BorradorValue]¶
- superseded_by_snapshot_id: str | None¶
- discarded_at: datetime | None¶
- discarded_by: str¶
- discard_reason: str¶
- borrador_100_snapshot_object_key(bucket_id, snapshot_id)[source]¶
Return the secure-object key for one bucket’s Modelo 100 borrador snapshot.
- derive_borrador_100_snapshot_id(*, filing_year, period, captured_at, source_url, binding_values)[source]¶
Return the content-addressed id for one Modelo 100 borrador capture.
The canonical-JSON shape is preserved exactly so existing on-disk snapshot ids remain valid: routing through
derive_snapshot_id_from_jsondoes not change the hashed bytes.
- class Borrador100SnapshotRepository(*, bucket_id, objects=None)[source]¶
Bases:
objectSecure-DB repository for captured Modelo 100 borrador snapshots.
Composes the shared
SecureSnapshotRepository(one canonical encrypted secure-object snapshot store) rather than re-implementing the load / resolve / list / save boilerplate; the public class identity, method signatures, andBorradorSnapshotNotFoundErrormessages are preserved, andlist_snapshotskeeps the borradorcaptured_atordering.- Parameters:
bucket_id (str)
objects (SecureObjectRepository | None)
- save(snapshot)[source]¶
- Return type:
- Parameters:
snapshot (Borrador100Snapshot)
- class Borrador100SnapshotService(*, bucket_id, repository=None)[source]¶
Bases:
SnapshotService[Borrador100Snapshot]Canonical backend service for bucket-scoped Modelo 100 borrador snapshots.
- Parameters:
bucket_id (str)
repository (Borrador100SnapshotRepository | None)
- list_snapshots(*, filing_year=None, state=SnapshotLifecycleState.ACTIVE)[source]¶
- Return type:
- Parameters:
filing_year (int | None)
state (SnapshotLifecycleState | None)