Sheets
albert.resources.sheets
AlbertException
AlbertException(message: str)
BaseResource
Bases: BaseAlbertModel
The base resource for all Albert resources.
Attributes:
Name | Type | Description |
---|---|---|
status |
Status | None
|
The status of the resource, optional. |
created |
AuditFields | None
|
Audit fields for the creation of the resource, optional. |
updated |
AuditFields | None
|
Audit fields for the update of the resource, optional. |
Methods:
Name | Description |
---|---|
to_entity_link |
|
created
class-attribute
instance-attribute
updated
class-attribute
instance-attribute
BaseSessionResource
Cell
Bases: BaseResource
A Cell in a Sheet
Attributes:
Name | Type | Description |
---|---|---|
column_id |
str
|
The column ID of the cell. |
row_id |
str
|
The row ID of the cell. |
value |
str | dict
|
The value of the cell. If the cell is an inventory item, this will be a dict. |
type |
CellType
|
The type of the cell. Allowed values are |
name |
str | None
|
The name of the cell. Optional. Default is None. |
calculation |
str
|
The calculation of the cell. Optional. Default is "". |
design_id |
str
|
The design ID of the design this cell is in. |
format |
dict
|
The format of the cell. Optional. Default is {}. The format is a dict with the keys |
raw_value |
str
|
The raw value of the cell. If the cell is an inventory item, this will be the value of the inventory item. Read-only. |
color |
str | None
|
The color of the cell. Read only. |
format
class-attribute
instance-attribute
CellColor
The allowed colors for a cell
CellType
The type of information in the Cell
Column
Bases: BaseSessionResource
A column in a Sheet
Attributes:
Name | Type | Description |
---|---|---|
column_id |
str
|
The column ID of the column. |
name |
str | None
|
The name of the column. Optional. Default is None. |
type |
CellType
|
The type of the column. Allowed values are |
sheet |
Sheet
|
The sheet the column is in. |
cells |
list[Cell]
|
The cells in the column. Read-only. |
df_name |
str
|
The name of the column in the DataFrame. Read-only |
Methods:
Name | Description |
---|---|
recolor_cells |
|
rename |
|
Source code in src/albert/resources/base.py
inventory_id
class-attribute
instance-attribute
inventory_id: str | None = Field(default=None, exclude=True)
recolor_cells
recolor_cells(color: CellColor)
rename
Source code in src/albert/resources/sheets.py
Component
Bases: BaseResource
Represents an amount of an inventory item in a formulation
Attributes:
Name | Type | Description |
---|---|---|
inventory_item |
InventoryItem
|
The inventory item in the component |
amount |
float
|
The amount of the inventory item in the component |
cell |
Cell
|
The cell that the component is in. Read-only. |
Design
Bases: BaseSessionResource
A Design in a Sheet. Designs are sheet subsections that are largly abstracted away from the user.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The Albert ID of the design. |
design_type |
DesignType
|
The type of the design. Allowed values are |
state |
DesignState | None
|
The state of the design. Optional. Default is None. |
grid |
DataFrame | None
|
The grid of the design. Optional. Default is None. Read-only. |
rows |
list[Row] | None
|
The rows of the design. Optional. Default is None. Read-only. |
columns |
list[Column] | None
|
The columns of the design. Optional. Default is None. Read-only. |
Source code in src/albert/resources/base.py
DesignState
DesignType
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
Row
Bases: BaseSessionResource
A row in a Sheet
Attributes:
Name | Type | Description |
---|---|---|
row_id |
str
|
The row ID of the row. |
type |
CellType
|
The type of the row. Allowed values are |
design |
Design
|
The design the row is in. |
sheet |
Sheet
|
The sheet the row is in. |
name |
str | None
|
The name of the row. Optional. Default is None. |
inventory_id |
str | None
|
The inventory ID of the row. Optional. Default is None. |
manufacturer |
str | None
|
The manufacturer of the row. Optional. Default is None. |
row_unique_id |
str
|
The unique ID of the row. Read-only. |
cells |
list[Cell]
|
The cells in the row. Read-only. |
Methods:
Name | Description |
---|---|
recolor_cells |
|
Source code in src/albert/resources/base.py
Sheet
Bases: BaseSessionResource
A Sheet in Albert
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The Albert ID of the sheet. |
name |
str
|
The name of the sheet. |
hidden |
bool
|
Whether the sheet is hidden. |
designs |
list[Design]
|
The designs of the sheet. |
project_id |
str
|
The Albert ID of the project the sheet is in. |
grid |
DataFrame | None
|
The grid of the sheet. Optional. Default is None. Read-only. |
columns |
list[Column]
|
The columns of the sheet. Read-only. |
rows |
list[Row]
|
The rows of the sheet. Read-only. |
Methods:
Name | Description |
---|---|
add_blank_column |
|
add_blank_row |
|
add_formulation |
|
add_formulation_columns |
|
add_inventory_row |
|
delete_column |
|
delete_row |
|
get_column |
|
rename |
|
set_session |
|
set_sheet_fields |
|
update_cells |
|
Source code in src/albert/resources/base.py
formulations
class-attribute
instance-attribute
formulations: list[SheetFormulationRef] = Field(
default_factory=list, alias="Formulas"
)
add_blank_column
Source code in src/albert/resources/sheets.py
add_blank_row
add_blank_row(
*,
row_name: str,
design: DesignType | str | None = PRODUCTS,
position: dict | None = None,
)
Source code in src/albert/resources/sheets.py
add_formulation
add_formulation(
*,
formulation_name: str,
components: list[Component],
enforce_order: bool = False,
) -> Column
Source code in src/albert/resources/sheets.py
add_formulation_columns
add_formulation_columns(
*,
formulation_names: list[str],
starting_position: dict | None = None,
) -> list[Column]
Source code in src/albert/resources/sheets.py
add_inventory_row
Source code in src/albert/resources/sheets.py
delete_column
delete_column(*, column_id: str) -> None
Source code in src/albert/resources/sheets.py
delete_row
Source code in src/albert/resources/sheets.py
get_column
Source code in src/albert/resources/sheets.py
set_session
set_sheet_fields
set_sheet_fields() -> Sheet
Source code in src/albert/resources/sheets.py
update_cells
Source code in src/albert/resources/sheets.py
SheetFormulationRef
Bases: BaseAlbertModel
A reference to a formulation in a sheet
hidden
class-attribute
instance-attribute
hidden: bool = Field(
description="Whether the formulation is hidden"
)
id
class-attribute
instance-attribute
id: str = Field(
description="The Albert ID of the inventory item that is the formulation"
)
name
class-attribute
instance-attribute
name: str = Field(description="The name of the formulation")