cadrumo.domain.modelos.perceptor_clave_scope module

Registry-declared clave scope of perceptor-record casillas.

An informative withholding summary files one record per perceptor and clave, and its record design reserves many positions for particular claves only (“Solo para percepciones correspondientes a las claves …”). A casilla outside a record’s scope is left blank or zero-filled for that record, so it is not a required input there. The scope is registry data, authored per design edition in a governed mapping fact, never a list in code.

A scope token is CLAVE (every subclave) or CLAVE.SUBCLAVE.

The scope is evaluated against a ModeloRevision, whose export layouts name each record’s row-field casillas and whose bindings fill them.

class ClaveScopeToken(clave, subclave)[source]

Bases: object

One clave, optionally narrowed to a single subclave.

Parameters:
  • clave (str)

  • subclave (str | None)

clave: str
subclave: str | None
classmethod parse(raw)[source]

Parse CLAVE or CLAVE.SUBCLAVE; refuse any other shape.

Return type:

ClaveScopeToken

Parameters:

raw (str)

admits(clave, subclave)[source]

Whether a record with clave/subclave falls inside this token.

Return type:

bool

Parameters:
  • clave (str)

  • subclave (str | None)

class PerceptorClaveScope(modelo_id, row_clave_binding, row_subclave_binding, casillas, effective_date)[source]

Bases: object

The selected edition’s clave scope for one modelo’s perceptor casillas.

Parameters:
modelo_id: str
row_clave_binding: TypeAliasType
row_subclave_binding: TypeAliasType
casillas: Mapping[TypeAliasType, tuple[ClaveScopeToken, ...]]
effective_date: date
is_scoped(casilla_id)[source]

Whether the registry declares a clave scope for casilla_id.

Return type:

bool

Parameters:

casilla_id (CasillaId)

admits(casilla_id, clave, subclave)[source]

Whether a record with clave/subclave carries casilla_id.

An unscoped casilla applies to every record.

Return type:

bool

Parameters:
resolve_perceptor_clave_scope(*, effective_date, authority=None)[source]

Resolve the clave scope declared for the filing period of effective_date.

Return type:

PerceptorClaveScope

Parameters:
row_field_value_bindings(revision)[source]

Map each row-template casilla to the row-set binding that fills it.

The export record names the casilla of each row field, and the row-set binding names the row field it supplies for that record.

Parameters:

revision (ModeloRevision) – The ModeloRevision whose export layouts and bindings are joined on the record and row field they share.

Return type:

dict[TypeAliasType, TypeAliasType]

rows_missing_scoped_casilla(scope, *, casilla_id, value_binding, row_binding_values)[source]

Return the rows inside casilla_id’s clave scope that carry no value for it.

A row is identified by its row-set index. A row whose clave the scope excludes owes the casilla nothing; every other row must carry a value, zero included.

Return type:

tuple[str, ...]

Parameters:
perceptor_clave_scope_failures(scope, *, casilla_ids, authority=None)[source]

Return every scope declaration the given revision surface cannot honour.

Return type:

list[str]

Parameters:
check_perceptor_clave_scope(modelo_id, casilla_ids, renta_first_slice_binding_targets, revision_binding_ids=frozenset({}))[source]

Assert the declared scope names real casillas and claves where it applies.

A revision that declares no per-record clave binding carries no perceptor records to scope, so the check has no claim over it.

Return type:

list[str]

Parameters: