Skip to content

Targets (🧪Beta)

albert.resources.targets

ComparisonOperator

Bases: str, Enum

Enumeration of value comparison operators.

Attributes:

Name Type Description
EQ str

Equal to.

GTE str

Greater than or equal to.

LTE str

Less than or equal to.

BETWEEN str

Between a range.

IN_SET str

In a set of values.

EQ

EQ = 'eq'

GT

GT = 'gt'

GTE

GTE = 'gte'

LT

LT = 'lt'

LTE

LTE = 'lte'

BETWEEN

BETWEEN = 'between'

IN_SET

IN_SET = 'in-set'

NumericRange

Bases: BaseAlbertModel

Represents a range value for a target (used with the 'between' operator).

Attributes:

Name Type Description
min float

The minimum value.

max float

The maximum value.

Show JSON schema:
{
  "description": "Represents a range value for a target (used with the 'between' operator).\n\nAttributes\n----------\nmin : float\n    The minimum value.\nmax : float\n    The maximum value.",
  "properties": {
    "min": {
      "title": "Min",
      "type": "number"
    },
    "max": {
      "title": "Max",
      "type": "number"
    }
  },
  "required": [
    "min",
    "max"
  ],
  "title": "NumericRange",
  "type": "object"
}

Fields:

min

min: float

max

max: float

Criterion

Bases: BaseAlbertModel

Represents the target value constraint.

Attributes:

Name Type Description
operator ComparisonOperator

The comparison operator.

value NumericRange | str | float | list

The target value. Can be a range, single value, or list of values.

Show JSON schema:
{
  "$defs": {
    "ComparisonOperator": {
      "description": "Enumeration of value comparison operators.\n\nAttributes\n----------\nEQ : str\n    Equal to.\nGTE : str\n    Greater than or equal to.\nLTE : str\n    Less than or equal to.\nBETWEEN : str\n    Between a range.\nIN_SET : str\n    In a set of values.",
      "enum": [
        "eq",
        "gt",
        "gte",
        "lt",
        "lte",
        "between",
        "in-set"
      ],
      "title": "ComparisonOperator",
      "type": "string"
    },
    "NumericRange": {
      "description": "Represents a range value for a target (used with the 'between' operator).\n\nAttributes\n----------\nmin : float\n    The minimum value.\nmax : float\n    The maximum value.",
      "properties": {
        "min": {
          "title": "Min",
          "type": "number"
        },
        "max": {
          "title": "Max",
          "type": "number"
        }
      },
      "required": [
        "min",
        "max"
      ],
      "title": "NumericRange",
      "type": "object"
    }
  },
  "description": "Represents the target value constraint.\n\nAttributes\n----------\noperator : ComparisonOperator\n    The comparison operator.\nvalue : NumericRange | str | float | list\n    The target value. Can be a range, single value, or list of values.",
  "properties": {
    "operator": {
      "$ref": "#/$defs/ComparisonOperator"
    },
    "value": {
      "anyOf": [
        {
          "$ref": "#/$defs/NumericRange"
        },
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "items": {},
          "type": "array"
        }
      ],
      "title": "Value"
    }
  },
  "required": [
    "operator",
    "value"
  ],
  "title": "Criterion",
  "type": "object"
}

Fields:

operator

value

value: NumericRange | str | float | list

TargetType

Bases: str, Enum

Enumeration of target types.

Attributes:

Name Type Description
PERFORMANCE str

A performance target.

PERFORMANCE

PERFORMANCE = 'performance'

TargetParameter

Bases: BaseAlbertModel

Represents a parameter filter condition at which a target is measured.

Attributes:

Name Type Description
id str

The parameter ID.

parameter_group_id str | None

The parameter group ID.

category ParameterCategory

The parameter category.

unit_id str | None

The unit ID for this parameter.

value Criterion | None

The value filter. Accepts an operator/value-pair object with one of the following operators: eq, gte, lte, between, in-set. For between, the value must be {"min": ..., "max": ...}. For in-set, the value must be a list. Legacy bare scalars (numeric or string) are coerced on read: a numeric scalar becomes {"operator": "eq", "value": <n>} and a string becomes {"operator": "in-set", "value": [<s>]}.

sequence str

The parameter sequence.

Show JSON schema:
{
  "$defs": {
    "ComparisonOperator": {
      "description": "Enumeration of value comparison operators.\n\nAttributes\n----------\nEQ : str\n    Equal to.\nGTE : str\n    Greater than or equal to.\nLTE : str\n    Less than or equal to.\nBETWEEN : str\n    Between a range.\nIN_SET : str\n    In a set of values.",
      "enum": [
        "eq",
        "gt",
        "gte",
        "lt",
        "lte",
        "between",
        "in-set"
      ],
      "title": "ComparisonOperator",
      "type": "string"
    },
    "Criterion": {
      "description": "Represents the target value constraint.\n\nAttributes\n----------\noperator : ComparisonOperator\n    The comparison operator.\nvalue : NumericRange | str | float | list\n    The target value. Can be a range, single value, or list of values.",
      "properties": {
        "operator": {
          "$ref": "#/$defs/ComparisonOperator"
        },
        "value": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumericRange"
            },
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "items": {},
              "type": "array"
            }
          ],
          "title": "Value"
        }
      },
      "required": [
        "operator",
        "value"
      ],
      "title": "Criterion",
      "type": "object"
    },
    "NumericRange": {
      "description": "Represents a range value for a target (used with the 'between' operator).\n\nAttributes\n----------\nmin : float\n    The minimum value.\nmax : float\n    The maximum value.",
      "properties": {
        "min": {
          "title": "Min",
          "type": "number"
        },
        "max": {
          "title": "Max",
          "type": "number"
        }
      },
      "required": [
        "min",
        "max"
      ],
      "title": "NumericRange",
      "type": "object"
    },
    "ParameterCategory": {
      "description": "The category of a parameter",
      "enum": [
        "Normal",
        "Special"
      ],
      "title": "ParameterCategory",
      "type": "string"
    }
  },
  "description": "Represents a parameter filter condition at which a target is measured.\n\nAttributes\n----------\nid : str\n    The parameter ID.\nparameter_group_id : str | None\n    The parameter group ID.\ncategory : ParameterCategory\n    The parameter category.\nunit_id : str | None\n    The unit ID for this parameter.\nvalue : Criterion | None\n    The value filter. Accepts an operator/value-pair object with one of the\n    following operators: ``eq``, ``gte``, ``lte``, ``between``, ``in-set``.\n    For ``between``, the value must be ``{\"min\": ..., \"max\": ...}``.\n    For ``in-set``, the value must be a list.\n    Legacy bare scalars (numeric or string) are coerced on read: a numeric\n    scalar becomes ``{\"operator\": \"eq\", \"value\": <n>}`` and a string becomes\n    ``{\"operator\": \"in-set\", \"value\": [<s>]}``.\nsequence : str\n    The parameter sequence.",
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "parameterGroupId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Parametergroupid"
    },
    "category": {
      "$ref": "#/$defs/ParameterCategory"
    },
    "unitId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Unitid"
    },
    "value": {
      "anyOf": [
        {
          "$ref": "#/$defs/Criterion"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "sequence": {
      "title": "Sequence",
      "type": "string"
    }
  },
  "required": [
    "id",
    "category",
    "sequence"
  ],
  "title": "TargetParameter",
  "type": "object"
}

Fields:

Validators:

  • _coerce_legacy_valuevalue

id

parameter_group_id

parameter_group_id: ParameterGroupId | None = None

category

unit_id

unit_id: UnitId | None = None

value

value: Criterion | None = None

sequence

sequence: str

Target

Bases: BaseResource

Represents a target entity.

Attributes:

Name Type Description
id str | None

The unique identifier of the target. Set when retrieved from Albert.

name str

The name of the target.

type TargetType

The type of target.

parent_id str | None

The ID of the project this target belongs to. When set, the target inherits its ACL policy from the referenced project.

data_template_id str

The ID of the associated data template.

data_column_id str

The ID of the associated data column.

unit_id str | None

The unit ID for this target.

parameters list[TargetParameter] | None

Parameter filter conditions for the target.

validation list[dict] | None

Validation rules for the target value.

target_value Criterion

The target value constraint.

is_required bool

Whether this target is required.

validation list[dict] | None

Validation rules for the target.

id

id: str | None = Field(default=None)

name

name: str

type

type: TargetType

parent_id

parent_id: ProjectId | None = Field(
    default=None, alias="parentId"
)

data_template_id

data_template_id: DataTemplateId = Field(
    alias="dataTemplateId"
)

data_column_id

data_column_id: DataColumnId = Field(alias='dataColumnId')

unit_id

unit_id: UnitId | None = Field(default=None, alias="unitId")

parameters

parameters: list[TargetParameter] | None = Field(
    default=None
)

target_value

target_value: Criterion = Field(alias='targetValue')

is_required

is_required: bool = Field(alias='isRequired')

validation

validation: list[dict] | None = Field(default=None)