cadrumo.application.filing.draft_construction module

Filing-draft construction pipeline.

This defining module owns one coherent cluster: build_draft() and every private helper implementing its pipeline – load the registry snapshot, classify the snapshot’s bindings by kind, validate operator input keys against that classification, coerce raw input into typed values, assemble the draft record, and validate the built draft. None of these helpers are called from outside this pipeline; build_draft() is the direct public entry point.

Core types: RegistrySnapshot.

build_draft(*, modelo, period, profile, inputs, schema_provider, deadline_checker=None, fail_on_warning=False)[source]

Build and validate a filing draft from a registry snapshot.

Parameters:
Return type:

ModeloDraft

Returns:

A fully constructed and validated ModeloDraft.

Raises:

ModeloBuilderError – If the registry has no matching snapshot, inputs are malformed, or strict validation fails.

filing_period_date(period)[source]

Return the shared calculation filing date for a typed draft period.

Return type:

date

Parameters:

period (Period)

binding_provenance(binding)[source]

Extract the typed source kind and grounding from a binding definition.

The binding is the registry BindingDefinition already held by the filing builder; its source is a typed BindingSourceKind and its legal_refs / source_refs carry the binding’s regulatory grounding. Carrying them onto every ModeloBindingValue brings bound values to provenance parity with casillas (the casilla half already populates ModeloCasillaProvenance).

Return type:

tuple[BindingSourceKind, tuple[TypeAliasType, ...], tuple[TypeAliasType, ...]]

Parameters:

binding (BindingDefinition)

filing_binding_values(inputs, bindings, enum_binding_ids=frozenset({}), non_decimal_binding_ids=frozenset({}))[source]

Project literal filing bindings while preserving their registry provenance.

Return type:

list[ModeloBindingValue]

Parameters: