Skip to content

Operator and interface models

Profile models for spec documents.

Operator

Bases: StrictModel

A computation with declared feature inputs, outputs, and optional merge.

id class-attribute instance-attribute

id: str = pydantic.Field(exclude=True)

interface class-attribute instance-attribute

interface: Interface = pydantic.Field(default_factory=Interface)

row_context class-attribute instance-attribute

row_context: RowContext | None = None

compute instance-attribute

compute: Binding

is_workflow class-attribute instance-attribute

is_workflow: bool = False

merge class-attribute instance-attribute

merge: Binding | None = None

bindings property

bindings: dict[Value, Binding]

Return compute and optional merge bindings in declaration order.

execution_form property

execution_form: Value

Return whether this operator has a compute binding alone or with merge.

binding_roles property

binding_roles: tuple[Value, ...]

Return the execution roles declared by this operator.

input_features property

input_features: list[str]

Return identifiers of declared feature dependencies.

output_features property

output_features: list[str]

Return identifiers of declared logical feature outputs.

arguments property

arguments: dict[str, BindingArgument]

Return this operator's bound argument objects.

profile_references cached property

profile_references: tuple[str, ...]

Return normalized profile IDs in reference order, retaining duplicates.

feature_selectors cached property

feature_selectors: tuple[str, ...]

Return normalized compute feature IDs in reference order, retaining duplicates.

dimension_reference_paths property

dimension_reference_paths: tuple[tuple[str, tuple[str | int, ...]], ...]

Return normalized dimension IDs and relative compute argument paths.

dimensions_references cached property

dimensions_references: tuple[str, ...]

Return normalized binding dimension IDs in order, retaining duplicates.

resolve_args

resolve_args(function_id: str, profile_id: str, identifiers_by_profile: Mapping[str, Sequence[str]], resources: BindingResources, *, role: Value = OperatorBindingRole.COMPUTE, feature_id: str | None = None) -> dict[str, object]

Resolve arguments from the binding selected by its execution role.

execution_contract

execution_contract(*, returns: str, target_profile: ProfileKey, dataframe_sources: Sequence[ProfileKey], grain_relationships: Mapping[ProfileKey, Value]) -> OperatorExecutionContract

Derive validation policies from this declaration and its dataframe sources.

source_details

source_details(spec: Spec, key: OperatorKey) -> tuple[tuple[ProfileKey, ...], OperatorSourceStatus.Value]

Resolve this operator's feature and dataframe sources without hiding ambiguity.

grain_relationships

grain_relationships(spec: Spec, key: OperatorKey) -> dict[ProfileKey | None, GrainRelationship.Value]

Return this operator's source-to-target grain relationships.

profile_resolutions

profile_resolutions(spec: Spec, profile_key: ProfileKey) -> tuple[dimension_module.Resolution, ...] | None

Resolve the selected dimension models for a source or target profile.

produces_target_features

produces_target_features(spec: Spec, key: OperatorKey) -> bool

Return whether this operator computes dataframe outputs from its target dataset.

Interface

Bases: StrictModel

Explicit data prerequisites and produced features for one operator.

inputs class-attribute instance-attribute

inputs: list[str] = pydantic.Field(default_factory=list)

outputs class-attribute instance-attribute

outputs: list[str] = pydantic.Field(default_factory=list)

input_ids cached property

input_ids: list[str]

Return normalized input feature IDs once.

output_ids cached property

output_ids: list[str]

Return normalized output feature IDs once.

validate_references classmethod

validate_references(values: list[str]) -> list[str]

Require distinct feature references without value selectors.

Order

Bases: Grain

One logical profile ordering key, without a physical row-order guarantee.

direction instance-attribute

direction: Literal['asc', 'desc']