Spec models¶
uptimely.spec.model defines the spec document structure, independent
of its authoring format. The spec format reference
describes the document structure.
The compiler constructs executable invocations from these declarations.
spec¶
uptimely.spec.model.spec defines the root spec document.
The spec document model.
Spec
¶
Bases: StrictModel
The complete JSON spec document.
source
class-attribute
instance-attribute
¶
source: SpecSource = pydantic.Field(default_factory=lambda: common.SpecSource(name='manual', generated=False))
dimensions
class-attribute
instance-attribute
¶
dimensions: dict[str, Dimension] = pydantic.Field(default_factory=dict)
functions
class-attribute
instance-attribute
¶
functions: FunctionCatalog = pydantic.Field(default_factory=functions_module.FunctionCatalog)
entities
class-attribute
instance-attribute
¶
entities: dict[str, Entity] = pydantic.Field(default_factory=dict)
common¶
uptimely.spec.model.common defines shared dimensions, arguments, and
bindings.
Shared types for spec document models.
BindingArgument
module-attribute
¶
BindingArgument = dict[str, typing.Any] | list[typing.Any] | str | int | float | bool | None
StrictModel
¶
Bases: BaseModel
Base model that rejects fields outside the spec contract.
model_config
class-attribute
instance-attribute
¶
model_config = pydantic.ConfigDict(extra='forbid')
SpecSource
¶
Bases: StrictModel
Describe how a spec document was authored or generated.
Dimension
¶
Bases: StrictModel
A globally defined grain under dimensions.
Argument
¶
Bases: StrictModel
A single argument entry under a function template's args.
Binding
¶
Bases: StrictModel
Wires an operation to a catalog function and its arguments.
dataset¶
uptimely.spec.model.dataset defines entities, datasets, features, and
their relationships.
Dataset and entity models for spec documents.
Entity
¶
Bases: StrictModel
An entry under the top-level entities block.
dimensions
class-attribute
instance-attribute
¶
dimensions: list[Dimension] = pydantic.Field(default_factory=list)
datasets
class-attribute
instance-attribute
¶
datasets: list[Dataset] = pydantic.Field(default_factory=list)
dimension_ids
property
¶
dimension_ids: list[str]
Return the identifiers of dimensions declared by this entity.
serialize_dimensions
¶
serialize_dimensions(dimensions: list[Dimension]) -> list[str]
Serialize entity dimensions as references in the spec document.
Dataset
¶
Bases: StrictModel
An entry under an entity's datasets list.
row_scope
class-attribute
instance-attribute
¶
row_scope: RowScope = pydantic.Field(default_factory=RowScope)
features
class-attribute
instance-attribute
¶
features: dict[str, Feature] = pydantic.Field(default_factory=dict)
mappings
class-attribute
instance-attribute
¶
mappings: dict[str, Mapping] = pydantic.Field(default_factory=dict)
order
class-attribute
instance-attribute
¶
order: list[Order] = pydantic.Field(default_factory=list)
all_features
property
¶
all_features: dict[str, Feature]
Return the declared feature metadata for this dataset.
Feature
¶
Bases: StrictModel
A dataset feature's logical metadata.
Order
¶
Bases: StrictModel
One logical dataset ordering key, without a physical row-order guarantee.
RowScope
¶
Bases: StrictModel
The conceptual row subset represented by a dataset.
Mapping
¶
Bases: StrictModel
A function binding with declared feature inputs, outputs, and row context.
MappingFeatures
¶
Bases: StrictModel
Explicit data prerequisites and produced features for one mapping.
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)
validate_references
classmethod
¶
validate_references(values: list[str]) -> list[str]
Require distinct feature references without value selectors.
functions¶
uptimely.spec.model.functions defines reusable function metadata and the
function catalog.
Function definitions and operation rules for spec documents.
FunctionTemplate
¶
Bases: StrictModel
One logical function definition in the spec catalog.
validate_signature
class-attribute
instance-attribute
¶
validate_signature: bool = pydantic.Field(default=True, description='Whether to inspect the Python signature and check implementation contracts.')
args
class-attribute
instance-attribute
¶
args: dict[str, Argument] = pydantic.Field(default_factory=dict)
FunctionCatalog
¶
Bases: RootModel[dict[str, FunctionTemplate]]
Function definitions keyed by their globally unique identifiers.
root
class-attribute
instance-attribute
¶
root: dict[str, FunctionTemplate] = pydantic.Field(default_factory=dict)
by_operation
¶
by_operation(operation: FunctionOperation) -> dict[str, FunctionTemplate]
Return function definitions for one operation.
get
¶
get(function_id: str, default: Any = None) -> FunctionTemplate | typing.Any
Return one function definition, or a default when it is absent.
For supported operation types and values, see function contracts.