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:
modelo (
str) – Stable modelo string ID.period (
Period) – TypedPeriodbuilt from a filing year and bare registry token.profile (
ModeloProfile) –ModeloProfilethe draft would be built for.inputs (
TypeAliasType) – RawModeloInputs.schema_provider (
CasillaSchemaProvider) – Registry-backedCasillaSchemaProvider.deadline_checker (
DeadlineChecker|None) – OptionalDeadlineChecker.fail_on_warning (
bool) – Raise when validation produces any warning or error.
- Return type:
- 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.
- binding_provenance(binding)[source]¶
Extract the typed source kind and grounding from a binding definition.
The
bindingis the registryBindingDefinitionalready held by the filing builder; itssourceis a typedBindingSourceKindand itslegal_refs/source_refscarry the binding’s regulatory grounding. Carrying them onto everyModeloBindingValuebrings bound values to provenance parity with casillas (the casilla half already populatesModeloCasillaProvenance).- 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:
- Parameters:
inputs (ModeloInputs)
bindings (Mapping[BindingId, BindingDefinition])
enum_binding_ids (frozenset[BindingId])
non_decimal_binding_ids (frozenset[BindingId])