aeat.domain.calculations.registry._runtime_graph module¶
Runtime graph helpers for validated registry formulas.
Walks FormulaExpression trees
declared on a ModeloRevision to
extract casilla, binding, parameter, relation, and date-binding references, and
produces topologically sorted evaluation orders for the formula engine.
See also
aeat.domain.calculations.registry._validate_formulasValidation layer that rejects dangling expression refs and formula dependency cycles before runtime graph builders are used.
aeat.domain.calculations.registry._formula_runtimeFormula evaluator that consumes these graph projections.
aeat.domain.calculations.registry._queriesRegistry query surface that exposes formula dependencies to operators.
- expression_casilla_refs(expression)[source]¶
Return all
CasillaIdrefs.The input is a validated
FormulaExpressiontree.- Return type:
- Parameters:
expression (FormulaExpression)
- expression_relation_refs(expression)[source]¶
Return all
RelationIdrefs.The input is a validated
FormulaExpressiontree.- Return type:
- Parameters:
expression (FormulaExpression)
- expression_binding_refs(expression)[source]¶
Return all
BindingIdrefs.The input is a validated
FormulaExpressiontree.- Return type:
- Parameters:
expression (FormulaExpression)
- expression_date_binding_refs(expression)[source]¶
Return all date-binding
BindingIdrefs.date_bindingleaves carry date-valued profile facts (e.g. birth_date) consumed by theage_at_year_endop. They are distinct frombindingleaves (Decimal channel) and need their own collector so callers can populate thedate_binding_valueschannel selectively.- Return type:
- Parameters:
expression (FormulaExpression)
- expression_parameter_refs(expression)[source]¶
Return all
ParameterIdrefs.Walks both the direct
parameter = "..."leaf and thedispatch_table = { key = "param_id" }leaf introduced by thelookup_bracket_by_ccaaop; dispatch_table values reference parameters just like the direct leaf.- Return type:
- Parameters:
expression (FormulaExpression)
- enum_consumed_binding_ids(revision)[source]¶
Return binding ids the revision’s formulas consume as string enums.
A registry binding leaf is resolved from one of two engine channels. When a binding is the
args[1]enum-key argument of a dispatch op (lookup_bracket_by_ccaa/lookup_parameter_by_entity_type) the runtime reads it from the string-valuedenum_binding_valueschannel. Every other binding leaf is read from the Decimal-valuedbinding_valueschannel.The engine channel is therefore a property of how the formula consumes the binding, not of the binding’s
typed_enumannotation. A binding may carrytyped_enumyet still be consumed as a Decimal operand (the Modelo 100 estimacion-directa modality binding is compared against a numeric literal). Routing a binding into the wrong channel makes the engine raisebinding ... has no supplied value; this query is the authoritative discriminator that prevents that mismatch.- Parameters:
revision (
ModeloRevision) – TheModeloRevisionwhose formula graph is inspected for enum dispatch binding references.- Return type:
frozenset[TypeAliasType]
- revision_date_binding_ids(revision)[source]¶
Return every date_binding id the revision’s formulas consume.
Date bindings carry date-valued profile facts (e.g. taxpayer birth date) consumed by ops such as
age_at_year_end. They are read from thedate_binding_valueschannel, distinct from the Decimalbinding_valuesand stringenum_binding_valueschannels. This is the revision-level sibling ofenum_consumed_binding_ids(): callers use it to populate the date channel and to refuse a date-valued binding supplied through a decimal/enum override.- Parameters:
revision (
ModeloRevision) – TheModeloRevisionwhose formula graph is inspected fordate_bindingleaf references.- Return type:
frozenset[TypeAliasType]
- input_casilla_id_map(revision)[source]¶
Return the canonical casilla id map for a revision input.
The
ModeloRevisionsupplies the declaredCasillaIdvalues.- Return type:
dict[TypeAliasType,TypeAliasType]- Parameters:
revision (ModeloRevision)
- formula_evaluation_order(revision)[source]¶
Return computed casilla ids in dependency order.
Casilla references in formula expressions and formula
targetfields are canonicalcasilla.idvalues. Registry validation rejectsnumberfallback references before runtime reaches this graph builder.- Parameters:
revision (
ModeloRevision) – TheModeloRevisionwhose formulas to topologically sort.- Return type: