Albert Client
albert.albert
Albert
Albert(
*,
base_url: str | None = None,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
session: AlbertSession | None = None,
)
Albert is the main client class for interacting with the Albert API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL of the Albert API (default is "https://app.albertinvent.com"). |
None
|
token
|
str
|
The token for authentication (default is read from environment variable "ALBERT_TOKEN"). |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication.
Client credentials can be read from the environment by |
None
|
retries
|
int
|
The maximum number of retries for failed requests (default is None). |
None
|
session
|
AlbertSession
|
An optional preconfigured session to use for API requests. If not provided,
a default session is created using the other parameters or environment variables.
When supplied, |
None
|
Attributes:
Name | Type | Description |
---|---|---|
session |
AlbertSession
|
The session for API requests, with a base URL set. |
projects |
ProjectCollection
|
The project collection instance. |
tags |
TagCollection
|
The tag collection instance. |
inventory |
InventoryCollection
|
The inventory collection instance. |
companies |
CompanyCollection
|
The company collection instance. |
Source code in src/albert/albert.py
session
instance-attribute
session = session or AlbertSession(
base_url=base_url
or getenv("ALBERT_BASE_URL")
or "https://app.albertinvent.com",
token=token or getenv("ALBERT_TOKEN"),
client_credentials=client_credentials or from_env(),
retries=retries,
)
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
client_credentials: ClientCredentials | None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL to prefix to all requests. (e.g., "https://sandbox.albertinvent.com") |
required |
retries
|
int
|
The number of retries for failed requests. Defaults to 3. |
None
|
client_credentials
|
ClientCredentials | None
|
The client credentials for programmatic authentication. Optional if token is provided. |
None
|
token
|
str | None
|
The JWT token for authentication. Optional if client credentials are provided. |
None
|
Methods:
Name | Description |
---|---|
request |
|
Source code in src/albert/session.py
request
Source code in src/albert/session.py
AttachmentCollection
Bases: BaseCollection
AttachmentCollection is a collection class for managing Attachment entities in the Albert platform.
Methods:
Name | Description |
---|---|
attach_file_to_note |
Attaches an already uploaded file to a note. |
delete |
Deletes an attachment by ID. |
upload_and_attach_file_as_note |
Uploads a file and attaches it to a new note. A user can be tagged in the note_text string by using f-string and the User.to_note_mention() method. |
Source code in src/albert/collections/attachments.py
attach_file_to_note
attach_file_to_note(
*,
note_id: str,
file_name: str,
file_key: str,
category: FileCategory = OTHER,
) -> Attachment
Attaches an already uploaded file to a note.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
note_id
|
str
|
The ID of the note to attach the file to. |
required |
file_name
|
str
|
The name of the file to attach. |
required |
file_key
|
str
|
The unique key of the file to attach (the returned upload name). |
required |
category
|
FileCategory
|
The type of file, by default FileCategory.OTHER |
OTHER
|
Returns:
Type | Description |
---|---|
Attachment
|
The related attachment object. |
Source code in src/albert/collections/attachments.py
delete
delete(*, id: str) -> None
Deletes an attachment by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the attachment to delete. |
required |
upload_and_attach_file_as_note
upload_and_attach_file_as_note(
parent_id: str,
file_data: IO,
note_text: str = "",
file_name: str = "",
) -> Note
Uploads a file and attaches it to a new note. A user can be tagged in the note_text string by using f-string and the User.to_note_mention() method. This allows for easy tagging and referencing of users within notes. example: f"Hello {tagged_user.to_note_mention()}!"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_id
|
str
|
The ID of the parent entity onto which the note will be attached. |
required |
file_data
|
IO
|
The file data to upload. |
required |
note_text
|
str
|
Any additional text to add to the note, by default "" |
''
|
file_name
|
str
|
The name of the file, by default "" |
''
|
Returns:
Type | Description |
---|---|
Note
|
The created note. |
Source code in src/albert/collections/attachments.py
BTDatasetCollection
BTDatasetCollection(*, session: AlbertSession)
Bases: BaseCollection
BTDatasetCollection is a collection class for managing Breakthrough dataset entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
str
|
The base path for btdataset API requests. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new BTDataset. |
delete |
Delete a BTDataset by ID. |
get_all |
Get all items from the BTDataset collection. |
get_by_id |
Get a BTDataset by ID. |
update |
Update a BTDataset. |
Source code in src/albert/collections/btdataset.py
create
Create a new BTDataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset
|
BTDataset
|
The BTDataset record to create. |
required |
Returns:
Type | Description |
---|---|
BTDataset
|
The created BTDataset. |
Source code in src/albert/collections/btdataset.py
delete
delete(*, id: BTDatasetId) -> None
Delete a BTDataset by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTDatasetId
|
The ID of the BTDataset to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/btdataset.py
get_all
get_all(
*,
limit: int = 100,
name: str | None = None,
start_key: str | None = None,
created_by: str | None = None,
) -> Iterator[BTDataset]
Get all items from the BTDataset collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Number of items to return per page, default 100 |
100
|
name
|
str
|
Name of the dataset to filter by, default None |
None
|
start_key
|
str
|
The starting key for pagination, default None |
None
|
created_by
|
str
|
The user who created the dataset, default None |
None
|
Returns:
Type | Description |
---|---|
Iterator[BTDataset]
|
An iterator of elements returned by the BTDataset listing. |
Source code in src/albert/collections/btdataset.py
get_by_id
get_by_id(*, id: BTDatasetId) -> BTDataset
Get a BTDataset by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTDatasetId
|
The Albert ID of the BTDataset. |
required |
Returns:
Type | Description |
---|---|
BTDataset
|
The retrived BTDataset. |
Source code in src/albert/collections/btdataset.py
update
Update a BTDataset.
The provided dataset must be registered with an Albert ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset
|
BTDataset
|
The BTDataset with updated fields. |
required |
Returns:
Type | Description |
---|---|
BTDataset
|
The updated BTDataset object. |
Source code in src/albert/collections/btdataset.py
BTInsightCollection
BTInsightCollection(*, session: AlbertSession)
Bases: BaseCollection
BTInsightCollection is a collection class for managing Breakthrough insight entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
str
|
The base path for BTInsight API requests. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new BTInsight. |
delete |
Delete a BTInsight by ID. |
get_by_id |
Get a BTInsight by ID. |
search |
Search for items in the BTInsight collection. |
update |
Update a BTInsight. |
Source code in src/albert/collections/btinsight.py
create
Create a new BTInsight.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
insight
|
BTInsight
|
The BTInsight record to create. |
required |
Returns:
Type | Description |
---|---|
BTInsight
|
The created BTInsight. |
Source code in src/albert/collections/btinsight.py
delete
delete(*, id: BTInsightId) -> None
Delete a BTInsight by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the BTInsight to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/btinsight.py
get_by_id
get_by_id(*, id: BTInsightId) -> BTInsight
Get a BTInsight by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTInsightId
|
The Albert ID of the insight. |
required |
Returns:
Type | Description |
---|---|
BTInsight
|
The retrived BTInsight. |
Source code in src/albert/collections/btinsight.py
search
search(
*,
limit: int = 100,
offset: int | None = None,
order_by: OrderBy | None = None,
sort_by: str | None = None,
text: str | None = None,
name: str | list[str] | None = None,
state: BTInsightState
| list[BTInsightState]
| None = None,
category: BTInsightCategory
| list[BTInsightCategory]
| None = None,
) -> Iterator[BTInsight]
Search for items in the BTInsight collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Number of items to return per page, default 100 |
100
|
offset
|
int | None
|
Item offset to begin search at, default None |
None
|
order_by
|
OrderBy | None
|
Asc/desc ordering, default None |
None
|
sort_by
|
str | None
|
Sort field, default None |
None
|
text
|
str | None
|
Text field in search query, default None |
None
|
name
|
str | list[str] | None
|
BTInsight name search filter, default None |
None
|
state
|
BTInsightState | list[BTInsightState] | None
|
BTInsight state search filter, default None |
None
|
category
|
BTInsightCategory | list[BTInsightCategory] | None
|
BTInsight category search filter, default None |
None
|
Returns:
Type | Description |
---|---|
Iterator[BTInsight]
|
An iterator of elements returned by the BTInsight search query. |
Source code in src/albert/collections/btinsight.py
update
Update a BTInsight.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
insight
|
BTInsight
|
The BTInsight to update. |
required |
Returns:
Type | Description |
---|---|
BTInsight
|
The updated BTInsight. |
Source code in src/albert/collections/btinsight.py
BTModelCollection
BTModelCollection(*, session: AlbertSession)
Bases: BaseCollection
BTModelCollection is a collection class for managing Breakthrough model entities.
Breakthrough models can be associated with a parent Breakthrough model session, or a detached without a parent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new BTModel instance. |
delete |
Delete a BTModel by ID. |
get_by_id |
Retrieve a BTModel by its ID. |
update |
Update an existing BTModel. |
Source code in src/albert/collections/btmodel.py
create
create(
*,
model: BTModel,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Create a new BTModel instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
BTModel
|
The BTModel instance to create. |
required |
parent_id
|
BTModelSessionId | None
|
The optional ID of the parent BTModelSession. |
None
|
Returns:
Type | Description |
---|---|
BTModel
|
The created BTModel instance. |
Source code in src/albert/collections/btmodel.py
delete
delete(
*,
id: BTModelId,
parent_id: BTModelSessionId | None = None,
) -> None
Delete a BTModel by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTModelId
|
The ID of the BTModel to delete. |
required |
parent_id
|
BTModelSessionId | None
|
The optional ID of the parent BTModelSession. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/btmodel.py
get_by_id
get_by_id(
*,
id: BTModelId,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Retrieve a BTModel by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTModelId
|
The ID of the BTModel to retrieve. |
required |
parent_id
|
BTModelSessionId | None
|
The optional ID of the parent BTModelSession. |
None
|
Returns:
Type | Description |
---|---|
BTModel
|
The retrieved BTModel instance. |
Source code in src/albert/collections/btmodel.py
update
update(
*,
model: BTModel,
parent_id: BTModelSessionId | None = None,
) -> BTModel
Update an existing BTModel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
BTModel
|
The BTModel instance with updated data. |
required |
parent_id
|
BTModelSessionId | None
|
The optional ID of the parent BTModelSession. |
None
|
Returns:
Type | Description |
---|---|
BTModel
|
The updated BTModel instance. |
Source code in src/albert/collections/btmodel.py
BTModelSessionCollection
BTModelSessionCollection(*, session: AlbertSession)
Bases: BaseCollection
BTModelSessionCollection is a collection class for managing Breakthrough model session entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
str
|
The base path for BTModelSession API requests. |
Methods:
Name | Description |
---|---|
create |
|
delete |
Delete a BTModelSession by ID. |
get_by_id |
|
update |
|
Source code in src/albert/collections/btmodel.py
create
create(*, model_session: BTModelSession) -> BTModelSession
Source code in src/albert/collections/btmodel.py
delete
delete(*, id: BTModelSessionId) -> None
Delete a BTModelSession by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
BTModelSessionId
|
The ID of the BTModelSession to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/btmodel.py
get_by_id
get_by_id(*, id: BTModelSessionId) -> BTModelSession
update
update(*, model_session: BTModelSession) -> BTModelSession
Source code in src/albert/collections/btmodel.py
BatchDataCollection
BatchDataCollection(*, session: AlbertSession)
Bases: BaseCollection
BatchDataCollection is a collection class for managing BatchData entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create_batch_data |
Create a new batch data entry. |
get |
Retrieve BatchData by ID. |
update_used_batch_amounts |
Update the used batch amounts for a given task ID. |
Source code in src/albert/collections/batch_data.py
create_batch_data
create_batch_data(*, task_id: TaskId)
Create a new batch data entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task for which the batch data is being created. |
required |
Returns:
Type | Description |
---|---|
BatchData
|
The created BatchData object. |
Source code in src/albert/collections/batch_data.py
get
get(
*,
id: TaskId,
type: BatchDataType = TASK_ID,
limit: int = 100,
start_key: str | None = None,
order_by: OrderBy = DESCENDING,
) -> BatchData
Retrieve BatchData by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
Unique Id of the selected type. |
required |
type
|
BatchDataType
|
Type of Id for which BatchData will be fetched. |
TASK_ID
|
limit
|
int
|
The maximum number of list entities to return. |
100
|
start_key
|
str
|
The primary key of the first item that this operation will evaluate. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING |
DESCENDING
|
Returns:
Type | Description |
---|---|
BatchData
|
The BatchData object. |
Source code in src/albert/collections/batch_data.py
update_used_batch_amounts
update_used_batch_amounts(
*, task_id: str, patches=list[BatchValuePatchPayload]
) -> None
Update the used batch amounts for a given task ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The ID of the task to update. |
required |
patches
|
list[BatchValuePatchPayload]
|
The patch payloads containing the data to update. |
list[BatchValuePatchPayload]
|
Returns:
Type | Description |
---|---|
None
|
This method does not return anything. |
Source code in src/albert/collections/batch_data.py
CasCollection
CasCollection(*, session: AlbertSession)
Bases: BaseCollection
CasCollection is a collection class for managing Cas entities on the Albert Platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
cas_exists |
Checks if a CAS exists by its number. |
create |
Creates a new CAS entity. |
delete |
Deletes a CAS by its ID. |
get_by_id |
Retrieves a CAS by its ID. |
get_by_number |
Retrieves a CAS by its number. |
list |
Lists CAS entities with optional filters. |
update |
Updates a CAS entity. The updated object must have the same ID as the object you want to update. |
Source code in src/albert/collections/cas.py
cas_exists
Checks if a CAS exists by its number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The number of the CAS to check. |
required |
exact_match
|
bool
|
Whether to match the number exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if the CAS exists, False otherwise. |
Source code in src/albert/collections/cas.py
create
Creates a new CAS entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cas
|
Union[str, Cas]
|
The CAS number or Cas object to create. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The created Cas object. |
Source code in src/albert/collections/cas.py
delete
delete(*, id: str) -> None
Deletes a CAS by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the CAS to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/cas.py
get_by_id
Retrieves a CAS by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the CAS to retrieve. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The Cas object if found, None otherwise. |
Source code in src/albert/collections/cas.py
get_by_number
Retrieves a CAS by its number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number
|
str
|
The number of the CAS to retrieve. |
required |
exact_match
|
bool
|
Whether to match the number exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
Optional[Cas]
|
The Cas object if found, None otherwise. |
Source code in src/albert/collections/cas.py
list
list(
*,
limit: int = 50,
start_key: str | None = None,
number: str | None = None,
id: str | None = None,
order_by: OrderBy = DESCENDING,
) -> Iterator[Cas]
Lists CAS entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int | None
|
The maximum number of CAS entities to return, by default 50. |
50
|
start_key
|
str | None
|
The primary key of the first item that this operation will evaluate. |
None
|
number
|
str | None
|
Fetches list of CAS by CAS number. |
None
|
id
|
str | None
|
Fetches list of CAS using the CAS Albert ID. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
Returns:
Type | Description |
---|---|
Iterator[Cas]
|
An iterator of Cas objects. |
Source code in src/albert/collections/cas.py
update
Updates a CAS entity. The updated object must have the same ID as the object you want to update.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
updated_object
|
Cas
|
The Updated Cas object. |
required |
Returns:
Type | Description |
---|---|
Cas
|
The updated Cas object as it appears in Albert |
Source code in src/albert/collections/cas.py
CompanyCollection
CompanyCollection(*, session: AlbertSession)
Bases: BaseCollection
CompanyCollection is a collection class for managing Company entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
company_exists |
Checks if a company exists by its name. |
create |
Creates a new company entity. |
delete |
Deletes a company entity. |
get_by_id |
Get a company by its ID. |
get_by_name |
Retrieves a company by its name. |
list |
Lists company entities with optional filters. |
rename |
Renames an existing company entity. |
update |
Update a Company entity. The id of the company must be provided. |
Source code in src/albert/collections/companies.py
company_exists
Checks if a company exists by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the company to check. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if the company exists, False otherwise. |
Source code in src/albert/collections/companies.py
create
Creates a new company entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
company
|
Union[str, Company]
|
The company name or Company object to create. |
required |
check_if_exists
|
bool
|
Whether to check if the company already exists, by default True. |
True
|
Returns:
Type | Description |
---|---|
Company
|
The created Company object. |
Source code in src/albert/collections/companies.py
delete
delete(*, id: str) -> None
Deletes a company entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the company to delete. |
required |
get_by_id
Get a company by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the company to retrieve. |
required |
Returns:
Type | Description |
---|---|
Company
|
The Company object. |
Source code in src/albert/collections/companies.py
get_by_name
Retrieves a company by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the company to retrieve. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
Company
|
The Company object if found, None otherwise. |
Source code in src/albert/collections/companies.py
list
list(
*,
limit: int = 50,
name: str | list[str] = None,
exact_match: bool = True,
start_key: str | None = None,
) -> Iterator[Company]
Lists company entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of companies to return, by default 50. |
50
|
name
|
Union[str, None]
|
The name of the company to filter by, by default None. |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
Iterator
|
An iterator of Company objects. |
Source code in src/albert/collections/companies.py
rename
Renames an existing company entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old_name
|
str
|
The current name of the company. |
required |
new_name
|
str
|
The new name of the company. |
required |
Returns:
Type | Description |
---|---|
Company
|
The renamed Company object |
Source code in src/albert/collections/companies.py
update
Update a Company entity. The id of the company must be provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
company
|
Company
|
The updated Company object. |
required |
Returns:
Type | Description |
---|---|
Company
|
The updated Company object as registered in Albert. |
Source code in src/albert/collections/companies.py
CustomFieldCollection
CustomFieldCollection(*, session: AlbertSession)
Bases: BaseCollection
CustomFieldCollection is a collection class for managing CustomField entities in the Albert platform.
This collection provides methods to create, update, retrieve, and list custom fields.
CustomFields allow you to store custom metadata on a Project
, InventoryItem
, User
, BaseTask
(Tasks), and Lot
.
The FieldType
used determines the shape of the metadata field's value.
If the FieldType
is LIST
, then the FieldCategory
defines the ACL needed to add new allowed items to the given list:
FieldCategory.USER_DEFINED
: allows general users to add itemsFieldCategory.BUSINESS_DEFINED
: only admins can add new items to the list
Example
# Creating some custom fields
from albert import Albert
from albert.resources.custom_fields import CustomField, FieldCategory, FieldType, ServiceType
from albert.resources.lists import ListItem
from albert.resources.project import Project
# Initialize the Albert client
client = Albert()
# Define the custom fields
stage_gate_field = CustomField(
name="stage_gate_status",
display_name="Stage Gate",
field_type=FieldType.LIST,
service=ServiceType.PROJECTS,
min=1,
max=1,
category=FieldCategory.BUSINESS_DEFINED # Defined by the business
)
justification_field = CustomField(
name="justification",
display_name="Project Justification",
field_type=FieldType.STRING,
service=ServiceType.PROJECTS,
)
# Create the custom fields
client.custom_fields.create(custom_field=stage_gate_field)
client.custom_fields.create(custom_field=justification_field)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new CustomField item. |
get_by_id |
Get a CustomField item by its ID. |
get_by_name |
Get a CustomField item by its name. |
list |
Searches for CustomField items based on the provided parameters. |
update |
Update a CustomField item. |
Source code in src/albert/collections/custom_fields.py
create
create(*, custom_field: CustomField) -> CustomField
Create a new CustomField item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
custom_field
|
CustomField
|
The CustomField item to create. |
required |
Returns:
Type | Description |
---|---|
CustomField
|
The created CustomField item with its ID. |
Source code in src/albert/collections/custom_fields.py
get_by_id
get_by_id(*, id: str) -> CustomField
Get a CustomField item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the CustomField item. |
required |
Returns:
Type | Description |
---|---|
CustomField
|
The CustomField item. |
Source code in src/albert/collections/custom_fields.py
get_by_name
get_by_name(
*, name: str, service: ServiceType | None = None
) -> CustomField | None
Get a CustomField item by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the CustomField item. |
required |
service
|
ServiceType | None
|
The service the field relates to, by default None |
None
|
Returns:
Type | Description |
---|---|
CustomField | None
|
The CustomField item, or None if not found. |
Source code in src/albert/collections/custom_fields.py
list
list(
*,
name: str | None = None,
service: ServiceType | None = None,
lookup_column: bool | None = None,
lookup_row: bool | None = None,
) -> Iterator[CustomField]
Searches for CustomField items based on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
The name of the field, by default None |
None
|
service
|
ServiceType | None
|
The related service the field is in, by default None |
None
|
lookup_column
|
bool | None
|
Whether the field relates to a lookup column, by default None |
None
|
lookup_row
|
bool | None
|
Whether the field relates to a lookup row, by default None |
None
|
Yields:
Type | Description |
---|---|
Iterator[CustomField]
|
Returns an iterator of CustomField items matching the search criteria. |
Source code in src/albert/collections/custom_fields.py
update
update(*, custom_field: CustomField) -> CustomField
Update a CustomField item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
custom_field
|
CustomField
|
The updated CustomField item. The ID must be set and match the Field you want to update. |
required |
Returns:
Type | Description |
---|---|
CustomField
|
The updated CustomField item as registered in Albert. |
Source code in src/albert/collections/custom_fields.py
CustomTemplatesCollection
CustomTemplatesCollection(*, session: AlbertSession)
Bases: BaseCollection
CustomTemplatesCollection is a collection class for managing CustomTemplate entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_by_id |
Get a Custom Template by ID |
list |
Searches for custom templates matching the provided criteria. |
Source code in src/albert/collections/custom_templates.py
get_by_id
get_by_id(*, id) -> CustomTemplate
Get a Custom Template by ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
id of the custom template |
required |
Returns:
Type | Description |
---|---|
CustomTemplate
|
The CutomTemplate with the provided ID (or None if not found) |
Source code in src/albert/collections/custom_templates.py
list
list(
*,
text: str | None = None,
limit: int = 50,
offset: int = 0,
) -> Iterator[CustomTemplate]
Searches for custom templates matching the provided criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str | None
|
The text to search for, by default None |
None
|
Yields:
Type | Description |
---|---|
Iterator[CustomTemplate]
|
An iterator of CustomTemplate items matching the search criteria. |
Source code in src/albert/collections/custom_templates.py
DataColumnCollection
DataColumnCollection(*, session: AlbertSession)
Bases: BaseCollection
DataColumnCollection is a collection class for managing DataColumn entities in the Albert platform.
Methods:
Name | Description |
---|---|
create |
Create a new data column entity. |
delete |
Delete a data column entity. |
get_by_id |
Get a data column by its ID. |
get_by_name |
Get a data column by its name. |
list |
Lists data column entities with optional filters. |
update |
Update a data column entity. |
Source code in src/albert/collections/data_columns.py
create
create(*, data_column: DataColumn) -> DataColumn
Create a new data column entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_column
|
DataColumn
|
The data column object to create. |
required |
Returns:
Type | Description |
---|---|
DataColumn
|
The created data column object. |
Source code in src/albert/collections/data_columns.py
delete
delete(*, id: str) -> None
Delete a data column entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the data column object to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/data_columns.py
get_by_id
get_by_id(*, id) -> DataColumn
Get a data column by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the data column to get. |
required |
Returns:
Type | Description |
---|---|
DataColumn | None
|
The data column object on match or None |
Source code in src/albert/collections/data_columns.py
get_by_name
get_by_name(*, name) -> DataColumn | None
Get a data column by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the data column to get. |
required |
Returns:
Type | Description |
---|---|
DataColumn | None
|
The data column object on match or None |
Source code in src/albert/collections/data_columns.py
list
list(
*,
order_by: OrderBy = DESCENDING,
ids: str | list[str] | None = None,
name: str | list[str] | None = None,
exact_match: bool | None = None,
default: bool | None = None,
start_key: str | None = None,
limit: int = 100,
return_full: bool = True,
) -> Iterator[DataColumn]
Lists data column entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
ids
|
str | list[str] | None
|
Data column IDs to filter the search by, default None. |
None
|
name
|
Union[str, None]
|
The name of the tag to filter by, by default None. |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
None
|
default
|
bool
|
Whether to return only default columns, by default None. |
None
|
return_full
|
bool
|
Whether to make additional API call to fetch the full object, by default True |
True
|
Returns:
Type | Description |
---|---|
Iterator[DataColumn]
|
An iterator of DataColumns matching the provided criteria. |
Source code in src/albert/collections/data_columns.py
update
update(*, data_column: DataColumn) -> DataColumn
Update a data column entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_column
|
DataColumn
|
The updated data column object. The ID must be set and match an existing data column. |
required |
Returns:
Type | Description |
---|---|
DataColumn
|
The updated data column object as registered in Albert. |
Source code in src/albert/collections/data_columns.py
DataTemplateCollection
DataTemplateCollection(*, session: AlbertSession)
Bases: BaseCollection
DataTemplateCollection is a collection class for managing DataTemplate entities in the Albert platform.
Methods:
Name | Description |
---|---|
add_data_columns |
Adds data columns to a data template. |
add_parameters |
Adds parameters to a data template. |
create |
Creates a new data template. |
delete |
Deletes a data template by its ID. |
get_by_id |
Get a data template by its ID. |
get_by_ids |
Get a list of data templates by their IDs. |
get_by_name |
Get a data template by its name. |
list |
Lists data template entities with optional filters. |
update |
Updates a data template. |
Source code in src/albert/collections/data_templates.py
add_data_columns
add_data_columns(
*,
data_template_id: DataTemplateId,
data_columns: list[DataColumnValue],
) -> DataTemplate
Adds data columns to a data template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_template_id
|
str
|
The ID of the data template to add the columns to. |
required |
data_columns
|
list[DataColumnValue]
|
The list of DataColumnValue objects to add to the data template. |
required |
Returns:
Type | Description |
---|---|
DataTemplate
|
The updated DataTemplate object. |
Source code in src/albert/collections/data_templates.py
add_parameters
add_parameters(
*,
data_template_id: DataTemplateId,
parameters: list[ParameterValue],
) -> DataTemplate
Adds parameters to a data template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_template_id
|
str
|
The ID of the data template to add the columns to. |
required |
parameters
|
list[ParameterValue]
|
The list of ParameterValue objects to add to the data template. |
required |
Returns:
Type | Description |
---|---|
DataTemplate
|
The updated DataTemplate object. |
Source code in src/albert/collections/data_templates.py
create
create(*, data_template: DataTemplate) -> DataTemplate
Creates a new data template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_template
|
DataTemplate
|
The DataTemplate object to create. |
required |
Returns:
Type | Description |
---|---|
DataTemplate
|
The registered DataTemplate object with an ID. |
Source code in src/albert/collections/data_templates.py
delete
delete(*, id: DataTemplateId) -> None
Deletes a data template by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the data template to delete. |
required |
get_by_id
get_by_id(*, id: DataTemplateId) -> DataTemplate
Get a data template by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
DataTemplateId
|
The ID of the data template to get. |
required |
Returns:
Type | Description |
---|---|
DataTemplate
|
The data template object on match or None |
Source code in src/albert/collections/data_templates.py
get_by_ids
get_by_ids(
*, ids: list[DataTemplateId]
) -> list[DataTemplate]
Get a list of data templates by their IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[DataTemplateId]
|
The list of DataTemplate IDs to get. |
required |
Returns:
Type | Description |
---|---|
list[DataTemplate]
|
A list of DataTemplate objects with the provided IDs. |
Source code in src/albert/collections/data_templates.py
get_by_name
get_by_name(*, name: str) -> DataTemplate | None
Get a data template by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the data template to get. |
required |
Returns:
Type | Description |
---|---|
DataTemplate | None
|
The matching data template object or None if not found. |
Source code in src/albert/collections/data_templates.py
list
list(
*,
name: str | None = None,
user_id: str | None = None,
order_by: OrderBy = DESCENDING,
limit: int = 100,
offset: int = 0,
) -> Iterator[DataTemplate]
Lists data template entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Union[str, None]
|
The name of the data template to filter by, by default None. |
None
|
user_id
|
str
|
user_id to filter by, by default None. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
Returns:
Type | Description |
---|---|
Iterator[DataTemplate]
|
An iterator of DataTemplate objects matching the provided criteria. |
Source code in src/albert/collections/data_templates.py
update
update(*, data_template: DataTemplate) -> DataTemplate
Updates a data template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_template
|
DataTemplate
|
The DataTemplate object to update. The ID must be set and matching the ID of the DataTemplate to update. |
required |
Returns:
Type | Description |
---|---|
DataTemplate
|
The Updated DataTemplate object. |
Source code in src/albert/collections/data_templates.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
|
FileCollection
FileCollection(*, session: AlbertSession)
Bases: BaseCollection
FileCollection is a collection class for managing File entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_by_name |
Gets a file by name and namespace. |
get_signed_download_url |
Get a signed download URL for a file. |
get_signed_upload_url |
Get a signed upload URL for a file. |
sign_and_upload_file |
Sign and upload a file to Albert. |
Source code in src/albert/collections/files.py
get_by_name
get_by_name(
*,
name: str,
namespace: FileNamespace,
generic: bool = False,
) -> FileInfo
Gets a file by name and namespace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The Name of the file |
required |
namespace
|
FileNamespace
|
The namespace of the file (e.g. AGENT, BREAKTHROUGH, PIPELINE, PUBLIC, RESULT, SDS) |
required |
generic
|
bool
|
description, by default False |
False
|
Returns:
Type | Description |
---|---|
FileInfo
|
The file information related to the matching file. |
Source code in src/albert/collections/files.py
get_signed_download_url
get_signed_download_url(
*,
name: str,
namespace: FileNamespace,
version_id: str | None = None,
generic: bool = False,
category: FileCategory | None = None,
) -> str
Get a signed download URL for a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The Name of the file |
required |
namespace
|
FileNamespace
|
The namespace of the file (e.g. AGENT, BREAKTHROUGH, PIPELINE, PUBLIC, RESULT, SDS) |
required |
version_id
|
str | None
|
The version of the file, by default None |
None
|
category
|
FileCategory | None
|
The file category (E.g., SDS, OTHER), by default None |
None
|
Returns:
Type | Description |
---|---|
str
|
description |
Source code in src/albert/collections/files.py
get_signed_upload_url
get_signed_upload_url(
*,
name: str,
namespace: FileNamespace,
content_type: str,
generic: bool = False,
category: FileCategory | None = None,
) -> str
Get a signed upload URL for a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The Name of the file |
required |
namespace
|
FileNamespace
|
The namespace of the file (e.g. AGENT, BREAKTHROUGH, PIPELINE, PUBLIC, RESULT, SDS) |
required |
content_type
|
str
|
The content type of the file |
required |
category
|
FileCategory | None
|
The File category (E.g., SDS, OTHER), by default None |
None
|
Returns:
Type | Description |
---|---|
str
|
description |
Source code in src/albert/collections/files.py
sign_and_upload_file
sign_and_upload_file(
data: IO,
name: str,
namespace: FileNamespace,
content_type: str,
generic: bool = False,
category: FileCategory | None = None,
) -> None
Sign and upload a file to Albert.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
IO
|
The file data |
required |
name
|
str
|
The name of the file |
required |
namespace
|
FileNamespace
|
The File Namespace (e.g., AGENT, BREAKTHROUGH, PIPELINE, PUBLIC, RESULT, SDS) |
required |
content_type
|
str
|
The content type of the file |
required |
category
|
FileCategory | None
|
The category of the file (E.g., SDS, OTHER), by default None |
None
|
Source code in src/albert/collections/files.py
InventoryCollection
InventoryCollection(*, session: AlbertSession)
Bases: BaseCollection
InventoryCollection is a collection class for managing Inventory Item entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
Albert
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
add_specs |
Add inventory specs to the inventory item. |
create |
Create a new inventory item. |
delete |
Delete an inventory item by its ID. |
get_all_facets |
Get available facets for inventory items based on the provided filters. |
get_by_id |
Retrieve an inventory item by its ID. |
get_by_ids |
Retrieve an set of inventory items by their IDs. |
get_facet_by_name |
Returns a specific facet by its name with all the filters applied to the search. |
get_match_or_none |
Get a matching inventory item or return None if not found. |
get_specs |
Get the specs for a list of inventory items. |
inventory_exists |
Check if an inventory item exists. |
list |
List inventory items with optional filters. |
merge |
Merge one or multiple child inventory into a parent inventory item. |
search |
Get a list of inventory items that match the search criteria and |
update |
Update an inventory item. |
Source code in src/albert/collections/inventory.py
add_specs
add_specs(
*,
inventory_id: InventoryId,
specs: InventorySpec | list[InventorySpec],
) -> InventorySpecList
Add inventory specs to the inventory item.
An InventorySpec
is a property that was not directly measured via a task,
but is a generic property of that inentory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The Albert ID of the inventory item to add the specs to |
required |
specs
|
list[InventorySpec]
|
List of InventorySpec objects to add to the inventory item, which described the value and, optionally, the conditions associated with the value (via workflow). |
required |
Returns:
Type | Description |
---|---|
InventorySpecList
|
The list of InventorySpecs attached to the InventoryItem. |
Source code in src/albert/collections/inventory.py
create
create(
*,
inventory_item: InventoryItem,
avoid_duplicates: bool = True,
) -> InventoryItem
Create a new inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_item
|
InventoryItem
|
The inventory item to create. |
required |
avoid_duplicates
|
bool
|
Whether to avoid creating duplicate items (default is True). |
True
|
Returns:
Type | Description |
---|---|
InventoryItem
|
The created inventory item. |
Source code in src/albert/collections/inventory.py
delete
delete(*, id: InventoryId) -> None
Delete an inventory item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
InventoryId
|
The ID of the inventory item. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/inventory.py
get_all_facets
get_all_facets(
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[StorageLocation]
| StorageLocation
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User] | User | None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> list[FacetItem]
Get available facets for inventory items based on the provided filters.
Source code in src/albert/collections/inventory.py
get_by_id
get_by_id(*, id: InventoryId) -> InventoryItem
Retrieve an inventory item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
InventoryId
|
The ID of the inventory item. |
required |
Returns:
Type | Description |
---|---|
InventoryItem
|
The retrieved inventory item. |
Source code in src/albert/collections/inventory.py
get_by_ids
get_by_ids(
*, ids: list[InventoryId]
) -> list[InventoryItem]
Retrieve an set of inventory items by their IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[InventoryId]
|
The list of IDs of the inventory items. |
required |
Returns:
Type | Description |
---|---|
list[InventoryItem]
|
The retrieved inventory items. |
Source code in src/albert/collections/inventory.py
get_facet_by_name
get_facet_by_name(
name: str | list[str],
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[StorageLocation]
| StorageLocation
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User] | User | None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> list[FacetItem]
Returns a specific facet by its name with all the filters applied to the search. This can be used for example to fetch all remaining tags as part of an iterative refinement of a search.
Source code in src/albert/collections/inventory.py
get_match_or_none
get_match_or_none(
*, inventory_item: InventoryItem
) -> InventoryItem | None
Get a matching inventory item or return None if not found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_item
|
InventoryItem
|
The inventory item to match. |
required |
Returns:
Type | Description |
---|---|
Union[InventoryItem, None]
|
The matching inventory item or None if not found. |
Source code in src/albert/collections/inventory.py
get_specs
get_specs(
*, ids: list[InventoryId]
) -> list[InventorySpecList]
Get the specs for a list of inventory items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[InventoryId]
|
List of Inventory IDs to get the specs for. |
required |
Returns:
Type | Description |
---|---|
list[InventorySpecList]
|
A list of InventorySpecList objects, each containing the specs for an inventory item. |
Source code in src/albert/collections/inventory.py
inventory_exists
inventory_exists(*, inventory_item: InventoryItem) -> bool
Check if an inventory item exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_item
|
InventoryItem
|
The inventory item to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the inventory item exists, False otherwise. |
Source code in src/albert/collections/inventory.py
list
list(
*,
limit: int = 100,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
order: OrderBy = DESCENDING,
sort_by: str | None = "createdAt",
location: list[Location] | Location | None = None,
storage_location: list[StorageLocation]
| StorageLocation
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User] | User | None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> Iterator[InventoryItem]
List inventory items with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Maximum number of items to return (default is 100) |
100
|
text
|
str
|
Text to search for in inventory names and descriptions |
None
|
cas
|
list[Cas] | Cas | None
|
Filter by CAS number(s) |
None
|
category
|
list[InventoryCategory] | InventoryCategory | None
|
Filter by inventory category/categories |
None
|
company
|
list[Company] | Company | None
|
Filter by manufacturing company/companies |
None
|
order
|
OrderBy
|
Sort order, either ASCENDING or DESCENDING (default is DESCENDING) |
DESCENDING
|
sort_by
|
str
|
Field to sort by (default is "createdAt") |
'createdAt'
|
location
|
list[Location] | None
|
Filter by location(s) |
None
|
storage_location
|
list[StorageLocation] | None
|
Filter by storage location(s) |
None
|
project_id
|
str
|
Filter by project ID |
None
|
sheet_id
|
str
|
Filter by sheet ID |
None
|
created_by
|
list[User]
|
Filter by creator(s) |
None
|
lot_owner
|
list[User]
|
Filter by lot owner(s) |
None
|
tags
|
list[str]
|
Filter by tag(s) |
None
|
match_all_conditions
|
bool
|
Whether to match all conditions (default is False -- e.g. OR between conditions) |
False
|
Returns:
Type | Description |
---|---|
Iterator[InventoryItem]
|
An iterator over the matching inventory items |
Source code in src/albert/collections/inventory.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
|
merge
merge(
*,
parent_id: InventoryId,
child_id: InventoryId | list[InventoryId],
modules: list[str] | None = None,
) -> None
Merge one or multiple child inventory into a parent inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_id
|
InventoryId
|
The ID of the parent inventory item. |
required |
child_id
|
InventoryId | list[InventoryId]
|
The ID(s) of the child inventory item(s). |
required |
modules
|
list[str]
|
The merge modules to use (default is all). |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/inventory.py
search
search(
*,
limit: int = 100,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[StorageLocation]
| StorageLocation
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User] | User | None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> Iterator[InventorySearchItem]
Get a list of inventory items that match the search criteria and return the raw search records. These are not full inventory item objects, but are special short documents intended for fast summary results
Source code in src/albert/collections/inventory.py
update
update(*, inventory_item: InventoryItem) -> InventoryItem
Update an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_item
|
InventoryItem
|
The updated inventory item object. |
required |
Returns:
Type | Description |
---|---|
InventoryItem
|
The updated inventory item retrieved from the server. |
Source code in src/albert/collections/inventory.py
LinksCollection
LinksCollection(*, session: AlbertSession)
Bases: BaseCollection
LinksCollection is a collection class for managing Link entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new link entity. |
delete |
Deletes a link entity by its ID. |
get_by_id |
Retrieves a link entity by its ID. |
list |
Generates a list of link entities with optional filters. |
Source code in src/albert/collections/links.py
create
Creates a new link entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
links
|
list[Link]
|
List of Link entities to create. |
required |
Returns:
Type | Description |
---|---|
Link
|
The created link entity. |
Source code in src/albert/collections/links.py
delete
delete(*, id: str) -> None
Deletes a link entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the link entity to delete. |
required |
get_by_id
list
list(
*,
limit: int = 100,
type: str | None = None,
category: LinkCategory | None = None,
id: str | None = None,
) -> Iterator[Link]
Generates a list of link entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of link entities to return. |
100
|
type
|
str
|
The type of the link entities to return. Allowed values are |
None
|
category
|
LinkCategory
|
The category of the link entities to return. Allowed values are |
None
|
id
|
str
|
The ID of the link entity to return. (Use with |
None
|
Returns:
Type | Description |
---|---|
Iterator[Link]
|
An iterator of Links. |
Source code in src/albert/collections/links.py
ListsCollection
ListsCollection(*, session: AlbertSession)
Bases: BaseCollection
ListsCollection is a collection class for managing ListItem entities in the Albert platform.
Example
stages = [
"1. Discovery",
"2. Concept Validation",
"3. Proof of Concept",
"4. Prototype Development",
"5. Preliminary Evaluation",
"6. Feasibility Study",
"7. Optimization",
"8. Scale-Up",
"9. Regulatory Assessment",
]
# Initialize the Albert client
client = Albert()
# Get the custom field this list is associated with
stage_gate_field = client.custom_fields.get_by_id(id="CF123")
# Create the list items
for s in stages:
item = ListItem(
name=s,
category=stage_gate_field.category,
list_type=stage_gate_field.name,
)
client.lists.create(list_item=item)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a list entity. |
delete |
Delete a lists entry item by its ID. |
get_by_id |
Retrieves a list entity by its ID. |
get_matching_item |
Get a list item by name and list type. |
list |
Generates a list of list entities with optional filters. |
update |
Update a list item. |
Source code in src/albert/collections/lists.py
create
Creates a list entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_item
|
ListItem
|
The list entity to create. |
required |
Returns:
Type | Description |
---|---|
List
|
The created list entity. |
Source code in src/albert/collections/lists.py
delete
delete(*, id: str) -> None
Delete a lists entry item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the lists item. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/lists.py
get_by_id
Retrieves a list entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the list entity to retrieve. |
required |
Returns:
Type | Description |
---|---|
List
|
A list entity. |
Source code in src/albert/collections/lists.py
get_matching_item
Get a list item by name and list type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of it item to retrieve. |
required |
list_type
|
str
|
The type of list (can be the name of the custom field) |
required |
Returns:
Type | Description |
---|---|
ListItem | None
|
A list item with the provided name and list type, or None if not found. |
Source code in src/albert/collections/lists.py
list
list(
*,
limit: int = 100,
names: list[str] | None = None,
category: ListItemCategory | None = None,
list_type: str | None = None,
start_key: str | None = None,
) -> Iterator[ListItem]
Generates a list of list entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of list entities to return. |
100
|
names
|
list[str]
|
A list of names of the list entity to retrieve. |
None
|
category
|
ListItemCategory
|
The category of the list entity to retrieve. |
None
|
list_type
|
str
|
The type of list entity to retrieve. |
None
|
Returns:
Type | Description |
---|---|
Iterator[ListItem]
|
An iterator of ListItems. |
Source code in src/albert/collections/lists.py
update
Update a list item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_item
|
ListItem
|
The list item to update. |
ListItem
|
Returns:
Type | Description |
---|---|
ListItem
|
The updated list item. |
Source code in src/albert/collections/lists.py
LocationCollection
LocationCollection(*, session: AlbertSession)
Bases: BaseCollection
LocationCollection is a collection class for managing Location entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new Location entity. |
delete |
Deletes a Location entity. |
get_by_id |
Retrieves a location by its ID. |
list |
Searches for locations matching the provided criteria. |
location_exists |
Determines if a location, with the same name, exists in the collection. |
update |
Update a Location entity. |
Source code in src/albert/collections/locations.py
create
Creates a new Location entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
Location
|
The Location object to create. |
required |
Returns:
Type | Description |
---|---|
Location
|
The created Location object. |
Source code in src/albert/collections/locations.py
delete
delete(*, id: str) -> None
Deletes a Location entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
Str
|
The id of the Location object to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/locations.py
get_by_id
list
list(
*,
ids: list[str] | None = None,
name: str | list[str] | None = None,
country: str | None = None,
exact_match: bool = False,
limit: int = 50,
start_key: str | None = None,
) -> Iterator[Location]
Searches for locations matching the provided criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str] | None
|
The list of IDs to filter the locations, by default None. Max length is 100. |
None
|
name
|
str | list[str] | None
|
The name or names of locations to search for, by default None |
None
|
country
|
str | None
|
The country code of the country to filter the locations , by default None |
None
|
exact_match
|
bool
|
Whether to return exact matches only, by default False |
False
|
Yields:
Type | Description |
---|---|
Iterator[Location]
|
An iterator of Location objects matching the search criteria. |
Source code in src/albert/collections/locations.py
location_exists
Determines if a location, with the same name, exists in the collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
Location
|
The Location object to check |
required |
Returns:
Type | Description |
---|---|
Location | None
|
The existing registered Location object if found, otherwise None. |
Source code in src/albert/collections/locations.py
update
Update a Location entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
location
|
Location
|
The Location object to update. The ID of the Location object must be provided. |
required |
Returns:
Type | Description |
---|---|
Location
|
The updated Location object as returned by the server. |
Source code in src/albert/collections/locations.py
LotCollection
LotCollection(*, session: AlbertSession)
Bases: BaseCollection
LotCollection is a collection class for managing Lot entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
An Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
|
delete |
Delete a lot by its ID. |
get_by_id |
Get a lot by its ID. |
get_by_ids |
Get a list of lots by their IDs. |
list |
Lists Lot entities with optional filters. |
update |
Update a lot. |
Source code in src/albert/collections/lots.py
create
Source code in src/albert/collections/lots.py
delete
delete(*, id: str) -> None
Delete a lot by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the lot to delete. |
required |
get_by_id
get_by_ids
Get a list of lots by their IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str]
|
A list of lot IDs to get. |
required |
Returns:
Type | Description |
---|---|
list[Lot]
|
A list of lots with the provided IDs. |
Source code in src/albert/collections/lots.py
list
list(
*,
limit: int = 100,
start_key: str | None = None,
parent_id: str | None = None,
inventory_id: str | None = None,
barcode_id: str | None = None,
parent_id_category: str | None = None,
inventory_on_hand: str | None = None,
location_id: str | None = None,
exact_match: bool = False,
begins_with: bool = False,
) -> Iterator[Lot]
Lists Lot entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of Lots to return, by default 100. |
100
|
start_key
|
Optional[str]
|
The primary key of the first item to evaluate for pagination. |
None
|
parent_id
|
Optional[str]
|
Fetches list of lots for a parentId (inventory). |
None
|
inventory_id
|
Optional[str]
|
Fetches list of lots for an inventory. |
None
|
barcode_id
|
Optional[str]
|
Fetches list of lots for a barcodeId. |
None
|
parent_id_category
|
Optional[str]
|
Fetches list of lots for a parentIdCategory (e.g., RawMaterials, Consumables). |
None
|
inventory_on_hand
|
Optional[str]
|
Fetches records based on inventoryOnHand (lteZero, gtZero, eqZero). |
None
|
location_id
|
Optional[str]
|
Fetches list of lots for a locationId. |
None
|
exact_match
|
bool
|
Determines if barcodeId field should be an exact match, by default False. |
False
|
begins_with
|
bool
|
Determines if barcodeId begins with a certain value, by default False. |
False
|
Yields:
Type | Description |
---|---|
Iterator[Lot]
|
An iterator of Lot objects. |
Source code in src/albert/collections/lots.py
update
Update a lot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lot
|
Lot
|
The updated lot object. |
required |
Returns:
Type | Description |
---|---|
Lot
|
The updated lot object as returned by the server. |
Source code in src/albert/collections/lots.py
NotebookCollection
NotebookCollection(*, session: AlbertSession)
Bases: BaseCollection
NotebookCollection is a collection class for managing Notebook entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
copy |
Create a copy of a Notebook into a specified parent |
create |
Create or return notebook for the provided notebook. |
delete |
Deletes a notebook by its ID. |
get_block_by_id |
Retrieve a Notebook Block by its ID. |
get_by_id |
Retrieve a Notebook by its ID. |
list_by_parent_id |
Retrieve a Notebook by parent ID. |
update |
Update a notebook. |
update_block_content |
Updates the block content of a Notebook. This does not update the notebook name (use .update for that). |
Source code in src/albert/collections/notebooks.py
copy
copy(
*,
notebook_copy_info: NotebookCopyInfo,
type: NotebookCopyType,
) -> Notebook
Create a copy of a Notebook into a specified parent
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook_copy_info
|
NotebookCopyInfo
|
The copy information for the Notebook copy |
required |
type
|
NotebookCopyType
|
Differentiate whether copy is for templates, task, project or restoreTemplate |
required |
Returns:
Type | Description |
---|---|
Notebook
|
The result of the copied Notebook. |
Source code in src/albert/collections/notebooks.py
create
Create or return notebook for the provided notebook. This endpoint automatically tries to find an existing notebook with the same parameter setpoints, and will either return the existing notebook or create a new one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook
|
Notebook
|
A list of Notebook objects to find or create. |
required |
Returns:
Type | Description |
---|---|
Notebook
|
A list of created or found Notebook objects. |
Source code in src/albert/collections/notebooks.py
delete
delete(*, id: str) -> None
Deletes a notebook by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the notebook to delete. |
required |
get_block_by_id
get_block_by_id(
*, notebook_id: str, block_id: str
) -> NotebookBlock
Retrieve a Notebook Block by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook_id
|
str
|
The ID of the Notebook to which the Block belongs. |
required |
block_id
|
str
|
The ID of the Notebook Block to retrieve. |
required |
Returns:
Type | Description |
---|---|
NotebookBlock
|
The NotebookBlock object. |
Source code in src/albert/collections/notebooks.py
get_by_id
list_by_parent_id
Retrieve a Notebook by parent ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_id
|
str
|
The ID of the parent ID, e.g. task. |
required |
Returns:
Type | Description |
---|---|
list[Notebook]
|
list of notebook references. |
Source code in src/albert/collections/notebooks.py
update
Update a notebook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook
|
Notebook
|
The updated notebook object. |
required |
Returns:
Type | Description |
---|---|
Notebook
|
The updated notebook object as returned by the server. |
Source code in src/albert/collections/notebooks.py
update_block_content
Updates the block content of a Notebook. This does not update the notebook name (use .update for that). If a block in the Notebook does not already exist on Albert, it will be created. Note: The order of the Blocks in your Notebook matter and will be used in the updated Notebook!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notebook
|
Notebook
|
The updated notebook object. |
required |
Returns:
Type | Description |
---|---|
Notebook
|
The updated notebook object as returned by the server. |
Source code in src/albert/collections/notebooks.py
NotesCollection
NotesCollection(*, session: AlbertSession)
Bases: BaseCollection
NotesCollection is a collection class for managing Note entities in the Albert platform.
Methods:
Name | Description |
---|---|
create |
Creates a new note. |
delete |
Deletes a note by its ID. |
get_by_id |
Retrieves a note by its ID. |
list |
Lists notes by their parent ID. |
update |
Updates a note. |
Source code in src/albert/collections/notes.py
create
Creates a new note.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
note
|
str
|
The note content. |
required |
Returns:
Type | Description |
---|---|
Note
|
The created note. |
Source code in src/albert/collections/notes.py
delete
delete(*, id: str) -> None
Deletes a note by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the note to delete. |
required |
get_by_id
list
list(
*, parent_id: str, order_by: OrderBy = DESCENDING
) -> list[Note]
Lists notes by their parent ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_id
|
str
|
The parent ID of the notes to list. |
required |
order_by
|
OrderBy
|
The order to list notes in, by default OrderBy.DESCENDING. |
DESCENDING
|
Returns:
Type | Description |
---|---|
List[Note]
|
The list of notes. |
Source code in src/albert/collections/notes.py
update
Updates a note.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
note
|
Note
|
The note to update. The note must have an ID. |
required |
Returns:
Type | Description |
---|---|
Note
|
The updated note as returned by the server. |
Source code in src/albert/collections/notes.py
ParameterCollection
ParameterCollection(*, session: AlbertSession)
Bases: BaseCollection
ParameterCollection is a collection class for managing Parameter entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new parameter. |
delete |
Delete a parameter by its ID. |
get_by_id |
Retrieve a parameter by its ID. |
list |
Lists parameters that match the provided criteria. |
update |
Update a parameter. |
Source code in src/albert/collections/parameters.py
create
Create a new parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
Parameter
|
The parameter to create. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
Returns the created parameter or the existing parameter if it already exists. |
Source code in src/albert/collections/parameters.py
delete
delete(*, id: str) -> None
Delete a parameter by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter to delete. |
required |
get_by_id
Retrieve a parameter by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter to retrieve. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
The parameter with the given ID. |
Source code in src/albert/collections/parameters.py
list
list(
*,
ids: list[str] | None = None,
names: str | list[str] = None,
exact_match: bool = False,
order_by: OrderBy = DESCENDING,
start_key: str | None = None,
limit: int = 50,
return_full: bool = True,
) -> Iterator[Parameter]
Lists parameters that match the provided criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str] | None
|
A list of parameter IDs to retrieve, by default None |
None
|
names
|
str | list[str]
|
A list of parameter names to retrieve, by default None |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default False |
False
|
order_by
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
return_full
|
bool
|
Whether to make additional API call to fetch the full object, by default True |
True
|
Yields:
Type | Description |
---|---|
Iterator[Parameter]
|
An iterator of Parameters matching the given criteria. |
Source code in src/albert/collections/parameters.py
update
Update a parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
Parameter
|
The updated parameter to save. The parameter must have an ID. |
required |
Returns:
Type | Description |
---|---|
Parameter
|
The updated parameter as returned by the server. |
Source code in src/albert/collections/parameters.py
ParameterGroupCollection
ParameterGroupCollection(*, session: AlbertSession)
Bases: BaseCollection
ParameterGroupCollection is a collection class for managing ParameterGroup entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session to use for making requests. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new parameter group. |
delete |
Delete a parameter group by its ID. |
get_by_id |
Get a parameter group by its ID. |
get_by_ids |
|
get_by_name |
Get a parameter group by its name. |
list |
Search for Parameter Groups matching the given criteria. |
update |
Update a parameter group. |
Source code in src/albert/collections/parameter_groups.py
create
create(
*, parameter_group: ParameterGroup
) -> ParameterGroup
Create a new parameter group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter_group
|
ParameterGroup
|
The parameter group to create. |
required |
Returns:
Type | Description |
---|---|
ParameterGroup
|
The created parameter group. |
Source code in src/albert/collections/parameter_groups.py
delete
delete(*, id: str) -> None
Delete a parameter group by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter group to delete |
required |
Source code in src/albert/collections/parameter_groups.py
get_by_id
get_by_id(*, id: str) -> ParameterGroup
Get a parameter group by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the parameter group to retrieve. |
required |
Returns:
Type | Description |
---|---|
ParameterGroup
|
The parameter group with the given ID. |
Source code in src/albert/collections/parameter_groups.py
get_by_ids
get_by_ids(*, ids: list[str]) -> ParameterGroup
Source code in src/albert/collections/parameter_groups.py
get_by_name
get_by_name(*, name: str) -> ParameterGroup | None
Get a parameter group by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the parameter group to retrieve. |
required |
Returns:
Type | Description |
---|---|
ParameterGroup | None
|
The parameter group with the given name, or None if not found. |
Source code in src/albert/collections/parameter_groups.py
list
list(
*,
text: str | None = None,
types: PGType | list[PGType] | None = None,
order_by: OrderBy = DESCENDING,
limit: int = 25,
offset: int | None = None,
) -> Iterator[ParameterGroup]
Search for Parameter Groups matching the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str | None
|
Text to search for, by default None |
None
|
types
|
PGType | list[PGType] | None
|
Filer the returned Parameter Groups by Type, by default None |
None
|
order_by
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
Yields:
Type | Description |
---|---|
Iterator[ParameterGroup]
|
An iterator of Parameter Groups matching the given criteria. |
Source code in src/albert/collections/parameter_groups.py
update
update(
*, parameter_group: ParameterGroup
) -> ParameterGroup
Update a parameter group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter_group
|
ParameterGroup
|
The updated ParameterGroup. The ParameterGroup must have an ID. |
required |
Returns:
Type | Description |
---|---|
ParameterGroup
|
The updated ParameterGroup as returned by the server. |
Source code in src/albert/collections/parameter_groups.py
PricingCollection
PricingCollection(*, session: AlbertSession)
Bases: BaseCollection
PricingCollection is a collection class for managing Pricing entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new Pricing entity. |
delete |
Deletes a Pricing entity by its ID. |
get_by_id |
Retrieves a Pricing entity by its ID. |
get_by_inventory_id |
Returns a list of Pricing entities for the given inventory ID as per the provided parameters. |
get_by_inventory_ids |
Returns a list of Pricing resources for each parent inventory ID. |
update |
Updates a Pricing entity. |
Source code in src/albert/collections/pricings.py
create
Creates a new Pricing entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pricing
|
Pricing
|
The Pricing entity to create. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The created Pricing entity. |
Source code in src/albert/collections/pricings.py
delete
delete(*, id: str) -> None
Deletes a Pricing entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the Pricing entity to delete. |
required |
get_by_id
Retrieves a Pricing entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the Pricing entity to retrieve. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The Pricing entity if found, None otherwise. |
Source code in src/albert/collections/pricings.py
get_by_inventory_id
get_by_inventory_id(
*,
inventory_id: str,
group_by: PricingBy | None = None,
filter_by: PricingBy | None = None,
filter_id: str | None = None,
order_by: OrderBy | None = None,
) -> list[Pricing]
Returns a list of Pricing entities for the given inventory ID as per the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
str
|
The ID of the inventory to retrieve pricings for. |
required |
group_by
|
PricingBy | None
|
Grouping by PricingBy, by default None |
None
|
filter_by
|
PricingBy | None
|
Filter by PricingBy, by default None |
None
|
filter_id
|
str | None
|
The string to use as the filter, by default None |
None
|
order_by
|
OrderBy | None
|
The order to sort the results by, by default None |
None
|
Returns:
Type | Description |
---|---|
list[Pricing]
|
A list of Pricing entities matching the provided parameters. |
Source code in src/albert/collections/pricings.py
get_by_inventory_ids
get_by_inventory_ids(
*, inventory_ids: list[InventoryId]
) -> list[InventoryPricings]
Returns a list of Pricing resources for each parent inventory ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_ids
|
list[str]
|
The list of inventory IDs to retrieve pricings for. |
required |
Returns:
Type | Description |
---|---|
list[InventoryPricing]
|
A list of InventoryPricing objects matching the provided inventory. |
Source code in src/albert/collections/pricings.py
update
Updates a Pricing entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pricing
|
Pricing
|
The updated Pricing entity. |
required |
Returns:
Type | Description |
---|---|
Pricing
|
The updated Pricing entity as it appears in Albert. |
Source code in src/albert/collections/pricings.py
ProductDesignCollection
ProductDesignCollection(*, session: AlbertSession)
Bases: BaseCollection
ProductDesignCollection is a collection class for managing Product Design entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_unpacked_products |
Get unpacked products by inventory IDs. |
Source code in src/albert/collections/product_design.py
get_unpacked_products
get_unpacked_products(
*,
inventory_ids: list[InventoryId],
unpack_id: Literal[
"DESIGN", "PREDICTION"
] = "PREDICTION",
) -> list[UnpackedProductDesign]
Get unpacked products by inventory IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_ids
|
list[InventoryId]
|
The inventory ids to get unpacked formulas for. |
required |
unpack_id
|
Literal['DESIGN', 'PREDICTION']
|
The ID for the unpack operation. |
'PREDICTION'
|
Returns:
Type | Description |
---|---|
list[UnpackedProductDesign]
|
The unpacked products/formulas. |
Source code in src/albert/collections/product_design.py
ProjectCollection
ProjectCollection(*, session: AlbertSession)
Bases: BaseCollection
ProjectCollection is a collection class for managing Project entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new project. |
delete |
Delete a project by its ID. |
get_by_id |
Retrieve a project by its ID. |
list |
List projects with optional filters. |
update |
Update a project. |
Source code in src/albert/collections/projects.py
create
Create a new project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project
|
Project
|
The project to create. |
required |
Returns:
Type | Description |
---|---|
Optional[Project]
|
The created project object if successful, None otherwise. |
Source code in src/albert/collections/projects.py
delete
delete(*, id: str) -> None
Delete a project by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the project to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/projects.py
get_by_id
list
list(
*,
text: str = None,
status: list[str] = None,
market_segment: list[str] = None,
application: list[str] = None,
technology: list[str] = None,
created_by: list[str] = None,
location: list[str] = None,
from_created_at: str = None,
to_created_at: str = None,
facet_field: str = None,
facet_text: str = None,
contains_field: list[str] = None,
contains_text: list[str] = None,
linked_to: str = None,
my_projects: bool = None,
my_role: list[str] = None,
order_by: OrderBy = DESCENDING,
sort_by: str = None,
limit: int = 50,
) -> Iterator[Project]
List projects with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Search any test in the project. |
None
|
status
|
list[str]
|
The status filter for the projects. |
None
|
market_segment
|
list[str]
|
The market segment filter for the projects. |
None
|
application
|
list[str]
|
The application filter for the projects. |
None
|
technology
|
list[str]
|
The technology filter for the projects. |
None
|
created_by
|
list[str]
|
The name of the user who created the project. |
None
|
location
|
list[str]
|
The location filter for the projects. |
None
|
from_created_at
|
str
|
The start date filter for the projects. |
None
|
to_created_at
|
str
|
The end date filter for the projects. |
None
|
facet_field
|
str
|
The facet field for the projects. |
None
|
facet_text
|
str
|
The facet text for the projects. |
None
|
contains_field
|
list[str]
|
To power project facets search |
None
|
contains_text
|
list[str]
|
To power project facets search |
None
|
linked_to
|
str
|
To pass text for linked to dropdown search in Task creation flow. |
None
|
my_projects
|
bool
|
Return Projects owned by you. |
None
|
my_role
|
list[str]
|
Filter Projects to ones which you have a specific role in. |
None
|
order_by
|
OrderBy
|
The order in which to retrieve items (default is OrderBy.DESCENDING). |
DESCENDING
|
sort_by
|
str
|
The field to sort by. |
None
|
Returns:
Type | Description |
---|---|
Iterator[Project]
|
An iterator of Project resources. |
Source code in src/albert/collections/projects.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
update
Update a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project
|
Project
|
The updated project object. |
required |
Returns:
Type | Description |
---|---|
Project
|
The updated project object as returned by the server. |
Source code in src/albert/collections/projects.py
PropertyDataCollection
PropertyDataCollection(*, session: AlbertSession)
Bases: BaseCollection
PropertyDataCollection is a collection class for managing Property Data entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
add_properties_to_inventory |
Add new properties to an inventory item. |
add_properties_to_task |
Add new task properties for a given task. |
bulk_delete_task_data |
Bulk delete task data for a given task. |
bulk_load_task_properties |
Bulk load task properties for a given task. WARNING: This will overwrite any existing properties! |
check_block_interval_for_data |
Check if a specific block interval has data. |
check_for_task_data |
Checks if a task has data. |
get_all_task_properties |
Returns all the properties for a specific task. |
get_properties_on_inventory |
Returns all the properties of an inventory item. |
get_task_block_properties |
Returns all the properties within a Property Task block for a specific inventory item. |
search |
Search for property data with various filtering options. |
update_or_create_task_properties |
Update or create task properties for a given task. |
update_property_on_inventory |
Update a property on an inventory item. |
update_property_on_task |
Updates a specific property on a task. |
Source code in src/albert/collections/property_data.py
add_properties_to_inventory
add_properties_to_inventory(
*,
inventory_id: InventoryId,
properties: list[InventoryDataColumn],
) -> list[InventoryPropertyDataCreate]
Add new properties to an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to add properties to. |
required |
properties
|
list[InventoryDataColumn]
|
The properties to add. |
required |
Returns:
Type | Description |
---|---|
list[InventoryPropertyDataCreate]
|
The registered properties. |
Source code in src/albert/collections/property_data.py
add_properties_to_task
add_properties_to_task(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
properties: list[TaskPropertyCreate],
)
Add new task properties for a given task.
This method only works for new values. If a trial number is provided in the TaskPropertyCreate, it must relate to an existing trial. New trials must be added with no trial number provided. Do not try to create multiple new trials in one call as this will lead to unexpected behavior. Build out new trials in a loop if many new trials are needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
properties
|
list[TaskPropertyCreate]
|
A list of TaskPropertyCreate objects representing the properties to add. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The newly created task properties. |
Source code in src/albert/collections/property_data.py
bulk_delete_task_data
bulk_delete_task_data(
*,
task_id: TaskId,
block_id: BlockId,
inventory_id: InventoryId,
lot_id: LotId | None = None,
interval_id=None,
) -> None
Bulk delete task data for a given task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
interval_id
|
IntervalId
|
The ID of the interval, by default None. If provided, will delete data for this specific interval. |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/property_data.py
bulk_load_task_properties
bulk_load_task_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
property_data: BulkPropertyData,
interval="default",
lot_id: LotId = None,
) -> list[TaskPropertyData]
Bulk load task properties for a given task. WARNING: This will overwrite any existing properties! BulkPropertyData column names must exactly match the names of the data columns (Case Sensitive).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
interval
|
str
|
The interval to use for the properties, by default "default". Can be obtained using Workflow.get_interval_id(). |
'default'
|
property_data
|
BulkPropertyData
|
A list of columnwise data containing all your rows of data for a single interval. Can be created using BulkPropertyData.from_dataframe(). |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The updated or newly created task properties. |
Example
from albert.resources.property_data import BulkPropertyData
data = BulkPropertyData.from_dataframe(df=my_dataframe)
res = client.property_data.bulk_load_task_properties(
block_id="BLK1",
inventory_id="INVEXP102748-042",
property_data=data,
task_id="TASFOR291760",
)
[TaskPropertyData(id="TASFOR291760", ...)]
Source code in src/albert/collections/property_data.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
|
check_block_interval_for_data
check_block_interval_for_data(
*,
block_id: BlockId,
task_id: TaskId,
interval_id: IntervalId,
) -> CheckPropertyData
Check if a specific block interval has data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
block_id
|
BlockId
|
The ID of the block. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
interval_id
|
IntervalId
|
The ID of the interval. |
required |
Returns:
Type | Description |
---|---|
CheckPropertyData
|
description |
Source code in src/albert/collections/property_data.py
check_for_task_data
check_for_task_data(
*, task_id: TaskId
) -> list[CheckPropertyData]
Checks if a task has data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to check for data. |
required |
Returns:
Type | Description |
---|---|
list[CheckPropertyData]
|
A list of CheckPropertyData objects representing the data status of each block + inventory item of the task. |
Source code in src/albert/collections/property_data.py
get_all_task_properties
get_all_task_properties(
*, task_id: TaskId
) -> list[TaskPropertyData]
Returns all the properties for a specific task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to retrieve properties for. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
A list of TaskPropertyData objects representing the properties within the task. |
Source code in src/albert/collections/property_data.py
get_properties_on_inventory
get_properties_on_inventory(
*, inventory_id: InventoryId
) -> InventoryPropertyData
Returns all the properties of an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to retrieve properties for. |
required |
Returns:
Type | Description |
---|---|
InventoryPropertyData
|
The properties of the inventory item. |
Source code in src/albert/collections/property_data.py
get_task_block_properties
get_task_block_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
) -> TaskPropertyData
Returns all the properties within a Property Task block for a specific inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The Property task ID. |
required |
block_id
|
BlockId
|
The Block ID of the block to retrieve properties for. |
required |
lot_id
|
LotId | None
|
The specific Lot of the inventory Item to retrieve lots for, by default None |
None
|
Returns:
Type | Description |
---|---|
TaskPropertyData
|
The properties of the inventory item within the block. |
Source code in src/albert/collections/property_data.py
search
search(
*,
limit: int = 100,
result: str | None = None,
text: str | None = None,
order: OrderBy | None = None,
sort_by: str | None = None,
inventory_ids: list[SearchInventoryId]
| SearchInventoryId
| None = None,
project_ids: list[SearchProjectId]
| SearchProjectId
| None = None,
lot_ids: list[LotId] | LotId | None = None,
data_template_ids: DataTemplateId
| list[DataTemplateId]
| None = None,
data_column_ids: DataColumnId
| list[DataColumnId]
| None = None,
category: list[DataEntity] | DataEntity | None = None,
data_templates: list[str] | str | None = None,
data_columns: list[str] | str | None = None,
parameters: list[str] | str | None = None,
parameter_group: list[str] | str | None = None,
unit: list[str] | str | None = None,
created_by: list[UserId] | UserId | None = None,
task_created_by: list[UserId] | UserId | None = None,
return_fields: list[str] | str | None = None,
return_facets: list[str] | str | None = None,
) -> Iterator[PropertyDataSearchItem]
Search for property data with various filtering options.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
Maximum number of results to return. |
100
|
result
|
str
|
Find results using search syntax. e.g. to find all results with viscosity < 200 at a temperature of 25 we would do result=viscosity(<200)@temperature(25) |
None
|
text
|
str
|
Free text search across all searchable fields. |
None
|
order
|
OrderBy
|
Sort order (ascending/descending). |
None
|
sort_by
|
str
|
Field to sort results by. |
None
|
inventory_ids
|
SearchInventoryIdType or list of SearchInventoryIdType
|
Filter by inventory IDs. |
None
|
project_ids
|
ProjectIdType or list of ProjectIdType
|
Filter by project IDs. |
None
|
lot_ids
|
LotIdType or list of LotIdType
|
Filter by lot IDs. |
None
|
data_template_ids
|
DataTemplateId or list of DataTemplateId
|
Filter by data template IDs. |
None
|
data_column_ids
|
DataColumnId | list[DataColumnId] | None
|
Filter by data column IDs. |
None
|
category
|
DataEntity or list of DataEntity
|
Filter by data entity categories. |
None
|
data_templates
|
str or list of str (exact match)
|
Filter by data template names. |
None
|
data_columns
|
str or list of str (exact match)
|
Filter by data column names (currently non-functional). |
None
|
parameters
|
str or list of str (exact match)
|
Filter by parameter names. |
None
|
parameter_group
|
str or list of str (exact match)
|
Filter by parameter group names. |
None
|
unit
|
str or list of str (exact match)
|
Filter by unit names. |
None
|
created_by
|
UserIdType or list of UserIdType
|
Filter by creator user IDs. |
None
|
task_created_by
|
UserIdType or list of UserIdType
|
Filter by task creator user IDs. |
None
|
return_fields
|
str or list of str
|
Specific fields to include in results. If None, returns all fields. |
None
|
return_facets
|
str or list of str
|
Specific facets to include in results. |
None
|
Returns:
Type | Description |
---|---|
dict
|
Search results matching the specified criteria. |
Source code in src/albert/collections/property_data.py
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|
update_or_create_task_properties
update_or_create_task_properties(
*,
inventory_id: InventoryId,
task_id: TaskId,
block_id: BlockId,
lot_id: LotId | None = None,
properties: list[TaskPropertyCreate],
) -> list[TaskPropertyData]
Update or create task properties for a given task.
If a trial number is provided in the TaskPropertyCreate, it must relate to an existing trial. New trials must be added with no trial number provided. Do not try to create multiple new trials in one call as this will lead to unexpected behavior. Build out new trials in a loop if many new trials are needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory. |
required |
task_id
|
TaskId
|
The ID of the task. |
required |
block_id
|
BlockId
|
The ID of the block. |
required |
lot_id
|
LotId
|
The ID of the lot, by default None. |
None
|
properties
|
list[TaskPropertyCreate]
|
A list of TaskPropertyCreate objects representing the properties to update or create. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
The updated or newly created task properties. |
Source code in src/albert/collections/property_data.py
update_property_on_inventory
update_property_on_inventory(
*,
inventory_id: InventoryId,
property_data: InventoryDataColumn,
) -> InventoryPropertyData
Update a property on an inventory item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inventory_id
|
InventoryId
|
The ID of the inventory item to update the property on. |
required |
property_data
|
InventoryDataColumn
|
The updated property data. |
required |
Returns:
Type | Description |
---|---|
InventoryPropertyData
|
The updated property data as returned by the server. |
Source code in src/albert/collections/property_data.py
update_property_on_task
update_property_on_task(
*,
task_id: TaskId,
patch_payload: list[PropertyDataPatchDatum],
) -> list[TaskPropertyData]
Updates a specific property on a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task. |
required |
patch_payload
|
list[PropertyDataPatchDatum]
|
The specific patch to make to update the property. |
required |
Returns:
Type | Description |
---|---|
list[TaskPropertyData]
|
A list of TaskPropertyData objects representing the properties within the task. |
Source code in src/albert/collections/property_data.py
ReportCollection
ReportCollection(*, session: AlbertSession)
Bases: BaseCollection
ReportCollection is a collection class for managing Report entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
get_datascience_report |
Get a datascience report by its report type ID. |
Source code in src/albert/collections/reports.py
get_datascience_report
get_datascience_report(
*,
report_type_id: str,
input_data: dict[str, Any] | None = None,
) -> ReportInfo
Get a datascience report by its report type ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
report_type_id
|
str
|
The report type ID for the report. |
required |
input_data
|
dict[str, Any] | None
|
Additional input data for generating the report (e.g., project IDs and unique IDs). |
None
|
Returns:
Type | Description |
---|---|
ReportInfo
|
The info for the report. |
Examples:
>>> report = client.reports.get_datascience_report(
... report_type_id="RET51",
... input_data={
... "projectId": ["PRO123"],
... "uniqueId": ["DAT123_DAC123"]
... }
... )
Source code in src/albert/collections/reports.py
RoleCollection
RoleCollection(*, session: AlbertSession)
Bases: BaseCollection
RoleCollection is a collection class for managing Role entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new role. |
get_by_id |
Retrieve a Role by its ID. |
list |
Lists the available Roles |
Source code in src/albert/collections/roles.py
create
create(*, role: Role)
Create a new role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role
|
Role
|
The role to create. |
required |
Source code in src/albert/collections/roles.py
get_by_id
Retrieve a Role by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the role. |
required |
Returns:
Type | Description |
---|---|
Role
|
The retrieved role. |
Source code in src/albert/collections/roles.py
list
Lists the available Roles
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params
|
dict
|
description, by default {} |
None
|
Returns:
Type | Description |
---|---|
List
|
List of available Roles |
Source code in src/albert/collections/roles.py
StorageLocationsCollection
StorageLocationsCollection(*, session: AlbertSession)
Bases: BaseCollection
StorageLocationsCollection is a collection class for managing StorageLoction entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert Session information |
required |
Methods:
Name | Description |
---|---|
create |
Create a new storage location. |
delete |
Delete a storage location by its ID. |
get_by_id |
Get a storage location by its ID. |
list |
List storage locations with optional filtering. |
update |
Update a storage location. |
Source code in src/albert/collections/storage_locations.py
create
create(
*, storage_location: StorageLocation
) -> StorageLocation
Create a new storage location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storage_location
|
StorageLocation
|
The storage location to create. |
required |
Returns:
Type | Description |
---|---|
StorageLocation
|
The created storage location. |
Source code in src/albert/collections/storage_locations.py
delete
delete(*, id: str) -> None
Delete a storage location by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the storage location to delete. |
required |
Source code in src/albert/collections/storage_locations.py
get_by_id
get_by_id(*, id: str) -> StorageLocation
Get a storage location by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the storage location to retrieve. |
required |
Returns:
Type | Description |
---|---|
StorageLocation
|
The retrieved storage location with the given ID. |
Source code in src/albert/collections/storage_locations.py
list
list(
*,
name: str | list[str] | None = None,
exact_match: bool = False,
location: str | Location | None = None,
start_key: str | None = None,
limit: int = 50,
) -> Generator[StorageLocation, None, None]
List storage locations with optional filtering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | list[str] | None
|
The name or names of the storage locations to filter by, by default None |
None
|
exact_match
|
bool
|
Whether to perform an exact match on the name, by default False |
False
|
location
|
str | Location | None
|
The location ID or Location object to filter by, by default None |
None
|
Yields:
Type | Description |
---|---|
Generator[StorageLocation, None, None]
|
description |
Source code in src/albert/collections/storage_locations.py
update
update(
*, storage_location: StorageLocation
) -> StorageLocation
Update a storage location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
storage_location
|
StorageLocation
|
The storage location to update. |
required |
Returns:
Type | Description |
---|---|
StorageLocation
|
The updated storage location as returned by the server. |
Source code in src/albert/collections/storage_locations.py
SubstanceCollection
SubstanceCollection(*, session: AlbertSession)
Bases: BaseCollection
SubstanceCollection is a collection class for managing Substance entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
An instance of the Albert session used for API interactions. |
required |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
str
|
The base URL for making API requests related to substances. |
Methods:
Name | Description |
---|---|
get_by_ids |
Retrieves a list of substances by their CAS IDs and optional region. |
get_by_id |
Retrieves a single substance by its CAS ID and optional region. |
Source code in src/albert/collections/substance.py
get_by_id
get_by_id(
*,
cas_id: str,
region: str = "US",
catch_errors: bool | None = None,
) -> SubstanceInfo
Get a substance by its CAS ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cas_id
|
str
|
The CAS ID of the substance to retrieve. |
required |
region
|
str
|
The region to filter the substance by, by default "US". |
'US'
|
catch_errors
|
bool
|
Whether to catch errors for unknown CAS, by default False. |
None
|
Returns:
Type | Description |
---|---|
SubstanceInfo
|
The retrieved substance or raises an error if not found. |
Source code in src/albert/collections/substance.py
get_by_ids
get_by_ids(
*,
cas_ids: list[str],
region: str = "US",
catch_errors: bool | None = None,
) -> list[SubstanceInfo]
Get substances by their CAS IDs.
If catch_errors
is set to False, the number of substances returned
may be less than the number of CAS IDs provided if any of the CAS IDs result in an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cas_ids
|
list[str]
|
A list of CAS IDs to retrieve substances for. |
required |
region
|
str
|
The region to filter the subastance by, by default "US" |
'US'
|
catch_errors
|
bool
|
Whether to catch errors for unknown CAS, by default True. |
None
|
Returns:
Type | Description |
---|---|
list[SubstanceInfo]
|
A list of substances with the given CAS IDs. |
Source code in src/albert/collections/substance.py
TagCollection
TagCollection(*, session: AlbertSession)
Bases: BaseCollection
TagCollection is a collection class for managing Tag entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Attributes:
Name | Type | Description |
---|---|---|
base_path |
str
|
The base URL for tag API requests. |
Methods:
Name | Description |
---|---|
list |
Lists tag entities with optional filters. |
tag_exists |
Checks if a tag exists by its name. |
create |
Creates a new tag entity. |
get_by_id |
Retrieves a tag by its ID. |
get_by_ids |
Retrieve a list of tags by their IDs. |
get_by_tag |
Retrieves a tag by its name. |
delete |
Deletes a tag by its ID. |
rename |
Renames an existing tag entity. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Source code in src/albert/collections/tags.py
create
Creates a new tag entity if the given tag does not exist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag
|
Union[str, Tag]
|
The tag name or Tag object to create. |
required |
Returns:
Type | Description |
---|---|
Tag
|
The created Tag object or the existing Tag object of it already exists. |
Source code in src/albert/collections/tags.py
delete
delete(*, id: str) -> None
Deletes a tag by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the tag to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/tags.py
get_by_id
get_by_ids
Source code in src/albert/collections/tags.py
get_by_tag
Retrieves a tag by its name of None if not found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag
|
str
|
The name of the tag to retrieve. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
Tag
|
The Tag object if found, None otherwise. |
Source code in src/albert/collections/tags.py
list
list(
*,
limit: int = 50,
order_by: OrderBy = DESCENDING,
name: str | list[str] | None = None,
exact_match: bool = True,
start_key: str | None = None,
) -> Iterator[Tag]
Lists Tag entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of tags to return, by default 50. |
50
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
name
|
Union[str, None]
|
The name of the tag to filter by, by default None. |
None
|
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
start_key
|
Optional[str]
|
The starting point for the next set of results, by default None. |
None
|
Returns:
Type | Description |
---|---|
Iterator[Tag]
|
An iterator of Tag objects. |
Source code in src/albert/collections/tags.py
rename
Renames an existing tag entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old_name
|
str
|
The current name of the tag. |
required |
new_name
|
str
|
The new name of the tag. |
required |
Returns:
Type | Description |
---|---|
Tag
|
The renamed Tag. |
Source code in src/albert/collections/tags.py
tag_exists
Checks if a tag exists by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag
|
str
|
The name of the tag to check. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if the tag exists, False otherwise. |
Source code in src/albert/collections/tags.py
TaskCollection
TaskCollection(*, session: AlbertSession)
Bases: BaseCollection
TaskCollection is a collection class for managing Task entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert Session information |
required |
Methods:
Name | Description |
---|---|
add_block |
Add a block to a Property task. |
create |
Create a new task. Tasks can be of different types, such as PropertyTask, and are created using the provided task object. |
delete |
Delete a task. |
get_by_id |
Retrieve a task by its ID. |
get_history |
|
list |
Search for tasks matching the given criteria. |
remove_block |
Remove a block from a Property task. |
update |
Update a task. |
update_block_workflow |
Update the workflow of a specific block within a task. |
Source code in src/albert/collections/tasks.py
add_block
add_block(
*,
task_id: TaskId,
data_template_id: DataTemplateId,
workflow_id: WorkflowId,
) -> None
Add a block to a Property task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to add the block to. |
required |
data_template_id
|
DataTemplateId
|
The ID of the data template to use for the block. |
required |
workflow_id
|
WorkflowId
|
The ID of the workflow to assign to the block. |
required |
Returns:
Type | Description |
---|---|
None
|
This method does not return any value. |
Source code in src/albert/collections/tasks.py
create
Create a new task. Tasks can be of different types, such as PropertyTask, and are created using the provided task object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
BaseTask
|
The task object to create. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The registered task object. |
Source code in src/albert/collections/tasks.py
delete
delete(*, id: TaskId) -> None
Delete a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
The ID of the task to delete. |
required |
get_by_id
Retrieve a task by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
The ID of the task to retrieve. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The task object with the provided ID. |
Source code in src/albert/collections/tasks.py
get_history
get_history(
*,
id: TaskId,
order: OrderBy = DESCENDING,
limit: int = 1000,
entity: HistoryEntity | None = None,
blockId: str | None = None,
startKey: str | None = None,
) -> TaskHistory
Source code in src/albert/collections/tasks.py
list
list(
*,
order: OrderBy = DESCENDING,
text: str | None = None,
sort_by: str | None = None,
tags: list[str] | None = None,
task_id: list[str] | None = None,
linked_task: list[str] | None = None,
category: TaskCategory | None = None,
albert_id: list[str] | None = None,
data_template: list[str] | None = None,
assigned_to: list[str] | None = None,
location: list[str] | None = None,
priority: list[str] | None = None,
status: list[str] | None = None,
parameter_group: list[str] | None = None,
created_by: list[str] | None = None,
project_id: str | None = None,
limit: int = 100,
offset: int = 0,
) -> Iterator[BaseTask]
Search for tasks matching the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
text
|
str | None
|
The text to search for, by default None |
None
|
sort_by
|
str | None
|
The attribute to sort by, by default None |
None
|
tags
|
list[str] | None
|
The tags to search for, by default None |
None
|
task_id
|
list[str] | None
|
The related task IDs to search for, by default None |
None
|
linked_task
|
list[str] | None
|
The Linked Task IDs to search for, by default None |
None
|
category
|
TaskCategory | None
|
The category of the task to search for, by default None |
None
|
albert_id
|
list[str] | None
|
The Albert IDs to search for, by default None |
None
|
data_template
|
list[str] | None
|
The data template IDs to search for, by default None |
None
|
assigned_to
|
list[str] | None
|
The User IDs to search for, by default None |
None
|
location
|
list[str] | None
|
The Locations names to search for, by default None |
None
|
priority
|
list[str] | None
|
The Priority levels to search for, by default None |
None
|
status
|
list[str] | None
|
The Task Statuses to search for, by default None |
None
|
parameter_group
|
list[str] | None
|
The related Parameter Group IDs to search for, by default None |
None
|
created_by
|
list[str] | None
|
The User IDs of the task creators to search for, by default None |
None
|
project_id
|
str | None
|
The Project ID to search for, by default None |
None
|
Yields:
Type | Description |
---|---|
Iterator[BaseTask]
|
An iterator of matching Task objects. |
Source code in src/albert/collections/tasks.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
remove_block
Remove a block from a Property task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
ID of the Task to remove the block from (e.g., TASFOR1234) |
required |
block_id
|
str
|
ID of the Block to remove (e.g., BLK1) |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/tasks.py
update
Update a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
BaseTask
|
The updated Task object. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The updated Task object as it exists in the Albert platform. |
Source code in src/albert/collections/tasks.py
update_block_workflow
update_block_workflow(
*,
task_id: TaskId,
block_id: BlockId,
workflow_id: WorkflowId,
) -> None
Update the workflow of a specific block within a task.
This method updates the workflow of a specified block within a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The ID of the task. |
required |
block_id
|
str
|
The ID of the block within the task. |
required |
workflow_id
|
str
|
The ID of the new workflow to be assigned to the block. |
required |
Returns:
Type | Description |
---|---|
None
|
This method does not return any value. |
Notes
- The method asserts that the retrieved task is an instance of
PropertyTask
. - If the block's current workflow matches the new workflow ID, no update is performed.
- The method handles the case where the block has a default workflow named "No Parameter Group".
Source code in src/albert/collections/tasks.py
UnNumberCollection
UnNumberCollection(*, session: AlbertSession)
Bases: BaseCollection
UnNumberCollection is a collection class for managing UnNumber entities in the Albert platform.
Note
Creating UN Numbers is not supported via the SDK, as UN Numbers are highly controlled by Albert.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
This method is not implemented as UN Numbers cannot be created through the SDK. |
get_by_id |
Retrieve a UN Number by its ID. |
get_by_name |
Retrieve a UN Number by its name. |
list |
List UN Numbers matching the provided criteria. |
Source code in src/albert/collections/un_numbers.py
create
get_by_id
Retrieve a UN Number by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the UN Number to retrieve. |
required |
Returns:
Type | Description |
---|---|
UnNumber
|
The corresponding UN Number |
Source code in src/albert/collections/un_numbers.py
get_by_name
Retrieve a UN Number by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the UN Number to retrieve |
required |
Returns:
Type | Description |
---|---|
UnNumber | None
|
The corresponding UN Number or None if not found |
Source code in src/albert/collections/un_numbers.py
list
list(
*,
name: str | None = None,
exact_match: bool = False,
limit: int = 50,
start_key: str | None = None,
) -> Iterator[UnNumber]
List UN Numbers matching the provided criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
The name of the UN Number to search for, by default None |
None
|
exact_match
|
bool
|
Weather to return exact matches only, by default False |
False
|
Yields:
Type | Description |
---|---|
Iterator[UnNumber]
|
The UN Numbers matching the search criteria |
Source code in src/albert/collections/un_numbers.py
UnitCollection
UnitCollection(*, session: AlbertSession)
Bases: BaseCollection
UnitCollection is a collection class for managing Unit entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Creates a new unit entity. |
delete |
Deletes a unit by its ID. |
get_by_id |
Retrieves a unit by its ID. |
get_by_ids |
Retrieves a set of units by their IDs |
get_by_name |
Retrieves a unit by its name. |
list |
Lists unit entities with optional filters. |
unit_exists |
Checks if a unit exists by its name. |
update |
Updates a unit entity by its ID. |
Source code in src/albert/collections/units.py
create
Creates a new unit entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit
|
Unit
|
The unit object to create. |
required |
Returns:
Type | Description |
---|---|
Unit
|
The created Unit object. |
Source code in src/albert/collections/units.py
delete
delete(*, id: str) -> None
Deletes a unit by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the unit to delete. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/units.py
get_by_id
Retrieves a unit by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID of the unit to retrieve. |
required |
Returns:
Type | Description |
---|---|
Unit
|
The Unit object if found. |
Source code in src/albert/collections/units.py
get_by_ids
Retrieves a set of units by their IDs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str]
|
The IDs of the units to retrieve. |
required |
Returns:
Type | Description |
---|---|
list[Unit]
|
The Unit objects |
Source code in src/albert/collections/units.py
get_by_name
Retrieves a unit by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the unit to retrieve. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default False. |
False
|
Returns:
Type | Description |
---|---|
Optional[Unit]
|
The Unit object if found, None otherwise. |
Source code in src/albert/collections/units.py
list
list(
*,
limit: int = 100,
name: str | list[str] | None = None,
category: UnitCategory | None = None,
order_by: OrderBy = DESCENDING,
exact_match: bool = False,
start_key: str | None = None,
verified: bool | None = None,
) -> Iterator[Unit]
Lists unit entities with optional filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The maximum number of units to return, by default 50. |
100
|
name
|
Optional[str]
|
The name of the unit to filter by, by default None. |
None
|
category
|
Optional[UnitCategory]
|
The category of the unit to filter by, by default None. |
None
|
order_by
|
OrderBy
|
The order by which to sort the results, by default OrderBy.DESCENDING. |
DESCENDING
|
exact_match
|
bool
|
Whether to match the name exactly, by default False. |
False
|
start_key
|
Optional[str]
|
The starting point for the next set of results, by default None. |
None
|
Returns:
Type | Description |
---|---|
Iterator[Unit]
|
An iterator of Unit objects. |
Source code in src/albert/collections/units.py
unit_exists
Checks if a unit exists by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the unit to check. |
required |
exact_match
|
bool
|
Whether to match the name exactly, by default True. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if the unit exists, False otherwise. |
Source code in src/albert/collections/units.py
update
Updates a unit entity by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit
|
Unit
|
The updated Unit object. |
required |
Returns:
Type | Description |
---|---|
Unit
|
The updated Unit |
Source code in src/albert/collections/units.py
UserCollection
UserCollection(*, session: AlbertSession)
Bases: BaseCollection
UserCollection is a collection class for managing User entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create a new User |
get_by_id |
Retrieves a User by its ID. |
get_current_user |
Retrieves the current authenticated user. |
list |
Lists Users based on criteria |
update |
Update a User entity. |
Source code in src/albert/collections/users.py
create
Create a new User
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
User
|
The user to create |
required |
Returns:
Type | Description |
---|---|
User
|
The created User |
Source code in src/albert/collections/users.py
get_by_id
get_current_user
get_current_user() -> User
Retrieves the current authenticated user.
Returns:
Type | Description |
---|---|
User
|
The current User object. |
Source code in src/albert/collections/users.py
list
list(
*,
limit: int = 50,
offset: int | None = None,
text: str | None = None,
status: Status | None = None,
search_fields: str | None = None,
) -> Iterator[User]
Lists Users based on criteria
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
Optional[str]
|
text to search against, by default None |
None
|
Returns:
Type | Description |
---|---|
Generator
|
Generator of matching Users or None |
Source code in src/albert/collections/users.py
update
Update a User entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
User
|
The updated User entity. |
required |
Returns:
Type | Description |
---|---|
User
|
The updated User entity as returned by the server. |
Source code in src/albert/collections/users.py
WorkflowCollection
WorkflowCollection(*, session: AlbertSession)
Bases: BaseCollection
WorkflowCollection is a collection class for managing Workflow entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
Name | Description |
---|---|
create |
Create or return matching workflows for the provided list of workflows. |
get_by_id |
Retrieve a Workflow by its ID. |
get_by_ids |
Returns a list of Workflow objects by their IDs. |
list |
List all workflows. Unlikly to be used in production. |
Source code in src/albert/collections/workflows.py
create
Create or return matching workflows for the provided list of workflows. This endpoint automatically tries to find an existing workflow with the same parameter setpoints, and will either return the existing workflow or create a new one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflows
|
list[Workflow]
|
A list of Workflow objects to find or create. |
required |
Returns:
Type | Description |
---|---|
list[Workflow]
|
A list of created or found Workflow objects. |
Source code in src/albert/collections/workflows.py
get_by_id
get_by_ids
Returns a list of Workflow objects by their IDs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
list[str]
|
The list of Workflow IDs to retrieve. |
required |
Returns:
Type | Description |
---|---|
list[Workflow]
|
The list of Workflow objects matching the provided IDs. |
Source code in src/albert/collections/workflows.py
list
List all workflows. Unlikly to be used in production.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
limit
|
int
|
The number of workflows to return, by default 50. |
50
|
Yields:
Type | Description |
---|---|
Iterator[Workflow]
|
An iterator of Workflow objects. |
Source code in src/albert/collections/workflows.py
WorksheetCollection
WorksheetCollection(*, session: AlbertSession)
Bases: BaseCollection
WorksheetCollection is a collection class for managing Worksheet entities in the Albert platform.
Methods:
Name | Description |
---|---|
add_sheet |
Create a new blank sheet in the Worksheet with the specified name. |
get_by_project_id |
Retrieve a worksheet by its project ID. Projects and Worksheets are 1:1 in the Albert platform. |
setup_new_sheet_from_template |
Create a new sheet in the Worksheet related to the specified Project from a template. |
setup_worksheet |
Setup a new worksheet for a project. |
Source code in src/albert/collections/worksheets.py
add_sheet
Create a new blank sheet in the Worksheet with the specified name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
The project ID for the Worksheet to add the sheet to. |
required |
sheet_name
|
str
|
The name of the new sheet. |
required |
Returns:
Type | Description |
---|---|
Worksheet
|
The Worksheet object for the project. |
Source code in src/albert/collections/worksheets.py
get_by_project_id
Retrieve a worksheet by its project ID. Projects and Worksheets are 1:1 in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
The project ID to retrieve the worksheet for. |
required |
Returns:
Type | Description |
---|---|
Worksheet
|
The Worksheet object for that project. |
Source code in src/albert/collections/worksheets.py
setup_new_sheet_from_template
setup_new_sheet_from_template(
*,
project_id: ProjectId,
sheet_template_id: str,
sheet_name: str,
) -> Worksheet
Create a new sheet in the Worksheet related to the specified Project from a template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
description |
required |
sheet_template_id
|
str
|
description |
required |
sheet_name
|
str
|
description |
required |
Returns:
Type | Description |
---|---|
Worksheet
|
The Worksheet object for the project. |
Source code in src/albert/collections/worksheets.py
setup_worksheet
Setup a new worksheet for a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
The project ID to setup the worksheet for. |
required |
add_sheet
|
bool
|
Whether to add a blank sheet to the worksheet, by default False |
False
|
Returns:
Type | Description |
---|---|
Worksheet
|
The Worksheet object for the project. |