Skip to content

Dimensions and resolutions

Python-friendly dimension and resolution declarations.

Dimension dataclass

A logical dimension with its available dataframe-key resolutions.

id instance-attribute

id: str

resolutions instance-attribute

resolutions: Sequence[Resolution]

description class-attribute instance-attribute

description: str | None = None

name class-attribute instance-attribute

name: str | None = None

resolution

resolution(name: str) -> Resolution

Return a selected resolution by ID, associated with this dimension.

Raises:

Type Description
ValueError

If the resolution is not declared in this dimension.

at

at(name: str) -> Resolution

Return the resolution with the given ID.

Parameters:

Name Type Description Default
name str

Resolution identifier.

required

Returns:

Type Description
Resolution

The resolution associated with this dimension.

to_model

to_model() -> spec_model.Dimension

Convert this dimension declaration to its JSON model.

Resolution dataclass

A dataframe key resolution within a dimension.

id instance-attribute

id: str

key instance-attribute

key: str

type instance-attribute

type: str

parent class-attribute instance-attribute

parent: str | None = None

name class-attribute instance-attribute

name: str | None = dataclasses.field(default=None, kw_only=True)

dimension property

dimension: Dimension | None

Return the owning dimension when selected through Dimension.at.

to_model

to_model() -> spec_model.Resolution

Convert this resolution declaration to its document model.