Targets (🧪Beta)
albert.collections.targets.TargetCollection
Bases: BaseCollection
Manage Targets in the Albert platform (🧪 Beta).
A Target is a desired value or acceptable range for a measured property. It
ties a data template and data column (the property being measured) to a
target value constraint (Criterion, e.g.
"greater than or equal to 90" or "between 10 and 20"), optionally scoped to a
project and to specific parameter conditions. Targets let you express the
performance a formulation is aiming for and compare results against it.
Targets are referenced by their Target ID (format TAR..., e.g. "TAR1").
This collection is accessed as client.targets.
Beta Feature!
Please do not use in production or without explicit guidance from Albert. You might otherwise have a bad experience. This feature currently falls outside of the Albert support contract, but we'd love your feedback!
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for target requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new target. |
get_by_id |
Get a single target by its ID. |
get_by_ids |
Get many targets by their IDs. |
delete |
Delete a target by its ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/targets.py
create
Create a new target.
Example
from albert.resources.targets import (
Target,
TargetType,
Criterion,
ComparisonOperator,
)
target = client.targets.create(
target=Target(
name="Viscosity spec",
type=TargetType.PERFORMANCE,
data_template_id="DAT9999999",
data_column_id="DAC9999999",
target_value=Criterion(operator=ComparisonOperator.GTE, value=90),
is_required=True,
)
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Target
|
The target to create. |
required |
Returns:
| Type | Description |
|---|---|
Target
|
The newly created target, including its assigned Target ID. |
Source code in src/albert/collections/targets.py
get_by_id
Get a single target by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
TargetId
|
The Target ID to retrieve (format |
required |
parent_id
|
ProjectId
|
The ID of a parent project to inherit the ACL (access control) policy from when the caller does not own the target record. Supply this if a plain lookup is denied for permission reasons. |
None
|
Returns:
| Type | Description |
|---|---|
Target
|
The fully populated target. |
Source code in src/albert/collections/targets.py
get_by_ids
Get many targets by their IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[TargetId]
|
The Target IDs to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
list[Target]
|
The matching targets. Targets not found are omitted. |