Skip to content

Profile and feature models

Profile models for spec documents.

Profile

Bases: StrictModel

An entry under the top-level ID-keyed profiles object.

id class-attribute instance-attribute

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

name class-attribute instance-attribute

name: str | None = None

description class-attribute instance-attribute

description: str | None = None

category class-attribute instance-attribute

category: str | None = None

scope class-attribute instance-attribute

scope: str | None = None

seed class-attribute instance-attribute

seed: str | None = None

grain class-attribute instance-attribute

grain: list[Grain] = pydantic.Field(default_factory=list)

relations class-attribute instance-attribute

relations: list[Grain] = pydantic.Field(default_factory=list)

features class-attribute instance-attribute

features: dict[str, Feature] = pydantic.Field(default_factory=dict)

assembly class-attribute instance-attribute

assembly: dict[str, Operator] = pydantic.Field(default_factory=dict)

order class-attribute instance-attribute

order: list[Order] = pydantic.Field(default_factory=list)

dimension_ids cached property

dimension_ids: list[str]

Return dimension identifiers in profile key order.

dimension_id_set cached property

dimension_id_set: frozenset[str]

Return dimension IDs for repeated scope checks.

all_features property

all_features: dict[str, Feature]

Return the declared feature metadata for this profile.

arguments cached property

arguments: dict[tuple[str, str], BindingArgument]

Return compute arguments keyed by operator key and argument name.

feature_producers cached property

feature_producers: dict[str, tuple[tuple[str, Operator], ...]]

Return all declared output operators per feature, retaining aliases.

order_dimensions cached property

order_dimensions: tuple[tuple[str, frozenset[str]], ...]

Return normalized order IDs with preceding keys, retaining duplicates.

order_references cached property

order_references: frozenset[str]

Return order dimension references for membership checks.

grain_reference_set cached property

grain_reference_set: frozenset[tuple[str, str]]

Return selected dimension-resolution identities.

identifiers

identifiers(dimensions: Mapping[str, Dimension]) -> list[str]

Return only the selected grain columns identifying profile rows.

Parameters:

Name Type Description Default
dimensions Mapping[str, Dimension]

Dimension catalog from the owning Spec.

required

Returns:

Type Description
list[str]

Profile identifier columns in grain order, excluding relations.

identifier_types

identifier_types(dimensions: Mapping[str, Dimension]) -> dict[str, str]

Return logical types for the selected grain identifiers.

Parameters:

Name Type Description Default
dimensions Mapping[str, Dimension]

Dimension catalog from the owning Spec.

required

Returns:

Type Description
dict[str, str]

Profile identifier columns mapped to logical types, excluding relations.

relation_types

relation_types(dimensions: Mapping[str, Dimension]) -> dict[str, str]

Return logical types for resolutions relating this profile to other profiles.

Parameters:

Name Type Description Default
dimensions Mapping[str, Dimension]

Dimension catalog from the owning Spec.

required

Returns:

Type Description
dict[str, str]

Declared relation columns mapped to logical types, excluding identifiers.

keys

keys(dimensions: Mapping[str, Dimension]) -> list[str]

Return identifiers and relations in declaration order.

key_types

key_types(dimensions: Mapping[str, Dimension]) -> dict[str, str]

Return logical types for identifiers and relations together.

generate_name

generate_name() -> typing.Self

Generate a display name from the profile ID when one is not supplied.

Feature

Bases: StrictModel

A profile feature's logical metadata.

id class-attribute instance-attribute

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

name class-attribute instance-attribute

name: str | None = None

description class-attribute instance-attribute

description: str | None = None

type class-attribute instance-attribute

type: str | None = None

unit class-attribute instance-attribute

unit: str | None = None

generate_name

generate_name() -> typing.Self

Generate a display name from the feature ID when one is not supplied.