Targets (🧪Beta)
albert.resources.targets
ComparisonOperator
How a measured value is compared against a target value.
Attributes:
| Name | Type | Description |
|---|---|---|
EQ |
str
|
Equal to the target value. |
GT |
str
|
Strictly greater than the target value. |
GTE |
str
|
Greater than or equal to the target value. |
LT |
str
|
Strictly less than the target value. |
LTE |
str
|
Less than or equal to the target value. |
BETWEEN |
str
|
Within an inclusive range; pairs with a |
IN_SET |
str
|
Among a set of allowed values; pairs with a list value. |
NumericRange
Bases: BaseAlbertModel
An inclusive numeric range, used with the between operator.
Show JSON schema:
{
"description": "An inclusive numeric range, used with the ``between`` operator.",
"properties": {
"min": {
"description": "The lower bound of the range.",
"title": "Min",
"type": "number"
},
"max": {
"description": "The upper bound of the range.",
"title": "Max",
"type": "number"
}
},
"required": [
"min",
"max"
],
"title": "NumericRange",
"type": "object"
}
Fields:
Criterion
Bases: BaseAlbertModel
A target value constraint: an operator paired with a value to compare against.
Show JSON schema:
{
"$defs": {
"ComparisonOperator": {
"description": "How a measured value is compared against a target value.\n\nAttributes\n----------\nEQ : str\n Equal to the target value.\nGT : str\n Strictly greater than the target value.\nGTE : str\n Greater than or equal to the target value.\nLT : str\n Strictly less than the target value.\nLTE : str\n Less than or equal to the target value.\nBETWEEN : str\n Within an inclusive range; pairs with a [`NumericRange`][albert.resources.targets.NumericRange] value.\nIN_SET : str\n Among a set of allowed values; pairs with a list value.",
"enum": [
"eq",
"gt",
"gte",
"lt",
"lte",
"between",
"in-set"
],
"title": "ComparisonOperator",
"type": "string"
},
"NumericRange": {
"description": "An inclusive numeric range, used with the ``between`` operator.",
"properties": {
"min": {
"description": "The lower bound of the range.",
"title": "Min",
"type": "number"
},
"max": {
"description": "The upper bound of the range.",
"title": "Max",
"type": "number"
}
},
"required": [
"min",
"max"
],
"title": "NumericRange",
"type": "object"
}
},
"description": "A target value constraint: an operator paired with a value to compare against.",
"properties": {
"operator": {
"$ref": "#/$defs/ComparisonOperator",
"description": "How the measured value is compared against ``value``."
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/NumericRange"
},
{
"type": "string"
},
{
"type": "number"
},
{
"items": {},
"type": "array"
}
],
"description": "The value being compared against. Use a [`NumericRange`][albert.resources.targets.NumericRange] with the ``between`` operator, a list with the ``in-set`` operator, or a single number/string for the scalar operators.",
"title": "Value"
}
},
"required": [
"operator",
"value"
],
"title": "Criterion",
"type": "object"
}
Fields:
-
operator(ComparisonOperator) -
value(NumericRange | str | float | list)
value
value: NumericRange | str | float | list
The value being compared against. Use a NumericRange with the between operator, a list with the in-set operator, or a single number/string for the scalar operators.
TargetType
The kind of target.
Attributes:
| Name | Type | Description |
|---|---|---|
PERFORMANCE |
str
|
A performance target: a desired value or range for a measured property. |
TargetParameter
Bases: BaseAlbertModel
A parameter condition under which a target is measured.
Targets can be scoped to specific parameter settings (for example, "at 25 °C").
Each TargetParameter names a parameter and, optionally, the value it must
take for the target to apply.
Show JSON schema:
{
"$defs": {
"ComparisonOperator": {
"description": "How a measured value is compared against a target value.\n\nAttributes\n----------\nEQ : str\n Equal to the target value.\nGT : str\n Strictly greater than the target value.\nGTE : str\n Greater than or equal to the target value.\nLT : str\n Strictly less than the target value.\nLTE : str\n Less than or equal to the target value.\nBETWEEN : str\n Within an inclusive range; pairs with a [`NumericRange`][albert.resources.targets.NumericRange] value.\nIN_SET : str\n Among a set of allowed values; pairs with a list value.",
"enum": [
"eq",
"gt",
"gte",
"lt",
"lte",
"between",
"in-set"
],
"title": "ComparisonOperator",
"type": "string"
},
"Criterion": {
"description": "A target value constraint: an operator paired with a value to compare against.",
"properties": {
"operator": {
"$ref": "#/$defs/ComparisonOperator",
"description": "How the measured value is compared against ``value``."
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/NumericRange"
},
{
"type": "string"
},
{
"type": "number"
},
{
"items": {},
"type": "array"
}
],
"description": "The value being compared against. Use a [`NumericRange`][albert.resources.targets.NumericRange] with the ``between`` operator, a list with the ``in-set`` operator, or a single number/string for the scalar operators.",
"title": "Value"
}
},
"required": [
"operator",
"value"
],
"title": "Criterion",
"type": "object"
},
"NumericRange": {
"description": "An inclusive numeric range, used with the ``between`` operator.",
"properties": {
"min": {
"description": "The lower bound of the range.",
"title": "Min",
"type": "number"
},
"max": {
"description": "The upper bound of the range.",
"title": "Max",
"type": "number"
}
},
"required": [
"min",
"max"
],
"title": "NumericRange",
"type": "object"
},
"ParameterCategory": {
"description": "Whether a [`Parameter`][albert.resources.parameters.Parameter]'s value is a plain scalar or an entity reference.\n\nSet by the platform and read-only. It determines how a parameter's value is\ninterpreted when a setpoint is assigned to it inside a\n[`Workflow`][albert.resources.workflows.Workflow].\n\nAttributes\n----------\nNORMAL : str\n A \"normal\" parameter whose value is a plain scalar (e.g. a number or text),\n such as Temperature or Spin Speed.\nSPECIAL : str\n A \"special\" parameter whose value references another entity (e.g. Equipment,\n a Consumable, or a Template). The setpoint value is that entity's ID rather\n than a plain scalar.",
"enum": [
"Normal",
"Special"
],
"title": "ParameterCategory",
"type": "string"
}
},
"description": "A parameter condition under which a target is measured.\n\nTargets can be scoped to specific parameter settings (for example, \"at 25 \u00b0C\").\nEach ``TargetParameter`` names a parameter and, optionally, the value it must\ntake for the target to apply.",
"properties": {
"id": {
"description": "The parameter ID (format ``PRM...``).",
"title": "Id",
"type": "string"
},
"parameterGroupId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The parameter group ID (format ``PRG...``) this parameter belongs to.",
"title": "Parametergroupid"
},
"category": {
"$ref": "#/$defs/ParameterCategory",
"description": "The category of the parameter."
},
"unitId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The unit ID (format ``UNI...``) for this parameter's value.",
"title": "Unitid"
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/Criterion"
},
{
"type": "null"
}
],
"default": null,
"description": "The value condition. Accepts an operator/value pair using one of the 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": {
"description": "The ordering position of this parameter.",
"title": "Sequence",
"type": "string"
}
},
"required": [
"id",
"category",
"sequence"
],
"title": "TargetParameter",
"type": "object"
}
Fields:
-
id(ParameterId) -
parameter_group_id(ParameterGroupId | None) -
category(ParameterCategory) -
unit_id(UnitId | None) -
value(Criterion | None) -
sequence(str)
Validators:
-
_coerce_legacy_value→value
parameter_group_id
parameter_group_id: ParameterGroupId | None = None
The parameter group ID (format PRG...) this parameter belongs to.
value
value: Criterion | None = None
The value condition. Accepts an operator/value pair using one of the 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>]}.
Target
Bases: BaseResource
A desired value or acceptable range for a measured property (🧪 Beta).
A target links a data template and data column (the property being measured)
to a target value constraint, optionally scoped to a project and to specific
parameter conditions. Managed through
TargetCollection (client.targets).
Example
from albert.resources.targets import (
Target,
TargetType,
Criterion,
ComparisonOperator,
)
target = Target(
name="Viscosity spec",
type=TargetType.PERFORMANCE,
data_template_id="DAT9999999",
data_column_id="DAC9999999",
target_value=Criterion(operator=ComparisonOperator.BETWEEN, value={"min": 10, "max": 20}),
is_required=True,
)
Show JSON schema:
{
"$defs": {
"AuditFields": {
"description": "The audit fields for a resource",
"properties": {
"by": {
"default": null,
"title": "By",
"type": "string"
},
"byName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Byname"
},
"at": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "At"
}
},
"title": "AuditFields",
"type": "object"
},
"ComparisonOperator": {
"description": "How a measured value is compared against a target value.\n\nAttributes\n----------\nEQ : str\n Equal to the target value.\nGT : str\n Strictly greater than the target value.\nGTE : str\n Greater than or equal to the target value.\nLT : str\n Strictly less than the target value.\nLTE : str\n Less than or equal to the target value.\nBETWEEN : str\n Within an inclusive range; pairs with a [`NumericRange`][albert.resources.targets.NumericRange] value.\nIN_SET : str\n Among a set of allowed values; pairs with a list value.",
"enum": [
"eq",
"gt",
"gte",
"lt",
"lte",
"between",
"in-set"
],
"title": "ComparisonOperator",
"type": "string"
},
"Criterion": {
"description": "A target value constraint: an operator paired with a value to compare against.",
"properties": {
"operator": {
"$ref": "#/$defs/ComparisonOperator",
"description": "How the measured value is compared against ``value``."
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/NumericRange"
},
{
"type": "string"
},
{
"type": "number"
},
{
"items": {},
"type": "array"
}
],
"description": "The value being compared against. Use a [`NumericRange`][albert.resources.targets.NumericRange] with the ``between`` operator, a list with the ``in-set`` operator, or a single number/string for the scalar operators.",
"title": "Value"
}
},
"required": [
"operator",
"value"
],
"title": "Criterion",
"type": "object"
},
"NumericRange": {
"description": "An inclusive numeric range, used with the ``between`` operator.",
"properties": {
"min": {
"description": "The lower bound of the range.",
"title": "Min",
"type": "number"
},
"max": {
"description": "The upper bound of the range.",
"title": "Max",
"type": "number"
}
},
"required": [
"min",
"max"
],
"title": "NumericRange",
"type": "object"
},
"ParameterCategory": {
"description": "Whether a [`Parameter`][albert.resources.parameters.Parameter]'s value is a plain scalar or an entity reference.\n\nSet by the platform and read-only. It determines how a parameter's value is\ninterpreted when a setpoint is assigned to it inside a\n[`Workflow`][albert.resources.workflows.Workflow].\n\nAttributes\n----------\nNORMAL : str\n A \"normal\" parameter whose value is a plain scalar (e.g. a number or text),\n such as Temperature or Spin Speed.\nSPECIAL : str\n A \"special\" parameter whose value references another entity (e.g. Equipment,\n a Consumable, or a Template). The setpoint value is that entity's ID rather\n than a plain scalar.",
"enum": [
"Normal",
"Special"
],
"title": "ParameterCategory",
"type": "string"
},
"Status": {
"description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n The resource is fully operational and visible in normal operations.\nINACTIVE : str\n The resource is hidden from normal operations and disabled from use.",
"enum": [
"active",
"inactive"
],
"title": "Status",
"type": "string"
},
"TargetParameter": {
"description": "A parameter condition under which a target is measured.\n\nTargets can be scoped to specific parameter settings (for example, \"at 25 \u00b0C\").\nEach ``TargetParameter`` names a parameter and, optionally, the value it must\ntake for the target to apply.",
"properties": {
"id": {
"description": "The parameter ID (format ``PRM...``).",
"title": "Id",
"type": "string"
},
"parameterGroupId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The parameter group ID (format ``PRG...``) this parameter belongs to.",
"title": "Parametergroupid"
},
"category": {
"$ref": "#/$defs/ParameterCategory",
"description": "The category of the parameter."
},
"unitId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The unit ID (format ``UNI...``) for this parameter's value.",
"title": "Unitid"
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/Criterion"
},
{
"type": "null"
}
],
"default": null,
"description": "The value condition. Accepts an operator/value pair using one of the 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": {
"description": "The ordering position of this parameter.",
"title": "Sequence",
"type": "string"
}
},
"required": [
"id",
"category",
"sequence"
],
"title": "TargetParameter",
"type": "object"
},
"TargetType": {
"description": "The kind of target.\n\nAttributes\n----------\nPERFORMANCE : str\n A performance target: a desired value or range for a measured property.",
"enum": [
"performance"
],
"title": "TargetType",
"type": "string"
}
},
"description": "A desired value or acceptable range for a measured property (\ud83e\uddea Beta).\n\nA target links a data template and data column (the property being measured)\nto a target value constraint, optionally scoped to a project and to specific\nparameter conditions. Managed through\n[`TargetCollection`][albert.collections.targets.TargetCollection] (``client.targets``).\n\n!!! example\n ```python\n from albert.resources.targets import (\n Target,\n TargetType,\n Criterion,\n ComparisonOperator,\n )\n target = Target(\n name=\"Viscosity spec\",\n type=TargetType.PERFORMANCE,\n data_template_id=\"DAT9999999\",\n data_column_id=\"DAC9999999\",\n target_value=Criterion(operator=ComparisonOperator.BETWEEN, value={\"min\": 10, \"max\": 20}),\n is_required=True,\n )\n ```",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null,
"description": "The status of the resource, optional."
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the creation of the resource, optional."
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null,
"description": "Audit fields for the update of the resource, optional."
},
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert ID of the target (format ``TAR...``). Set when the target is retrieved from or created in Albert.",
"title": "Id"
},
"name": {
"description": "The name of the target.",
"title": "Name",
"type": "string"
},
"type": {
"$ref": "#/$defs/TargetType",
"description": "The kind of target (e.g. performance)."
},
"parentId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The ID of the project (format ``PRO...``) this target belongs to. When set, the target inherits its ACL (access control) policy from that project.",
"title": "Parentid"
},
"dataTemplateId": {
"description": "The ID of the data template (format ``DAT...``) whose property is targeted.",
"title": "Datatemplateid",
"type": "string"
},
"dataColumnId": {
"description": "The ID of the data column (format ``DAC...``) being targeted.",
"title": "Datacolumnid",
"type": "string"
},
"unitId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The unit ID (format ``UNI...``) for the target value.",
"title": "Unitid"
},
"parameters": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/TargetParameter"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Parameter conditions under which the target applies.",
"title": "Parameters"
},
"targetValue": {
"$ref": "#/$defs/Criterion",
"description": "The target value constraint (operator plus value)."
},
"isRequired": {
"description": "Whether meeting this target is required.",
"title": "Isrequired",
"type": "boolean"
},
"validation": {
"anyOf": [
{
"items": {
"additionalProperties": true,
"type": "object"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Validation rules applied to the target value.",
"title": "Validation"
}
},
"required": [
"name",
"type",
"dataTemplateId",
"dataColumnId",
"targetValue",
"isRequired"
],
"title": "Target",
"type": "object"
}
Fields:
-
status(Status | None) -
created(AuditFields | None) -
updated(AuditFields | None) -
id(str | None) -
name(str) -
type(TargetType) -
parent_id(ProjectId | None) -
data_template_id(DataTemplateId) -
data_column_id(DataColumnId) -
unit_id(UnitId | None) -
parameters(list[TargetParameter] | None) -
target_value(Criterion) -
is_required(bool) -
validation(list[dict] | None)
id
id: str | None = None
The Albert ID of the target (format TAR...). Set when the target is retrieved from or created in Albert.
parent_id
parent_id: ProjectId | None = None
The ID of the project (format PRO...) this target belongs to. When set, the target inherits its ACL (access control) policy from that project.
data_template_id
data_template_id: DataTemplateId
The ID of the data template (format DAT...) whose property is targeted.
data_column_id
data_column_id: DataColumnId
The ID of the data column (format DAC...) being targeted.
parameters
parameters: list[TargetParameter] | None = None
Parameter conditions under which the target applies.