cadrumo.domain.deadlines.profiles module¶
Profile construction helpers for deadline and schedule consumers.
The helper projects a ProfileRecord.values-shaped mapping into an
TaxpayerProfile through
project_setup_answers(), which reads
stored facts by their profile path and applies the canonical-token
parsing every field declares.
The projection deliberately depends on the registry answer declarations and not on any interactive surface. Deciding which modelos a taxpayer must file is a regulatory computation that runs on stored facts; when it instead walked the terminal wizard’s question catalogue, a schedule could not be computed in a process that had never built a setup UI, and the UI could not be replaced without moving the tax logic with it.
- taxpayer_profile_from_mapping(values, *, tax_id_default, iva_regime_default=None)[source]¶
Build an
TaxpayerProfilefrom a profile-values mapping.The mapping is projected through the descriptor’s
project_answersso canonical-token semantics for every boolean / select / text field stay in lockstep with the wizard’s on-prompt validation. Missing identity fields fall back totax_id_default. Missing IVA regime falls back toNO_APLICAfor natural persons without economic-activity income and toiva_regime_defaultfor profiles that still require an IVA regime declaration.
- MODELO_IVA_BLOCK_CLAIMING_PATHS: frozenset[str]¶
Every profile path whose presence claims the Modelo IVA block.
The claiming set and
MODELO_IVA_BLOCK_REQUIRED_PATHSare one family read from both directions: declaring any path here obliges every path there. Consumers that gate a surface on the block – the wizard’s question visibility, profile completeness – need the membership set itself, not only the mapping-shapedprofile_claims_modelo_iva_block()predicate over it.
- MODELO_IVA_BLOCK_REQUIRED_PATHS: tuple[str, ...]¶
Every path
_resolve_modelo_iva_profile()refuses to build without.Declared beside the resolver that enforces it so the readiness surfaces and the resolver read ONE answer. They did not: the resolver hard-required six facts while profile completeness knew of none of them, so a profile declaring any IVA fact was reported ready and then refused two commands later by a resolver naming a path no surface had asked for.
- profile_claims_modelo_iva_block(values)[source]¶
Report whether
valuesdeclares any fact owned by the Modelo IVA block.Presence is value-bearing, not truth-bearing: answering “no” to an IVA enrolment still claims the block, because declining a regime is a declaration about IVA. Only an absent or blank path leaves it unclaimed.