aeat.domain.filing._schema module¶
Pydantic v2 schema for the domain.filing subpackage.
Every type in this module is a strict, frozen pydantic v2 model
or a closed enum.StrEnum. These are the boundary-crossing
records the rest of the project pins against — keep them stable.
- class ModeloValueKind(*values)[source]¶
Bases:
StrEnumProvenance kind of a
ModeloValue.- LITERAL¶
- COMPUTED¶
- INHERITED¶
- DEFAULT¶
- EMPTY¶
- class ModeloValue(**data)[source]¶
Bases:
BaseModelThe typed value of one casilla on a
ModeloDraft.- Variables:
casilla_id – Stable casilla ID (e.g.
"03").value – The scalar value carried by this casilla.
NoneiffkindisModeloValueKind.EMPTY.kind – Provenance kind — literal user input, computed, inherited from a previous draft, default from the casilla schema, or empty.
source – Free-text provenance string — e.g.
"user-supplied","computed from 01,02","default per modelo schema".formula_trace_casilla_ids – For
COMPUTEDvalues, the casilla IDs that fed the computation.Nonefor non-computed kinds.
- Parameters:
- casilla_id: CasillaId¶
- value: ModeloScalar¶
- kind: ModeloValueKind¶
- source: str¶
- formula_trace_casilla_ids: tuple[CasillaId, ...] | None¶
- class ModeloBindingValue(**data)[source]¶
Bases:
BaseModelThe typed value of one registry binding on a
ModeloDraft.Carries the same regulatory grounding the casilla half exposes via
ModeloCasillaProvenance:legal_refsandsource_refspopulated from the binding definition, plus a typedBindingSourceKindsource(replacing the former free-text provenance string) so a bound value is operator-traceable at parity with a computed casilla.- Variables:
binding_id – Stable registry binding id this value materialises.
value – The scalar value carried for this binding.
kind – Provenance kind — literal input, computed, inherited, etc.
source – Typed registry binding source kind (e.g.
MANUAL_INPUT,LEDGER_IVA_AGGREGATION).legal_refs – Legal references carried from the binding definition.
source_refs – Source references carried from the binding definition.
row_index – 1-based row index for multi-row (detail-record) bindings.
- Parameters:
binding_id (BindingId)
kind (ModeloValueKind)
source (BindingSourceKind)
legal_refs (tuple[LegalRefId, ...])
source_refs (tuple[SourceRefId, ...])
row_index (int | None)
- binding_id: BindingId¶
- value: ModeloScalar¶
- kind: ModeloValueKind¶
- source: BindingSourceKind¶
- legal_refs: tuple[LegalRefId, ...]¶
- source_refs: tuple[SourceRefId, ...]¶
- row_index: int | None¶
- class ModeloCasillaProvenance(**data)[source]¶
Bases:
BaseModelRegulatory grounding for one casilla carried on a filing draft.
formula_idis set for computed casillas (those whose value is produced by a registry formula) andNonefor manual-input or bound casillas.legal_refsandsource_refsare always populated from the registry casilla definition when the draft is created.- Parameters:
- casilla_id: CasillaId¶
- formula_id: FormulaId | None¶
- legal_refs: tuple[LegalRefId, ...]¶
- source_refs: tuple[SourceRefId, ...]¶
- class ModeloValidationFinding(**data)[source]¶
Bases:
BaseModelOne finding produced by the validator.
- Variables:
casilla_id – The casilla the finding is about, or
Nonefor cross-cutting findings such as deadline checks.severity – ERROR / WARNING / INFO.
code – A stable machine-readable code (e.g.
"casilla-required-missing").message – A strictly-typed
Translatablekey.references_rules – Tuple of Manual práctico Rule IDs that justify the finding (see
domain.manuals.Rule).
- Parameters:
casilla_id (CasillaId | None)
severity (BaseSeverity)
code (str)
message (Translatable)
- casilla_id: CasillaId | None¶
- severity: BaseSeverity¶
- code: str¶
- message: tr¶
- references_rules: tuple[str, ...]¶
- class ModeloApprovalBasis(**data)[source]¶
Bases:
BaseModelPersisted approval-basis digests for deterministic stale detection.
- Parameters:
version (str)
draft_payload_fingerprint (str)
draft_review_fingerprint (str)
transaction_catalogue_fingerprint (str)
invoice_catalogue_fingerprint (str)
prior_filing_observations_fingerprint (str)
profile_activity_fingerprint (str)
category_profiles_fingerprint (str)
schema_formula_fingerprint (str)
- version: str¶
- draft_payload_fingerprint: str¶
- draft_review_fingerprint: str¶
- transaction_catalogue_fingerprint: str¶
- invoice_catalogue_fingerprint: str¶
- prior_filing_observations_fingerprint: str¶
- profile_activity_fingerprint: str¶
- category_profiles_fingerprint: str¶
- schema_formula_fingerprint: str¶
- class ModeloDraft(**data)[source]¶
Bases:
BaseModelA typed, validated draft of one filing.
The
draft_idis a content-addressed hash of(modelo, period, profile_tax_id, snapshot_ref, values). Re-validating a draft preserves its identity because findings, status,updated_atandnotesare deliberately excluded from the hash.- Parameters:
draft_id (str)
modelo (str)
period (Period)
profile_tax_id (SubjectTaxId)
subject_tax_id (SubjectTaxId)
snapshot_ref (RegistrySnapshotRef)
status (ModeloDraftStatus)
values (tuple[ModeloValue, ...])
binding_values (tuple[ModeloBindingValue, ...])
casilla_provenance (tuple[ModeloCasillaProvenance, ...])
findings (tuple[ModeloValidationFinding, ...])
created_at (datetime)
updated_at (datetime)
schema_version (str)
notes (str)
approved_at (datetime | None)
approved_by (str | None)
review_checksum (str | None)
approval_basis (ModeloApprovalBasis | None)
- draft_id: str¶
- modelo: str¶
- period: Period¶
- profile_tax_id: SubjectTaxId¶
- subject_tax_id: SubjectTaxId¶
- snapshot_ref: RegistrySnapshotRef¶
- status: ModeloDraftStatus¶
- values: tuple[ModeloValue, ...]¶
- binding_values: tuple[ModeloBindingValue, ...]¶
- casilla_provenance: tuple[ModeloCasillaProvenance, ...]¶
- findings: tuple[ModeloValidationFinding, ...]¶
- created_at: datetime¶
- updated_at: datetime¶
- schema_version: str¶
- notes: str¶
- approved_at: datetime | None¶
- approved_by: str | None¶
- review_checksum: str | None¶
- approval_basis: ModeloApprovalBasis | None¶
- compute_modelo_draft_id(*, modelo, period, profile_tax_id, snapshot_ref, values, binding_values=())[source]¶
Compute the stable, content-addressed
draft_id.The period is serialised as
{"filing_year": <int>, "code": "<token>"}so the hash is deterministic and self-consistent regardless of the human-readablestr(period)form.- Parameters:
modelo (
str) – Modelo string ID.profile_tax_id (
TypeAliasType) – Validated taxpayer tax ID.snapshot_ref (
RegistrySnapshotRef) – Typed registry snapshot coordinate this draft was built against.values (
tuple[ModeloValue,...]) – The tuple ofModeloValuerecords to hash.binding_values (
tuple[ModeloBindingValue,...]) – Optional tuple ofModeloBindingValuerecords included in the hash; defaults to an empty tuple.
- Return type:
- Returns:
A 16-character lowercase hex SHA-256 prefix.