cadrumo.domain.calculations.registry.export_field_casilla module¶
The casilla an export layout field resolves to, and the back-references that follow from it.
A casilla’s export_refs answer “which export fields carry me”. The layout
already answers the converse for every field, so the casilla side is derived
from it here rather than declared a second time: an edition’s layout owns the
edge, and a field moved to another casilla moves its back-reference with it.
A field resolves to a casilla along one of two paths:
its own endpoint,
endpoint_casilla_id, which covers acasilla_idand a numberedprojection_ref;the record row mapping, for a
bindingfield in a repeated record: the binding’s row-setrow_fieldnames a slot, and the record’srow_field_casilla_idsnames the casilla that slot belongs to.
A binding_record row template contributes no casilla edge. Declaring
binding_record makes the export derivation take the record’s field
positions from its bindings’ export selectors, so the record’s rows are
templates the derivation fills, and neither the casilla field that
templates a mapped slot nor a binding field in that record is an edge. A
record whose field positions come from the official record design uses
row_field_casilla_ids only to say which box each field fills; those rows
are real edges and keep their back-references. Declaring binding_record
on such a record would add a second source of field positions beside the
official design, so the two record shapes are deliberately distinct.
- layout_fields_in_emission_order(layout)[source]¶
Return every field of
layoutwith its record, in the order the layout emits them.Records are taken by their declared
order, records of equal order in declaration order. Within a record, fields are taken byoffset, a field declaring no offset ahead of every positioned one, and by field id where two share an offset.- Return type:
tuple[tuple[ExportRecordDefinition,ExportFieldDefinition],...]- Parameters:
layout (ExportLayoutDefinition)
- export_field_casilla_id(record, field, *, bindings)[source]¶
Return the casilla
fieldofrecordresolves to, orNonewhen it resolves to none.bindingsmaps binding id to its declaration. A binding field naming a binding absent from it, or one that produces no rows, resolves to nothing; reference validation reports the unknown binding.A binding_record row template contributes no casilla edge: in a record declaring
binding_recordthe field positions come from the bindings’ export selectors, so acasillafield whose casilla is a mapped row slot is the template of that slot and resolves to nothing, and abindingfield never takes the row-mapping path. A record without it takes its positions from the official design, and its row mapping names real edges.- Raises:
RegistryValidationError – When a row-producing binding the field names declares a malformed row-set projection.
- Return type:
TypeAliasType|None- Parameters:
record (ExportRecordDefinition)
field (ExportFieldDefinition)
bindings (Mapping[str, BindingDefinition])
- derive_casilla_export_refs(export_layouts, bindings)[source]¶
Return every addressed casilla’s export field ids, in the order its layout emits them.
Only casillas some field resolves to appear. The order is part of the value: a casilla’s field ids follow
layout_fields_in_emission_order(), record order and then field offset, never the order the declarations happen to be written in.- Raises:
RegistryValidationError – When fields of more than one layout resolve to one casilla. Two layouts each claiming a casilla is a conflict to resolve in the declarations, never a union to take silently.
- Return type:
- Parameters:
export_layouts (Iterable[ExportLayoutDefinition])
bindings (Iterable[BindingDefinition])