Inventory
albert.collections.inventory
ALL_MERGE_MODULES
module-attribute
ALL_MERGE_MODULES = [
"PRICING",
"NOTES",
"SDS",
"PD",
"BD",
"LOT",
"CAS",
"TAS",
"WFL",
"PRG",
"PTD",
]
All modules selectable for inventory merge.
SearchProjectId
module-attribute
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
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
Cas
pydantic-model
Bases: BaseModel
Represents a CAS entity.
Show JSON schema:
{
"$defs": {
"CasCategory": {
"enum": [
"User",
"Verisk",
"TSCA - Public",
"TSCA - Private",
"not TSCA",
"CAS linked to External Database",
"Unknown (Trade Secret)",
"CL_Inventory Upload"
],
"title": "CasCategory",
"type": "string"
},
"Hazard": {
"description": "Represents a chemical hazard.",
"properties": {
"subCategory": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazard subcategory",
"title": "Subcategory"
},
"hCode": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazard code",
"title": "Hcode"
},
"category": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazard category",
"title": "Category"
},
"class": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazard classification",
"title": "Class"
},
"hCodeText": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazard code text",
"title": "Hcodetext"
}
},
"title": "Hazard",
"type": "object"
}
},
"description": "Represents a CAS entity.",
"properties": {
"number": {
"description": "The CAS number.",
"title": "Number",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of the CAS.",
"title": "Name"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The description or name of the CAS.",
"title": "Description"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Notes related to the CAS.",
"title": "Notes"
},
"category": {
"anyOf": [
{
"$ref": "#/$defs/CasCategory"
},
{
"type": "null"
}
],
"default": null,
"description": "The category of the CAS."
},
"casSmiles": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "CAS SMILES notation.",
"title": "Cassmiles"
},
"inchiKey": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "InChIKey of the CAS.",
"title": "Inchikey"
},
"iUpacName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "IUPAC name of the CAS.",
"title": "Iupacname"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The AlbertID of the CAS.",
"title": "Albertid"
},
"hazards": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Hazard"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Hazards associated with the CAS.",
"title": "Hazards"
},
"wgk": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "German Water Hazard Class (WGK) number.",
"title": "Wgk"
},
"ecListNo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "European Community (EC) number.",
"title": "Eclistno"
},
"type": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Type of the CAS.",
"title": "Type"
},
"classificationType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Classification type of the CAS.",
"title": "Classificationtype"
},
"order": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "CAS order.",
"title": "Order"
}
},
"required": [
"number"
],
"title": "Cas",
"type": "object"
}
Fields:
-
number
(str
) -
name
(str | None
) -
description
(str | None
) -
notes
(str | None
) -
category
(CasCategory | None
) -
smiles
(str | None
) -
inchi_key
(str | None
) -
iupac_name
(str | None
) -
id
(str | None
) -
hazards
(list[Hazard] | None
) -
wgk
(str | None
) -
ec_number
(str | None
) -
type
(str | None
) -
classification_type
(str | None
) -
order
(str | None
)
classification_type
pydantic-field
classification_type: str | None = None
Classification type of the CAS.
Company
Bases: BaseResource
Company is a Pydantic model representing a company entity.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the company. |
id |
str | None
|
The Albert ID of the company. Set when the company is retrieved from Albert. |
distance |
float | None
|
The scores of a company in a search result, optional. Read-only. |
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
FacetItem
InventoryCategory
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
InventoryItem
Bases: BaseTaggedResource
An InventoryItem is a Pydantic model representing an item in the inventory. Can be a raw material, consumable, equipment, or formula. Note: Formulas should be registered via the Worksheet collection / Sheet resource.
Returns:
Type | Description |
---|---|
InventoryItem
|
An InventoryItem that can be used to represent an item in the inventory. Can be a raw material, consumable, equipment, or formula. |
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the InventoryItem. |
id |
str | None
|
The Albert ID of the InventoryItem. Set when the InventoryItem is retrieved from Albert. |
description |
str | None
|
The description of the InventoryItem. |
category |
InventoryCategory
|
The category of the InventoryItem. Allowed values are |
unit_category |
InventoryUnitCategory
|
The unit category of the InventoryItem. Can be mass, volume, length, pressure, or units. By default, mass is used for RawMaterials and Formulas, and units is used for Equipment and Consumables. |
security_class |
SecurityClass | None
|
The security class of the InventoryItem. Optional. Can be confidential, shared, or restricted. |
company |
Company | str | None
|
The company associated with the InventoryItem. Can be a Company object or a string. If a String is provided, a Company object with the name of the provided string will be first-or-created. |
minimum |
list[InventoryMinimum] | None
|
The minimum amount of the InventoryItem that must be kept in stock at a given Location. Optional. |
alias |
str | None
|
An alias for the InventoryItem. Optional. |
cas |
list[CasAmount] | None
|
The CAS numbers associated with the InventoryItem. This is how a compositional breakdown can be provided. Optional. |
metadata |
dict[str, str | list[EntityLink] | EntityLink] | None
|
Metadata associated with the InventoryItem. Optional. Allowed metadata fields can be found in the CustomFields documentation. |
project_id |
str | None
|
The project ID associated with the InventoryItem. Read Only. Required for Formulas. |
formula_id |
str | None
|
The formula ID associated with the InventoryItem. Read Only. |
tags |
list[str | Tag] | None
|
The tags associated with the InventoryItem. Optional. If a string is provided, a Tag object with the name of the provided string will be first-or-created. |
Methods:
Name | Description |
---|---|
set_unit_category |
Set unit category from category if not defined. |
validate_company_string |
|
validate_formula_fields |
Ensure required fields are present for formulas. |
validate_un_number |
|
cas
class-attribute
instance-attribute
cas: list[CasAmount] | None = Field(
default=None, alias="Cas"
)
company
class-attribute
instance-attribute
company: SerializeAsEntityLink[Company] | None = Field(
default=None, alias="Company"
)
formula_id
class-attribute
instance-attribute
formula_id: str | None = Field(
default=None,
alias="formulaId",
exclude=True,
frozen=True,
)
metadata
class-attribute
instance-attribute
minimum
class-attribute
instance-attribute
minimum: list[InventoryMinimum] | None = Field(default=None)
project_id
class-attribute
instance-attribute
project_id: str | None = Field(
default=None, alias="parentId"
)
recent_atachment_id
class-attribute
instance-attribute
recent_atachment_id: str | None = Field(
default=None,
alias="recentAttachmentId",
exclude=True,
frozen=True,
)
security_class
class-attribute
instance-attribute
symbols
class-attribute
instance-attribute
task_config
class-attribute
instance-attribute
task_config: list[dict] | None = Field(
default=None,
alias="TaskConfig",
exclude=True,
frozen=True,
)
un_number
class-attribute
instance-attribute
un_number: str | None = Field(
default=None,
alias="unNumber",
exclude=True,
frozen=True,
)
unit_category
class-attribute
instance-attribute
set_unit_category
set_unit_category() -> InventoryItem
Set unit category from category if not defined.
Source code in src/albert/resources/inventory.py
validate_company_string
classmethod
validate_formula_fields
validate_formula_fields() -> InventoryItem
Ensure required fields are present for formulas.
Source code in src/albert/resources/inventory.py
InventorySearchItem
Bases: BaseAlbertModel
inventory_on_hand
class-attribute
instance-attribute
inventory_on_hand: float = Field(
default=0.0, alias="inventoryOnHand"
)
pictogram
class-attribute
instance-attribute
sds
class-attribute
instance-attribute
InventorySpec
Bases: BaseAlbertModel
data_column_id
class-attribute
instance-attribute
data_column_id: str = Field(..., alias='datacolumnId')
data_column_name
class-attribute
instance-attribute
data_column_name: str | None = Field(
default=None, alias="datacolumnName"
)
data_template_id
class-attribute
instance-attribute
data_template_id: str | None = Field(
default=None, alias="datatemplateId"
)
data_template_name
class-attribute
instance-attribute
data_template_name: str | None = Field(
default=None, alias="datatemplateName"
)
spec_config
class-attribute
instance-attribute
spec_config: str | None = Field(
default=None, alias="specConfig"
)
unit_id
class-attribute
instance-attribute
unit_id: str | None = Field(default=None, alias='unitId')
unit_name
class-attribute
instance-attribute
unit_name: str | None = Field(
default=None, alias="unitName"
)
value
class-attribute
instance-attribute
workflow_id
class-attribute
instance-attribute
workflow_id: str | None = Field(
default=None, alias="workflowId"
)
workflow_name
class-attribute
instance-attribute
workflow_name: str | None = Field(
default=None, alias="workflowName"
)
InventorySpecList
Bases: BaseAlbertModel
Location
Bases: BaseResource
A location in Albert.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the location. |
id |
str | None
|
The Albert ID of the location. Set when the location is retrieved from Albert. |
latitude |
float
|
The latitude of the location. |
longitude |
float
|
The longitude of the location. |
address |
str
|
The address of the location. |
country |
str | None
|
The country code of the location. Must be two characters long. |
country
class-attribute
instance-attribute
country: str | None = Field(
None, max_length=2, min_length=2
)
MergeInventory
Bases: BaseAlbertModel
child_inventories
class-attribute
instance-attribute
child_inventories: list[dict[str, InventoryId]] = Field(
alias="ChildInventories"
)
OrderBy
StorageLocation
Bases: BaseResource
A storage location entity. For example, a specific flammables cabinet or a storage room.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the storage location. |
id |
str | None
|
The Albert ID of the storage location. Set when the storage location is retrieved from Albert. |
location |
Location
|
The location entity link of the storage location. |
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
User
Bases: BaseResource
Represents a User on the Albert Platform
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the user. |
id |
str | None
|
The Albert ID of the user. Set when the user is retrieved from Albert. |
location |
Location | None
|
The location of the user. |
email |
EmailStr | None
|
The email of the user. |
roles |
list[Role]
|
The roles of the user. |
user_class |
UserClass
|
The ACL class level of the user. |
metadata |
dict[str, str | list[EntityLink] | EntityLink] | None
|
|
Methods:
Name | Description |
---|---|
to_note_mention |
Convert the user to a note mention string. |
location
class-attribute
instance-attribute
location: SerializeAsEntityLink[Location] | None = Field(
default=None, alias="Location"
)
metadata
class-attribute
instance-attribute
roles
class-attribute
instance-attribute
roles: list[SerializeAsEntityLink[Role]] = Field(
max_length=1, default_factory=list, alias="Roles"
)