Smart Datasets (🧪Beta)
albert.collections.smart_datasets.SmartDatasetCollection
Bases: BaseCollection
Manage Smart Datasets in the Albert platform (🧪 Beta).
A Smart Dataset assembles experiment data from a defined scope (projects, targets, and worksheets) into a single record-by-variable matrix ready for analysis and modeling. Records are the experiments (or materials, lots, or measurements, depending on the aggregation level), and variables are the material amounts, parameters, molecules, and measured properties observed across those experiments.
A Smart Dataset is built asynchronously: after create (or an
update that changes the scope) the dataset moves through a build state
(SmartDatasetBuildState) and only
exposes its data once it is ready. Use get_data to pull the built
matrix, choosing how rows are aggregated with
SmartDatasetAggregateBy.
Smart Datasets are referenced by their Smart Dataset ID (format SDT...).
They aggregate the same experiment Property Data managed through
PropertyDataCollection.
A SmartDataset and a
BTDataset are distinct entities that share
an ETL engine (Zeus stored procedures) but are not interchangeable: a
BTDataset is a Breakthrough pointer record (its dataset rows are stored in
S3), while a SmartDataset is a Smart Projects entity (also S3-backed, via
storage_key and schema_). A SmartDataset is not itself an input to
Albert Breakthrough.
This collection is accessed as client.smart_datasets.
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
from albert import Albert
from albert.resources.smart_datasets import SmartDatasetScope
client = Albert()
# Build a smart dataset scoped to a single project
ds = client.smart_datasets.create(
scope=SmartDatasetScope(project_ids=["PRO123"]),
)
# Once ready, pull the experiment data matrix
data = client.smart_datasets.get_data(id=ds.id)
print(data.data)
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 smart dataset requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new smart dataset from a scope and (optionally) build it. |
get_all |
Iterate over all smart datasets for the tenant. |
get_by_id |
Get a single smart dataset by its ID. |
update |
Update an existing smart dataset. |
delete |
Delete a smart dataset by its ID. |
get_data |
Get the built experiment data matrix for a smart dataset. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/smart_datasets.py
create
create(
*,
scope: SmartDatasetScope,
parent_id: ProjectId | None = None,
build: bool = True,
) -> SmartDataset
Create a new smart dataset.
The scope defines which experiments feed the dataset (by project,
target, and optionally worksheet). When build is True the dataset is
populated asynchronously from Albert; poll its
build_state (or
re-fetch with get_by_id) until it reaches ready before calling
get_data.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scope
|
SmartDatasetScope
|
The scope defining which projects, targets, and worksheets the dataset draws its experiment data from. |
required |
parent_id
|
ProjectId
|
The ID of the parent project to inherit the ACL policy from. When set, the smart dataset inherits its ACL policy from the referenced project. |
None
|
build
|
bool
|
Whether to populate the smart dataset with data from Albert. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
SmartDataset
|
The created smart dataset, populated with its assigned Smart Dataset ID. |
Source code in src/albert/collections/smart_datasets.py
get_all
get_all(
*, max_items: int | None = None
) -> Iterator[SmartDataset]
Iterate over all smart datasets for the tenant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_items
|
int
|
Maximum number of datasets to return. If None, returns all available datasets, fetching additional pages as the iterator is consumed. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[SmartDataset]
|
An iterator over the tenant's smart datasets. |
Source code in src/albert/collections/smart_datasets.py
get_by_id
get_by_id(
*,
id: SmartDatasetId,
parent_id: ProjectId | None = None,
) -> SmartDataset
Get a single smart dataset by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
SmartDatasetId
|
The Smart Dataset ID (format |
required |
parent_id
|
ProjectId
|
The ID of the parent project to inherit the ACL policy from when the caller does not own the smart dataset record. |
None
|
Returns:
| Type | Description |
|---|---|
SmartDataset
|
The fully populated smart dataset. |
Source code in src/albert/collections/smart_datasets.py
update
update(*, smart_dataset: SmartDataset) -> SmartDataset
Update an existing smart dataset.
Fetch the smart dataset (e.g. with get_by_id), modify the
updatable fields on the returned object, then pass it here. Only the fields
listed in Notes are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smart_dataset
|
SmartDataset
|
The smart dataset with updated fields. Its |
required |
Returns:
| Type | Description |
|---|---|
SmartDataset
|
The updated smart dataset. |
Notes
Only the following fields are updatable: scope, build_state,
storage_key, and schema_. Changes to any other field are ignored.
Source code in src/albert/collections/smart_datasets.py
delete
delete(*, id: SmartDatasetId) -> None
Delete a smart dataset by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
SmartDatasetId
|
The Smart Dataset ID (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/smart_datasets.py
get_data
get_data(
*,
id: SmartDatasetId,
parent_id: ProjectId | None = None,
aggregate_by: SmartDatasetAggregateBy = PTD,
ids: list[str] | None = None,
variables: list[str] | None = None,
) -> SmartDatasetData
Get the built experiment data matrix for a smart dataset.
Returns the record-by-variable matrix assembled by the dataset, along with
the identifier metadata for each row and the variable metadata for each
column. The dataset must be built and ready before its data can be
retrieved.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
SmartDatasetId
|
The Smart Dataset ID (format |
required |
parent_id
|
ProjectId
|
The ID of the parent project to inherit the ACL policy from when the caller does not own the smart dataset record. |
None
|
aggregate_by
|
SmartDatasetAggregateBy
|
The aggregation level for the returned records (rows). Defaults to
|
PTD
|
ids
|
list[str]
|
Restrict the returned rows to these record identifier keys. |
None
|
variables
|
list[str]
|
Restrict the returned columns to these variable keys. |
None
|
Returns:
| Type | Description |
|---|---|
SmartDatasetData
|
The experiment data matrix with its identifiers and variable metadata. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the smart dataset's build state is not |