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
AlbertPaginator
AlbertPaginator(
*,
path: str,
mode: PaginationMode,
session: AlbertSession,
deserialize: Callable[
[Iterable[dict]], Iterable[ItemType]
],
params: dict[str, str] | None = None,
)
Bases: Iterator[ItemType]
Helper class for pagination through Albert endpoints.
Two pagination modes are possible:
- Offset-based via by the offset query parameter
- Key-based via by the startKey query parameter and 'lastKey' response field
A custom deserialize function is provided when additional logic is required to load
the raw items returned by the search listing, e.g., making additional Albert API calls.
Source code in src/albert/core/pagination.py
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
auth_manager: AlbertClientCredentials
| AlbertSSOClient
| 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 relative request paths (e.g., "https://app.albertinvent.com"). |
required |
token
|
str | None
|
A static JWT token for authentication. Ignored if |
None
|
auth_manager
|
AlbertClientCredentials | AlbertSSOClient
|
An authentication manager used to dynamically fetch and refresh tokens.
If provided, it overrides |
None
|
retries
|
int
|
The number of automatic retries on failed requests (default is 3). |
None
|
Methods:
| Name | Description |
|---|---|
request |
|
Source code in src/albert/core/session.py
request
Source code in src/albert/core/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: BaseAlbertModel
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 |
|---|---|
create |
Creates a new company entity. |
delete |
Deletes a company entity. |
exists |
Checks if a company exists by its name. |
get_all |
Get all company entities with optional filters. |
get_by_id |
Get a company by its ID. |
get_by_name |
Retrieves a company by its name. |
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
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 |
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
get_all
get_all(
*,
limit: int = 50,
name: str | list[str] = None,
exact_match: bool = True,
start_key: str | None = None,
) -> Iterator[Company]
Get all 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
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
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
pydantic-model
Bases: BaseAlbertModel
Show JSON schema:
{
"$defs": {
"FacetType": {
"enum": [
"text"
],
"title": "FacetType",
"type": "string"
},
"FacetValue": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"count": {
"title": "Count",
"type": "integer"
}
},
"required": [
"name",
"count"
],
"title": "FacetValue",
"type": "object"
}
},
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"parameter": {
"title": "Parameter",
"type": "string"
},
"type": {
"$ref": "#/$defs/FacetType"
},
"Value": {
"items": {
"$ref": "#/$defs/FacetValue"
},
"title": "Value",
"type": "array"
}
},
"required": [
"name",
"parameter",
"type"
],
"title": "FacetItem",
"type": "object"
}
Fields:
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. |
exists |
Check if an inventory item exists. |
get_all |
Retrieve fully hydrated InventoryItem entities with optional filters. |
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 a 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. |
merge |
Merge one or multiple child inventory into a parent inventory item. |
search |
Search for Inventory matching the provided criteria. |
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
exists
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
get_all
get_all(
*, params: InventoryFilterParams | None = None
) -> Iterator[InventoryItem]
Retrieve fully hydrated InventoryItem entities with optional filters.
This method returns complete entity data using get_by_ids.
Use :meth:search for faster retrieval when you only need lightweight, partial (unhydrated) entities.
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 a 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
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(
*, params: InventoryFilterParams | None = None
) -> Iterator[InventorySearchItem]
Search for Inventory matching the provided criteria.
⚠️ This method returns partial (unhydrated) entities to optimize performance.
To retrieve fully detailed entities, use :meth:get_all instead.
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
InventoryFilterParams
pydantic-model
Bases: BaseAlbertModel
Structured filters for inventory search and retrieval.
Show JSON schema:
{
"$defs": {
"AuditFields": {
"description": "The audit fields for a resource",
"properties": {
"by": {
"default": null,
"title": "By",
"type": "string"
},
"byName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Byname"
},
"at": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "At"
}
},
"title": "AuditFields",
"type": "object"
},
"Cas": {
"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"
},
"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"
},
"Company": {
"description": "Company is a Pydantic model representing a company entity.\n\nAttributes\n----------\nname : str\n The name of the company.\nid : str | None\n The Albert ID of the company. Set when the company is retrieved from Albert.\ndistance : float | None\n The scores of a company in a search result, optional. Read-only.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"name": {
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"distance": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Distance"
}
},
"required": [
"name"
],
"title": "Company",
"type": "object"
},
"EntityLink": {
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
}
},
"required": [
"id"
],
"title": "EntityLink",
"type": "object"
},
"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"
},
"InventoryCategory": {
"enum": [
"RawMaterials",
"Consumables",
"Equipment",
"Formulas"
],
"title": "InventoryCategory",
"type": "string"
},
"Location": {
"description": "A location in Albert.\n\nAttributes\n----------\nname : str\n The name of the location.\nid : str | None\n The Albert ID of the location. Set when the location is retrieved from Albert.\nlatitude : float\n The latitude of the location.\nlongitude : float\n The longitude of the location.\naddress : str\n The address of the location.\ncountry : str | None\n The country code of the location. Must be two characters long.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"name": {
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"latitude": {
"title": "Latitude",
"type": "number"
},
"longitude": {
"title": "Longitude",
"type": "number"
},
"address": {
"title": "Address",
"type": "string"
},
"country": {
"anyOf": [
{
"maxLength": 2,
"minLength": 2,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Country"
}
},
"required": [
"name",
"latitude",
"longitude",
"address"
],
"title": "Location",
"type": "object"
},
"OrderBy": {
"enum": [
"desc",
"asc"
],
"title": "OrderBy",
"type": "string"
},
"Role": {
"description": "A role in Albert. Note: Roles are not currently creatable via the SDK.\n\nAttributes\n----------\nname : str\n The name of the role.\nid : str\n The Albert ID of the role. Set when the role is retrieved from Albert.\npolicies : list[Any] | None\n The policies associated with the role.\ntenant : str\n The tenant ID of the role.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"name": {
"title": "Name",
"type": "string"
},
"policies": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Policies"
},
"tenant": {
"title": "Tenant",
"type": "string"
}
},
"required": [
"name",
"tenant"
],
"title": "Role",
"type": "object"
},
"Status": {
"description": "The status of a resource",
"enum": [
"active",
"inactive"
],
"title": "Status",
"type": "string"
},
"StorageLocation": {
"description": "A storage location entity. For example, a specific flammables cabinet or a storage room.\n\nAttributes\n----------\nname : str\n The name of the storage location.\nid : str | None\n The Albert ID of the storage location. Set when the storage location is retrieved from Albert.\nlocation : Location\n The location entity link of the storage location.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"name": {
"maxLength": 255,
"minLength": 2,
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"Location": {
"anyOf": [
{
"$ref": "#/$defs/Location"
},
{
"$ref": "#/$defs/EntityLink"
}
],
"title": "Location"
}
},
"required": [
"name",
"Location"
],
"title": "StorageLocation",
"type": "object"
},
"User": {
"description": "Represents a User on the Albert Platform\n\nAttributes\n----------\nname : str\n The name of the user.\nid : str | None\n The Albert ID of the user. Set when the user is retrieved from Albert.\nlocation : Location | None\n The location of the user.\nemail : EmailStr | None\n The email of the user.\nroles : list[Role]\n The roles of the user.\nuser_class : UserClass\n The ACL class level of the user.\nmetadata : dict[str, str | list[EntityLink] | EntityLink] | None",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"name": {
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"Location": {
"anyOf": [
{
"$ref": "#/$defs/Location"
},
{
"$ref": "#/$defs/EntityLink"
},
{
"type": "null"
}
],
"default": null,
"title": "Location"
},
"email": {
"default": null,
"format": "email",
"title": "Email",
"type": "string"
},
"Roles": {
"items": {
"anyOf": [
{
"$ref": "#/$defs/Role"
},
{
"$ref": "#/$defs/EntityLink"
}
]
},
"maxItems": 1,
"title": "Roles",
"type": "array"
},
"userClass": {
"$ref": "#/$defs/UserClass",
"default": "standard"
},
"Metadata": {
"anyOf": [
{
"additionalProperties": {
"anyOf": [
{
"type": "number"
},
{
"type": "integer"
},
{
"type": "string"
},
{
"$ref": "#/$defs/EntityLink"
},
{
"items": {
"$ref": "#/$defs/EntityLink"
},
"type": "array"
}
]
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Metadata"
}
},
"required": [
"name"
],
"title": "User",
"type": "object"
},
"UserClass": {
"description": "The ACL class level of the user",
"enum": [
"guest",
"standard",
"trusted",
"privileged",
"admin"
],
"title": "UserClass",
"type": "string"
}
},
"description": "Structured filters for inventory search and retrieval.",
"properties": {
"limit": {
"default": 100,
"maximum": 1000,
"minimum": 1,
"title": "Limit",
"type": "integer"
},
"text": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Text"
},
"cas": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Cas"
},
"type": "array"
},
{
"$ref": "#/$defs/Cas"
},
{
"type": "null"
}
],
"default": null,
"title": "Cas"
},
"category": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/InventoryCategory"
},
"type": "array"
},
{
"$ref": "#/$defs/InventoryCategory"
},
{
"type": "null"
}
],
"default": null,
"title": "Category"
},
"company": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Company"
},
"type": "array"
},
{
"$ref": "#/$defs/Company"
},
{
"type": "null"
}
],
"default": null,
"title": "Company"
},
"location": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/Location"
},
"type": "array"
},
{
"$ref": "#/$defs/Location"
},
{
"type": "null"
}
],
"default": null,
"title": "Location"
},
"storage_location": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/StorageLocation"
},
"type": "array"
},
{
"$ref": "#/$defs/StorageLocation"
},
{
"type": "null"
}
],
"default": null,
"title": "Storage Location"
},
"project_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Project Id"
},
"sheet_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Sheet Id"
},
"created_by": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/User"
},
"type": "array"
},
{
"$ref": "#/$defs/User"
},
{
"type": "null"
}
],
"default": null,
"title": "Created By"
},
"lot_owner": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/User"
},
"type": "array"
},
{
"$ref": "#/$defs/User"
},
{
"type": "null"
}
],
"default": null,
"title": "Lot Owner"
},
"tags": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Tags"
},
"match_all_conditions": {
"default": false,
"title": "Match All Conditions",
"type": "boolean"
},
"order": {
"$ref": "#/$defs/OrderBy",
"default": "desc"
},
"sort_by": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": "createdAt",
"title": "Sort By"
}
},
"title": "InventoryFilterParams",
"type": "object"
}
Fields:
-
limit(int) -
text(str | None) -
cas(list[Cas] | Cas | None) -
category(list[InventoryCategory] | InventoryCategory | None) -
company(list[Company] | Company | None) -
location(list[Location] | Location | None) -
storage_location(list[StorageLocation] | StorageLocation | None) -
project_id(ProjectId | None) -
sheet_id(WorksheetId | None) -
created_by(list[User] | User | None) -
lot_owner(list[User] | User | None) -
tags(list[str] | None) -
match_all_conditions(bool) -
order(OrderBy) -
sort_by(str | None)
storage_location
pydantic-field
storage_location: (
list[StorageLocation] | StorageLocation | None
) = None
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
pydantic-model
Bases: BaseAlbertModel, HydrationMixin[InventoryItem]
Show JSON schema:
{
"$defs": {
"AuditFields": {
"description": "The audit fields for a resource",
"properties": {
"by": {
"default": null,
"title": "By",
"type": "string"
},
"byName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Byname"
},
"at": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "At"
}
},
"title": "AuditFields",
"type": "object"
},
"InventoryCategory": {
"enum": [
"RawMaterials",
"Consumables",
"Equipment",
"Formulas"
],
"title": "InventoryCategory",
"type": "string"
},
"InventorySearchPictogramItem": {
"properties": {
"id": {
"title": "Id",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
},
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Status"
}
},
"required": [
"id",
"name"
],
"title": "InventorySearchPictogramItem",
"type": "object"
},
"InventorySearchSDSItem": {
"properties": {
"unNumber": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unnumber"
},
"storageClassName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Storageclassname"
},
"shippingDescription": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Shippingdescription"
},
"storageClassNumber": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Storageclassnumber"
},
"unClassification": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unclassification"
}
},
"title": "InventorySearchSDSItem",
"type": "object"
},
"InventoryUnitCategory": {
"enum": [
"mass",
"volume",
"length",
"pressure",
"units"
],
"title": "InventoryUnitCategory",
"type": "string"
},
"Status": {
"description": "The status of a resource",
"enum": [
"active",
"inactive"
],
"title": "Status",
"type": "string"
},
"Tag": {
"description": "Tag is a Pydantic model representing a tag entity.\n\nAttributes\n----------\ntag : str\n The name of the tag.\nid : str | None\n The Albert ID of the tag. Set when the tag is retrieved from Albert.\n\nMethods\n-------\nfrom_string(tag: str) -> \"Tag\"\n Creates a Tag object from a string.",
"properties": {
"status": {
"anyOf": [
{
"$ref": "#/$defs/Status"
},
{
"type": "null"
}
],
"default": null
},
"Created": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"Updated": {
"anyOf": [
{
"$ref": "#/$defs/AuditFields"
},
{
"type": "null"
}
],
"default": null
},
"name": {
"title": "Name",
"type": "string"
},
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
}
},
"required": [
"name"
],
"title": "Tag",
"type": "object"
}
},
"properties": {
"albertId": {
"title": "Albertid",
"type": "string"
},
"name": {
"default": "",
"title": "Name",
"type": "string"
},
"description": {
"default": "",
"title": "Description",
"type": "string"
},
"category": {
"$ref": "#/$defs/InventoryCategory"
},
"unit": {
"$ref": "#/$defs/InventoryUnitCategory"
},
"lots": {
"items": {
"additionalProperties": true,
"type": "object"
},
"title": "Lots",
"type": "array"
},
"tags": {
"items": {
"$ref": "#/$defs/Tag"
},
"title": "Tags",
"type": "array"
},
"pictogram": {
"items": {
"$ref": "#/$defs/InventorySearchPictogramItem"
},
"title": "Pictogram",
"type": "array"
},
"inventoryOnHand": {
"default": 0.0,
"title": "Inventoryonhand",
"type": "number"
},
"SDS": {
"anyOf": [
{
"$ref": "#/$defs/InventorySearchSDSItem"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"albertId",
"category",
"unit"
],
"title": "InventorySearchItem",
"type": "object"
}
Fields:
-
_collection(BaseCollection | None) -
id(str) -
name(str) -
description(str) -
category(InventoryCategory) -
unit(InventoryUnitCategory) -
lots(list[dict[str, Any]]) -
tags(list[Tag]) -
pictogram(list[InventorySearchPictogramItem]) -
inventory_on_hand(float) -
sds(InventorySearchSDSItem | None)
InventorySpec
pydantic-model
Bases: BaseAlbertModel
Show JSON schema:
{
"$defs": {
"InventorySpecValue": {
"properties": {
"min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Min"
},
"max": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Max"
},
"reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Reference"
},
"comparisonOperator": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Comparisonoperator"
}
},
"title": "InventorySpecValue",
"type": "object"
}
},
"properties": {
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"name": {
"title": "Name",
"type": "string"
},
"datacolumnId": {
"title": "Datacolumnid",
"type": "string"
},
"datacolumnName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datacolumnname"
},
"datatemplateId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datatemplateid"
},
"datatemplateName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datatemplatename"
},
"unitId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unitid"
},
"unitName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unitname"
},
"workflowId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Workflowid"
},
"workflowName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Workflowname"
},
"specConfig": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Specconfig"
},
"Value": {
"anyOf": [
{
"$ref": "#/$defs/InventorySpecValue"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"name",
"datacolumnId"
],
"title": "InventorySpec",
"type": "object"
}
Fields:
-
id(str | None) -
name(str) -
data_column_id(str) -
data_column_name(str | None) -
data_template_id(str | None) -
data_template_name(str | None) -
unit_id(str | None) -
unit_name(str | None) -
workflow_id(str | None) -
workflow_name(str | None) -
spec_config(str | None) -
value(InventorySpecValue | None)
InventorySpecList
pydantic-model
Bases: BaseAlbertModel
Show JSON schema:
{
"$defs": {
"InventorySpec": {
"properties": {
"albertId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Albertid"
},
"name": {
"title": "Name",
"type": "string"
},
"datacolumnId": {
"title": "Datacolumnid",
"type": "string"
},
"datacolumnName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datacolumnname"
},
"datatemplateId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datatemplateid"
},
"datatemplateName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Datatemplatename"
},
"unitId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unitid"
},
"unitName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Unitname"
},
"workflowId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Workflowid"
},
"workflowName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Workflowname"
},
"specConfig": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Specconfig"
},
"Value": {
"anyOf": [
{
"$ref": "#/$defs/InventorySpecValue"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"name",
"datacolumnId"
],
"title": "InventorySpec",
"type": "object"
},
"InventorySpecValue": {
"properties": {
"min": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Min"
},
"max": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Max"
},
"reference": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Reference"
},
"comparisonOperator": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Comparisonoperator"
}
},
"title": "InventorySpecValue",
"type": "object"
}
},
"properties": {
"parentId": {
"title": "Parentid",
"type": "string"
},
"Specs": {
"items": {
"$ref": "#/$defs/InventorySpec"
},
"title": "Specs",
"type": "array"
}
},
"required": [
"parentId",
"Specs"
],
"title": "InventorySpecList",
"type": "object"
}
Fields:
-
parent_id(str) -
specs(list[InventorySpec])
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
pydantic-model
Bases: BaseAlbertModel
Show JSON schema:
{
"properties": {
"parentId": {
"title": "Parentid",
"type": "string"
},
"ChildInventories": {
"items": {
"additionalProperties": {
"type": "string"
},
"type": "object"
},
"title": "Childinventories",
"type": "array"
},
"modules": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Modules"
}
},
"required": [
"parentId",
"ChildInventories"
],
"title": "MergeInventory",
"type": "object"
}
Fields:
-
parent_id(InventoryId) -
child_inventories(list[dict[str, InventoryId]]) -
modules(list[str] | None)
OrderBy
PaginationMode
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 |
|---|---|
get_all |
Lists tag entities with optional filters. |
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_name |
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 if 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
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
get_all
get_all(
*,
limit: int = 50,
order_by: OrderBy = DESCENDING,
name: str | list[str] | None = None,
exact_match: bool = True,
start_key: str | None = None,
) -> Iterator[Tag]
Get all 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
get_by_id
get_by_ids
Source code in src/albert/collections/tags.py
get_by_name
Retrieves a tag by its name or None if not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
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
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
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"
)