cadrumo.domain.calculations.registry.detail_record_bindings module

Detail-record row-set registry binding helpers.

class RelatedPartyOperationObservation(**data)[source]

Bases: BaseModel

One related-party operation for modelo 232.

Parameters:

data (Any)

source_id: str
counterparty_tax_id: TaxIdIdentityToken
country_code: CountryCodeAlpha2
transaction_date: date
operation_kind_code: Annotated[TipoOperacionVinculada, BeforeValidator(_hydrate_operation_kind_code)]
transfer_pricing_method_code: Annotated[MetodoValoracion, BeforeValidator(_hydrate_transfer_pricing_method_code)]
amount: Decimal

Validate a related-party-operation binding at registry-build time.

Accumulating list[str] validator: validates the selector shape against RelatedPartyOperationProvider and lifts the resolve-time op/fact invariant (row_field fact paired with the rows op and a named row_field) to build time, preserving the underlying pydantic field error.

Return type:

list[str]

Parameters:

binding (BindingDefinition)

class Modelo720RowObservation(**data)[source]

Bases: BaseModel

One foreign asset for modelo 720.

Parameters:

data (Any)

source_id: str
asset_class_code: M720AssetClassCode
country_code: CountryCodeAlpha2
currency_code: str
asset_identifier: str
acquisition_date: date
valuation_amount: Decimal
validate_foreign_asset_binding(binding)[source]

Validate a foreign-asset binding at registry-build time.

Accumulating list[str] validator: validates the selector against ForeignAssetProvider and lifts the resolve-time op/fact invariant to build time, preserving the underlying pydantic field error.

Return type:

list[str]

Parameters:

binding (BindingDefinition)

resolve_foreign_asset_binding_row_values(revision, observations)[source]

Resolve row-producer foreign-asset bindings into per-row indexed values.

Parameters:
Return type:

dict[tuple[TypeAliasType, int], Decimal | str]

class AtributionMemberObservation(**data)[source]

Bases: BaseModel

One (member, clave, subclave) atribuci�n row for modelo 184.

Every field below base_imponible_assigned is the (member, clave, subclave) row-shape ADR’s clave/subclave-conditional fact set, and is None whenever the declaring clave does not license it – e.g. naturaleza_inmueble is only ever populated for a clave-C row. A None here is a legitimate “this field does not apply to this row”, never a missing value.

Parameters:

data (Any)

source_id: str
member_tax_id: TaxIdIdentityToken
country_code: CountryCodeAlpha2 | None

The party’s country, or None when the source stated none.

Nullable rather than defaulted to ES, because these forms carry the NON-RESIDENT population by construction – a perceptor on a withholding form is routinely foreign, and an attribution member can be – so a default silently declares a foreign party Spanish on a filing surface.

Absence propagates as an ABSENT KEY in the built row rather than as a value, so a binding that needs the country refuses with the shipped not-produced error naming itself. That is the visible failure the silent default replaced.

transaction_date: date
share_percentage: Decimal
base_imponible_assigned: Decimal
clave: str
subclave: str | None
codigo_provincia: str | None
miembro_a_31_diciembre: str | None

"X" when the member remained one at 31 December, else None.

A string flag rather than a bool: the dise�o’s own field (position 82) is text, marked "X" or left blank – never a boolean literal – and this is the shape the fixed-width renderer’s data_type = "text" field expects.

dias_miembro: int | None
domicilio_fiscal: str | None
naturaleza_inmueble: str | None
situacion_inmueble: str | None
referencia_catastral: str | None
clave_declarado: str | None
porcentaje_titularidad_inmueble: Decimal | None
dias_arrendamiento: int | None
reduccion: Decimal | None
rendimiento_neto_previo_eo: Decimal | None
rendimiento_neto_minorado_agricola_eo: Decimal | None
validate_atribucion_binding(binding)[source]

Validate an atribuci�n-member binding at registry-build time.

Accumulating list[str] validator: validates the selector against AtribucionMemberProvider and lifts the resolve-time op/fact invariant to build time, preserving the underlying pydantic field error.

Return type:

list[str]

Parameters:

binding (BindingDefinition)

resolve_atribucion_binding_row_values(revision, observations)[source]

Resolve row-producer atribucion bindings into per-row indexed values.

Parameters:
Return type:

dict[tuple[TypeAliasType, int], Decimal | str | int | bool]

class RefundOperationObservation(**data)[source]

Bases: BaseModel

One foreign-MS refund operation for modelo 360.

Parameters:

data (Any)

source_id: str
member_state_code: CountryCodeAlpha2
operation_kind_code: str
operation_date: date
supplier_tax_id: TaxIdIdentityToken
refund_amount: Decimal
class AtribucionMemberProvider(**data)[source]

Bases: BaseModel

Parameters:

data (Any)

kind: Literal[BindingSourceKind.ATRIBUCION_MEMBER]
fact: Literal['row_field']
row_field: _AtributionRowField | None
grouping: str | None
record: str | None
data_type: ExportFieldDataType | None

Scalar type of the value this row field contributes to the export.

The same fact BindingRowExportSelector.data_type carries; declared here so the selector model admits the key, since a source-family selector is validated whole against its own strict model. Optional while the families adopt it.

class ForeignAssetProvider(**data)[source]

Bases: BaseModel

Parameters:

data (Any)

kind: Literal[BindingSourceKind.FOREIGN_ASSET]
fact: Literal['row_field']
row_field: _ForeignAssetRowField | None
asset_classes: tuple[str, ...]
grouping: str | None
record: str | None
data_type: ExportFieldDataType | None

Scalar type of the value this row field contributes to the export.

The same fact BindingRowExportSelector.data_type carries; declared here so the selector model admits the key, since a source-family selector is validated whole against its own strict model. Optional while the families adopt it.

class RefundOperationProvider(**data)[source]

Bases: BaseModel

Parameters:

data (Any)

kind: Literal[BindingSourceKind.REFUND_OPERATION]
fact: Literal['row_field']
row_field: _RefundRowField | None
grouping: str | None
record: str | None
data_type: ExportFieldDataType | None

Scalar type of the value this row field contributes to the export.

The same fact BindingRowExportSelector.data_type carries; declared here so the selector model admits the key, since a source-family selector is validated whole against its own strict model. Optional while the families adopt it.

class RelatedPartyOperationProvider(**data)[source]

Bases: BaseModel

Parameters:

data (Any)

kind: Literal[BindingSourceKind.RELATED_PARTY_OPERATION]
fact: Literal['row_field']
row_field: _RelatedPartyRowField | None
grouping: str | None
record: str | None
data_type: ExportFieldDataType | None

Scalar type of the value this row field contributes to the export.

The same fact BindingRowExportSelector.data_type carries; declared here so the selector model admits the key, since a source-family selector is validated whole against its own strict model. Optional while the families adopt it.

validate_refund_binding(binding)[source]

Validate a refund-operation binding at registry-build time.

Accumulating list[str] validator: validates the selector against RefundOperationProvider and lifts the resolve-time op/fact invariant to build time, preserving the underlying pydantic field error.

Return type:

list[str]

Parameters:

binding (BindingDefinition)