Skip to content

Inventory

albert.resources.inventory

Attributes:

Name Type Description
ALL_MERGE_MODULES list[InventoryMergeModule]

All modules selectable for inventory merge.

ALL_MERGE_MODULES

All modules selectable for inventory merge.

InventoryMergeModule

Bases: str, Enum

A data category that can be carried over when merging inventory items.

When duplicate inventory items are merged (see MergeInventory and merge), each selected module names a body of data to fold from the child item(s) into the surviving parent item. When no modules are specified, all modules are included.

Attributes:

Name Type Description
PRICING str

Pricing data.

NOTES str

Notes.

SDS str

Safety Data Sheets.

PD str

Product Design: worksheet column references for this inventory item.

BD str

Batch data.

LOT str

Lot data.

CAS str

CAS numbers.

TAS str

Tasks.

WFL str

Workflows.

PRG str

Parameter groups.

PTD str

Property data.

PRICING

PRICING = 'PRICING'

NOTES

NOTES = 'NOTES'

SDS

SDS = 'SDS'

PD

PD = 'PD'

BD

BD = 'BD'

LOT

LOT = 'LOT'

CAS

CAS = 'CAS'

TAS

TAS = 'TAS'

WFL

WFL = 'WFL'

PRG

PRG = 'PRG'

PTD

PTD = 'PTD'

InventoryCategory

Bases: str, Enum

The kind of material an InventoryItem represents.

Every inventory item belongs to exactly one category, which determines how it is used across the platform and which fields are relevant to it.

Attributes:

Name Type Description
RAW_MATERIALS str

A purchased substance used as an ingredient (e.g. a solvent or pigment). Typically linked to a manufacturing company and one or more CAS numbers.

CONSUMABLES str

Lab supplies consumed during work (e.g. gloves, vials, filters).

EQUIPMENT str

Instruments and apparatus (e.g. a balance or spectrometer).

FORMULAS str

A mixture designed in Albert through a Worksheet. Formulas are not created through the inventory collection; they are produced by the Worksheet collection (WorksheetCollection).

RAW_MATERIALS

RAW_MATERIALS = 'RawMaterials'

CONSUMABLES

CONSUMABLES = 'Consumables'

EQUIPMENT

EQUIPMENT = 'Equipment'

FORMULAS

FORMULAS = 'Formulas'

InventoryUnitCategory

Bases: str, Enum

The dimension of the unit an InventoryItem is measured and stocked in.

Determines how quantities on hand and in formulas are interpreted. When not supplied, the category defaults based on InventoryCategory: MASS for raw materials and formulas, UNITS for equipment and consumables.

Attributes:

Name Type Description
MASS str

Measured by mass (e.g. grams, kilograms).

VOLUME str

Measured by volume (e.g. milliliters, liters).

LENGTH str

Measured by length (e.g. meters).

PRESSURE str

Measured by pressure.

UNITS str

Counted as discrete units (e.g. each item).

MASS

MASS = 'mass'

VOLUME

VOLUME = 'volume'

LENGTH

LENGTH = 'length'

PRESSURE

PRESSURE = 'pressure'

UNITS

UNITS = 'units'

CasAuditFieldsWithEmail

Bases: AuditFields

The audit fields for a CAS resource with email

Show JSON schema:
{
  "description": "The audit fields for a CAS resource with email",
  "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"
    },
    "email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Email"
    }
  },
  "title": "CasAuditFieldsWithEmail",
  "type": "object"
}

Fields:

email

email: str | None = None

CasAmount

Bases: BaseAlbertModel

A single CAS constituent and its concentration within an InventoryItem.

A CasAmount links one CAS number (a chemical substance identifier) to the amount of that substance present in an inventory item, expressed as a range (min to max) with an optional target. A list of these on an InventoryItem gives the item's compositional breakdown.

Identify the CAS in one of two ways: pass a full Cas object as cas (its id, number, and cas_smiles are then copied onto this amount), or pass just the CAS resource id string. Do not pass both.

Example

from albert.resources.inventory import CasAmount

# Reference an existing CAS resource by its Albert ID, 10-30% concentration
amount = CasAmount(min=10.0, max=30.0, id="CAS1")
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": "A CAS entry: a chemical substance identified by its CAS Registry Number.\n\nA ``Cas`` is Albert's dictionary record for a substance. Raw-material Inventory\nItems reference these entries to declare what they are made of, pairing each\n``Cas`` with an amount (see [`CasAmount`][albert.resources.inventory.CasAmount]).\nManage entries through\n[`CasCollection`][albert.collections.cas.CasCollection] (``client.cas``): most fields\nare populated by Albert, so you typically only build a ``Cas`` from a registry\n``number`` when creating a new entry.\n\n!!! example\n    ```python\n    from albert.resources.cas import Cas\n    # Build a CAS entry to register a new substance\n    cas = Cas(number=\"7727-37-9\")\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "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": "Internal classification_type reference.",
          "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"
        },
        "Metadata": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLinkWithName"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/EntityLinkWithName"
                    },
                    {
                      "$ref": "#/$defs/EntityLink"
                    }
                  ]
                },
                "type": "array"
              }
            ]
          },
          "description": "Custom metadata keyed by field. Updatable.",
          "title": "Metadata",
          "type": "object"
        }
      },
      "required": [
        "number"
      ],
      "title": "Cas",
      "type": "object"
    },
    "CasAuditFieldsWithEmail": {
      "description": "The audit fields for a CAS resource with email",
      "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"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Email"
        }
      },
      "title": "CasAuditFieldsWithEmail",
      "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"
    },
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "EntityLinkWithName": {
      "description": "EntityLink that includes the name field in serialization.",
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLinkWithName",
      "type": "object"
    },
    "Hazard": {
      "description": "A single GHS hazard classification associated with a CAS substance.\n\nHazards are read from the CAS record; a [`Cas`][albert.resources.cas.Cas] may carry a list of them.",
      "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"
    },
    "ListItem": {
      "description": "A single allowed value in a configurable list of options.\n\nList items back the choices offered by ``list``-type custom fields (e.g.\ndropdown options) and other fixed option sets in Albert. A\n[`CustomField`][albert.resources.custom_fields.CustomField] with\n[`LIST`][albert.resources.custom_fields.FieldType.LIST] defines a list (keyed\nby ``list_type``, typically the field's name); its selectable options are\n``ListItem`` records with a matching ``list_type``. Managed through\n[`ListsCollection`][albert.collections.lists.ListsCollection] (``client.lists``).\n\n!!! example\n    ```python\n    from albert.resources.lists import ListItem, ListItemCategory\n    item = ListItem(name=\"In Progress\", category=ListItemCategory.USER_DEFINED)\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The display name of the list item (the option value).",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the list item. Set when the item is retrieved from or created in Albert.",
          "title": "Albertid"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/ListItemCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The category of the list item. Allowed values are ``businessDefined``, ``userDefined``, ``projects``, ``extensions``, and ``inventory``."
        },
        "listType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The list this item belongs to. For a list-type custom field this is typically the field's name (see [`CustomField`][albert.resources.custom_fields.CustomField]). For built-in categories the allowed values are ``projectState`` for ``projects``, ``extensions`` for ``extensions``, and ``casCategory`` or ``inventoryFunction`` for ``inventory``.",
          "title": "Listtype"
        }
      },
      "required": [
        "name"
      ],
      "title": "ListItem",
      "type": "object"
    },
    "ListItemCategory": {
      "description": "The category a list item belongs to, which governs its allowed list types.\n\nAttributes\n----------\nBUSINESS_DEFINED : str\n    Predefined values managed at the business/organization level.\nUSER_DEFINED : str\n    Custom values defined by users.\nPROJECTS : str\n    Values used by projects (e.g. project states).\nEXTENSIONS : str\n    Values used by extensions.\nINVENTORY : str\n    Values used by inventory (e.g. CAS categories or inventory functions).",
      "enum": [
        "businessDefined",
        "userDefined",
        "projects",
        "extensions",
        "inventory"
      ],
      "title": "ListItemCategory",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "A single CAS constituent and its concentration within an [`InventoryItem`][albert.resources.inventory.InventoryItem].\n\nA ``CasAmount`` links one CAS number (a chemical substance identifier) to the\namount of that substance present in an inventory item, expressed as a range\n(``min`` to ``max``) with an optional ``target``. A list of these on an\n[`InventoryItem`][albert.resources.inventory.InventoryItem] gives the item's compositional breakdown.\n\nIdentify the CAS in one of two ways: pass a full [`Cas`][albert.resources.cas.Cas]\nobject as ``cas`` (its ``id``, ``number``, and ``cas_smiles`` are then copied onto\nthis amount), or pass just the CAS resource ``id`` string. Do not pass both.\n\n!!! example\n    ```python\n    from albert.resources.inventory import CasAmount\n\n    # Reference an existing CAS resource by its Albert ID, 10-30% concentration\n    amount = CasAmount(min=10.0, max=30.0, id=\"CAS1\")\n    ```",
  "properties": {
    "min": {
      "description": "The minimum amount (concentration) of the CAS in the item.",
      "title": "Min",
      "type": "number"
    },
    "max": {
      "description": "The maximum amount (concentration) of the CAS in the item.",
      "title": "Max",
      "type": "number"
    },
    "inventoryValue": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The target amount of the CAS in the item. Serialized as ``inventoryValue``.",
      "title": "Inventoryvalue"
    },
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the CAS resource this amount represents. Provide either a ``cas`` object or an ``id``; when ``cas`` is given, this is set from it.",
      "title": "Id"
    },
    "casCategory": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the CAS is a trade secret.",
      "title": "Cascategory"
    },
    "inventoryFunction": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/ListItem"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Business-controlled functions associated with the CAS in this inventory context (e.g. what role the substance plays). Values come from a managed list.",
      "title": "Inventoryfunction"
    },
    "type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The CAS type. Can be retrieved from the CAS collection before construction.",
      "title": "Type"
    },
    "classificationType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The EU classification source for the CAS: harmonized, notified, or REACH.",
      "title": "Classificationtype"
    },
    "substanceId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The substance ID linked to this CAS entry.",
      "title": "Substanceid"
    },
    "cas": {
      "anyOf": [
        {
          "$ref": "#/$defs/Cas"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The full CAS object associated with this amount. Read-only after init; excluded from serialization. Provide either a ``cas`` or an ``id``."
    },
    "casSmiles": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The SMILES string of the CAS resource. Read-only; set from the ``cas`` object.",
      "title": "Cassmiles"
    },
    "number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The CAS number (e.g. ``\"7440-32-6\"``). Read-only; set from the ``cas`` object.",
      "title": "Number"
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit metadata for creation. Read-only."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/CasAuditFieldsWithEmail"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit metadata for the last update. Read-only. See Also --------"
    }
  },
  "required": [
    "min",
    "max"
  ],
  "title": "CasAmount",
  "type": "object"
}

Fields:

Validators:

min

min: float

The minimum amount (concentration) of the CAS in the item.

max

max: float

The maximum amount (concentration) of the CAS in the item.

target

target: float | None = None

The target amount of the CAS in the item. Serialized as inventoryValue.

id

id: str | None = None

The Albert ID of the CAS resource this amount represents. Provide either a cas object or an id; when cas is given, this is set from it.

cas_category

cas_category: str | None = None

Whether the CAS is a trade secret.

inventory_function

inventory_function: (
    list[SerializeAsEntityLink[ListItem] | str] | None
) = None

Business-controlled functions associated with the CAS in this inventory context (e.g. what role the substance plays). Values come from a managed list.

type

type: str | None = None

The CAS type. Can be retrieved from the CAS collection before construction.

classification_type

classification_type: str | None = None

The EU classification source for the CAS: harmonized, notified, or REACH.

substance_id

substance_id: str | None = None

The substance ID linked to this CAS entry.

cas

cas: Cas | None = None

The full CAS object associated with this amount. Read-only after init; excluded from serialization. Provide either a cas or an id.

cas_smiles

cas_smiles: str | None = None

The SMILES string of the CAS resource. Read-only; set from the cas object.

number

number: str | None = None

The CAS number (e.g. "7440-32-6"). Read-only; set from the cas object.

created

created: AuditFields | None = None

Audit metadata for creation. Read-only.

updated

updated: CasAuditFieldsWithEmail | None = None

Audit metadata for the last update. Read-only. See Also --------

set_cas_attributes

set_cas_attributes() -> CasAmount

Set attributes after model initialization from the Cas object, if provided.

Source code in src/albert/resources/inventory.py
@model_validator(mode="after")
def set_cas_attributes(self: CasAmount) -> CasAmount:
    """Set attributes after model initialization from the Cas object, if provided."""
    if self.cas is not None:
        object.__setattr__(self, "id", self.cas.id)
        object.__setattr__(self, "cas_smiles", self.cas.smiles)
        object.__setattr__(self, "number", self.cas.number)
    return self

InventoryMinimum

Bases: BaseAlbertModel

A reorder threshold: the minimum stock of an InventoryItem to keep at a Location.

Each entry pairs one Location with the minimum quantity of an item that must be kept on hand there. An InventoryItem may carry several of these, one per Location. Identify the Location either by passing a full Location object as location (its id is then copied onto id), or by passing the location id string directly. Provide one or the other, not both.

Example

from albert.resources.inventory import InventoryMinimum

minimum = InventoryMinimum(id="LOC9999999", minimum=500)
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"
    },
    "Location": {
      "description": "A physical lab or site location in Albert.\n\nLocations are referenced by Tasks and Inventory Items to record where an\nactivity is performed or where a material lives, and each Location can hold\none or more Storage Locations\n([`StorageLocation`][albert.resources.storage_locations.StorageLocation]). Managed\nthrough [`LocationCollection`][albert.collections.locations.LocationCollection].\n\n!!! example\n    ```python\n    from albert.resources.locations import Location\n    location = Location(\n        name=\"Boston Lab\",\n        latitude=42.3601,\n        longitude=-71.0589,\n        address=\"1 Main St\",\n        country=\"US\",\n    )\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The human-readable name of the location.",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the location. Assigned by Albert and populated once the location has been created or retrieved.",
          "title": "Albertid"
        },
        "latitude": {
          "description": "The latitude of the location, in decimal degrees.",
          "title": "Latitude",
          "type": "number"
        },
        "longitude": {
          "description": "The longitude of the location, in decimal degrees.",
          "title": "Longitude",
          "type": "number"
        },
        "address": {
          "description": "The street address of the location.",
          "title": "Address",
          "type": "string"
        },
        "country": {
          "anyOf": [
            {
              "maxLength": 2,
              "minLength": 2,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The two-letter country code of the location (for example, ``\"US\"``).",
          "title": "Country"
        }
      },
      "required": [
        "name",
        "latitude",
        "longitude",
        "address"
      ],
      "title": "Location",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "A reorder threshold: the minimum stock of an [`InventoryItem`][albert.resources.inventory.InventoryItem] to keep at a Location.\n\nEach entry pairs one Location with the minimum quantity of an item that must be\nkept on hand there. An [`InventoryItem`][albert.resources.inventory.InventoryItem] may carry several of these, one per\nLocation. Identify the Location either by passing a full\n[`Location`][albert.resources.locations.Location] object as ``location`` (its ``id`` is\nthen copied onto ``id``), or by passing the location ``id`` string directly. Provide\none or the other, not both.\n\n!!! example\n    ```python\n    from albert.resources.inventory import InventoryMinimum\n\n    minimum = InventoryMinimum(id=\"LOC9999999\", minimum=500)\n    ```",
  "properties": {
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the Location this minimum applies to. Provide either a ``location`` or an ``id``; when ``location`` is given, this is set from it.",
      "title": "Id"
    },
    "location": {
      "anyOf": [
        {
          "$ref": "#/$defs/Location"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Location object this minimum applies to. Excluded from serialization. Provide either a ``location`` or an ``id``."
    },
    "minimum": {
      "description": "The minimum amount of the item that must be kept in stock at the Location. Must be between 0 and 1e15. See Also --------",
      "maximum": 1000000000000000,
      "minimum": 0,
      "title": "Minimum",
      "type": "number"
    }
  },
  "required": [
    "minimum"
  ],
  "title": "InventoryMinimum",
  "type": "object"
}

Fields:

Validators:

id

id: str | None = None

The Albert ID of the Location this minimum applies to. Provide either a location or an id; when location is given, this is set from it.

location

location: Location | None = None

The Location object this minimum applies to. Excluded from serialization. Provide either a location or an id.

minimum

minimum: float

The minimum amount of the item that must be kept in stock at the Location. Must be between 0 and 1e15. See Also --------

check_id_or_location

check_id_or_location() -> InventoryMinimum

Ensure that either an id or a location is provided.

Source code in src/albert/resources/inventory.py
@model_validator(mode="after")
def check_id_or_location(self: InventoryMinimum) -> InventoryMinimum:
    """
    Ensure that either an id or a location is provided.
    """
    if self.id is None and self.location is None:
        raise ValueError(
            "Either an id or a location must be provided for an InventoryMinimum."
        )
    if self.id and self.location and self.location.id != self.id:
        raise ValueError(
            "Only an id or a location can be provided for an InventoryMinimum, not both."
        )

    elif self.location:
        # Avoid recursion by setting the attribute directly
        object.__setattr__(self, "id", self.location.id)
        object.__setattr__(self, "name", self.location.name)

    return self

InventoryItem

Bases: BaseTaggedResource

A catalog entry for a material tracked in Albert.

An InventoryItem is the canonical record for a raw material, consumable, piece of equipment, or formula. Its InventoryCategory determines how it is used across the platform, and once saved it is referenced everywhere by its Inventory ID (format INV..., e.g. "INVA9999999"). Raw materials are typically linked to a manufacturing company and a compositional breakdown of CAS amounts. Formula items are designed in Worksheets rather than created here (the create method rejects Formula items), and a Formula requires a project_id.

Items are managed through InventoryCollection (client.inventory).

Example

from albert.resources.inventory import InventoryItem, InventoryCategory

item = InventoryItem(
    name="Titanium Dioxide",
    category=InventoryCategory.RAW_MATERIALS,
    company="Acme Chemicals",
)
Show JSON schema:
{
  "$defs": {
    "ACL": {
      "description": "A single access rule for a user.",
      "properties": {
        "id": {
          "description": "The id of the user for which this ACL applies",
          "title": "Id",
          "type": "string"
        },
        "fgc": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccessControlLevel"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Fine-Grain Control Level"
        }
      },
      "required": [
        "id"
      ],
      "title": "ACL",
      "type": "object"
    },
    "AccessControlLevel": {
      "description": "Access control levels you can grant users.",
      "enum": [
        "ProjectOwner",
        "ProjectEditor",
        "ProjectViewer",
        "ProjectAllTask",
        "ProjectStrictViewer",
        "ProjectPropertyTask",
        "InventoryOwner",
        "InventoryViewer",
        "CustomTemplateOwner",
        "CustomTemplateViewer",
        "CASFullAccess"
      ],
      "title": "AccessControlLevel",
      "type": "string"
    },
    "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": "A CAS entry: a chemical substance identified by its CAS Registry Number.\n\nA ``Cas`` is Albert's dictionary record for a substance. Raw-material Inventory\nItems reference these entries to declare what they are made of, pairing each\n``Cas`` with an amount (see [`CasAmount`][albert.resources.inventory.CasAmount]).\nManage entries through\n[`CasCollection`][albert.collections.cas.CasCollection] (``client.cas``): most fields\nare populated by Albert, so you typically only build a ``Cas`` from a registry\n``number`` when creating a new entry.\n\n!!! example\n    ```python\n    from albert.resources.cas import Cas\n    # Build a CAS entry to register a new substance\n    cas = Cas(number=\"7727-37-9\")\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "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": "Internal classification_type reference.",
          "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"
        },
        "Metadata": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLinkWithName"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/EntityLinkWithName"
                    },
                    {
                      "$ref": "#/$defs/EntityLink"
                    }
                  ]
                },
                "type": "array"
              }
            ]
          },
          "description": "Custom metadata keyed by field. Updatable.",
          "title": "Metadata",
          "type": "object"
        }
      },
      "required": [
        "number"
      ],
      "title": "Cas",
      "type": "object"
    },
    "CasAmount": {
      "description": "A single CAS constituent and its concentration within an [`InventoryItem`][albert.resources.inventory.InventoryItem].\n\nA ``CasAmount`` links one CAS number (a chemical substance identifier) to the\namount of that substance present in an inventory item, expressed as a range\n(``min`` to ``max``) with an optional ``target``. A list of these on an\n[`InventoryItem`][albert.resources.inventory.InventoryItem] gives the item's compositional breakdown.\n\nIdentify the CAS in one of two ways: pass a full [`Cas`][albert.resources.cas.Cas]\nobject as ``cas`` (its ``id``, ``number``, and ``cas_smiles`` are then copied onto\nthis amount), or pass just the CAS resource ``id`` string. Do not pass both.\n\n!!! example\n    ```python\n    from albert.resources.inventory import CasAmount\n\n    # Reference an existing CAS resource by its Albert ID, 10-30% concentration\n    amount = CasAmount(min=10.0, max=30.0, id=\"CAS1\")\n    ```",
      "properties": {
        "min": {
          "description": "The minimum amount (concentration) of the CAS in the item.",
          "title": "Min",
          "type": "number"
        },
        "max": {
          "description": "The maximum amount (concentration) of the CAS in the item.",
          "title": "Max",
          "type": "number"
        },
        "inventoryValue": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The target amount of the CAS in the item. Serialized as ``inventoryValue``.",
          "title": "Inventoryvalue"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the CAS resource this amount represents. Provide either a ``cas`` object or an ``id``; when ``cas`` is given, this is set from it.",
          "title": "Id"
        },
        "casCategory": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether the CAS is a trade secret.",
          "title": "Cascategory"
        },
        "inventoryFunction": {
          "anyOf": [
            {
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/ListItem"
                  },
                  {
                    "$ref": "#/$defs/EntityLink"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Business-controlled functions associated with the CAS in this inventory context (e.g. what role the substance plays). Values come from a managed list.",
          "title": "Inventoryfunction"
        },
        "type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The CAS type. Can be retrieved from the CAS collection before construction.",
          "title": "Type"
        },
        "classificationType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The EU classification source for the CAS: harmonized, notified, or REACH.",
          "title": "Classificationtype"
        },
        "substanceId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The substance ID linked to this CAS entry.",
          "title": "Substanceid"
        },
        "cas": {
          "anyOf": [
            {
              "$ref": "#/$defs/Cas"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The full CAS object associated with this amount. Read-only after init; excluded from serialization. Provide either a ``cas`` or an ``id``."
        },
        "casSmiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string of the CAS resource. Read-only; set from the ``cas`` object.",
          "title": "Cassmiles"
        },
        "number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The CAS number (e.g. ``\"7440-32-6\"``). Read-only; set from the ``cas`` object.",
          "title": "Number"
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit metadata for creation. Read-only."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/CasAuditFieldsWithEmail"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit metadata for the last update. Read-only. See Also --------"
        }
      },
      "required": [
        "min",
        "max"
      ],
      "title": "CasAmount",
      "type": "object"
    },
    "CasAuditFieldsWithEmail": {
      "description": "The audit fields for a CAS resource with email",
      "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"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Email"
        }
      },
      "title": "CasAuditFieldsWithEmail",
      "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": "A manufacturing company or supplier tracked in Albert.\n\nA Company is the organization that makes or supplies a material. It is the\n``company`` linked on raw-material inventory items: each raw material points\nback to the Company that manufactures it (see\n[`InventoryItem`][albert.resources.inventory.InventoryItem]). Companies are managed\nthrough [`CompanyCollection`][albert.collections.companies.CompanyCollection], accessed as\n``client.companies``.\n\nCompanies are identified by a Company ID (format ``COM...``). A Company is\ntypically minimal: a name plus its assigned ID. You construct one directly\n(``Company(name=\"Acme Chemicals\")``) to create it or to attach it to an\ninventory item.\n\n!!! example\n    ```python\n    from albert.resources.companies import Company\n\n    # Build a company to create or attach to an inventory item\n    company = Company(name=\"Acme Chemicals\")\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The company's name. This is the primary identifier used when searching for or creating a company.",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert Company ID (format ``COM...``). ``None`` until the company is created in or retrieved from Albert.",
          "title": "Albertid"
        },
        "distance": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Search-relevance score returned when the company comes back as a search result. Read-only; not set on companies you build yourself.",
          "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"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "EntityLinkWithName": {
      "description": "EntityLink that includes the name field in serialization.",
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLinkWithName",
      "type": "object"
    },
    "Hazard": {
      "description": "A single GHS hazard classification associated with a CAS substance.\n\nHazards are read from the CAS record; a [`Cas`][albert.resources.cas.Cas] may carry a list of them.",
      "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": {
      "description": "The kind of material an [`InventoryItem`][albert.resources.inventory.InventoryItem] represents.\n\nEvery inventory item belongs to exactly one category, which determines how it\nis used across the platform and which fields are relevant to it.\n\nAttributes\n----------\nRAW_MATERIALS : str\n    A purchased substance used as an ingredient (e.g. a solvent or pigment).\n    Typically linked to a manufacturing ``company`` and one or more CAS numbers.\nCONSUMABLES : str\n    Lab supplies consumed during work (e.g. gloves, vials, filters).\nEQUIPMENT : str\n    Instruments and apparatus (e.g. a balance or spectrometer).\nFORMULAS : str\n    A mixture designed in Albert through a Worksheet. Formulas are not created\n    through the inventory collection; they are produced by the Worksheet\n    collection ([`WorksheetCollection`][albert.collections.worksheets.WorksheetCollection]).",
      "enum": [
        "RawMaterials",
        "Consumables",
        "Equipment",
        "Formulas"
      ],
      "title": "InventoryCategory",
      "type": "string"
    },
    "InventoryMinimum": {
      "description": "A reorder threshold: the minimum stock of an [`InventoryItem`][albert.resources.inventory.InventoryItem] to keep at a Location.\n\nEach entry pairs one Location with the minimum quantity of an item that must be\nkept on hand there. An [`InventoryItem`][albert.resources.inventory.InventoryItem] may carry several of these, one per\nLocation. Identify the Location either by passing a full\n[`Location`][albert.resources.locations.Location] object as ``location`` (its ``id`` is\nthen copied onto ``id``), or by passing the location ``id`` string directly. Provide\none or the other, not both.\n\n!!! example\n    ```python\n    from albert.resources.inventory import InventoryMinimum\n\n    minimum = InventoryMinimum(id=\"LOC9999999\", minimum=500)\n    ```",
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the Location this minimum applies to. Provide either a ``location`` or an ``id``; when ``location`` is given, this is set from it.",
          "title": "Id"
        },
        "location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Location object this minimum applies to. Excluded from serialization. Provide either a ``location`` or an ``id``."
        },
        "minimum": {
          "description": "The minimum amount of the item that must be kept in stock at the Location. Must be between 0 and 1e15. See Also --------",
          "maximum": 1000000000000000,
          "minimum": 0,
          "title": "Minimum",
          "type": "number"
        }
      },
      "required": [
        "minimum"
      ],
      "title": "InventoryMinimum",
      "type": "object"
    },
    "InventoryUnitCategory": {
      "description": "The dimension of the unit an [`InventoryItem`][albert.resources.inventory.InventoryItem] is measured and stocked in.\n\nDetermines how quantities on hand and in formulas are interpreted. When not\nsupplied, the category defaults based on [`InventoryCategory`][albert.resources.inventory.InventoryCategory]: ``MASS``\nfor raw materials and formulas, ``UNITS`` for equipment and consumables.\n\nAttributes\n----------\nMASS : str\n    Measured by mass (e.g. grams, kilograms).\nVOLUME : str\n    Measured by volume (e.g. milliliters, liters).\nLENGTH : str\n    Measured by length (e.g. meters).\nPRESSURE : str\n    Measured by pressure.\nUNITS : str\n    Counted as discrete units (e.g. each item).",
      "enum": [
        "mass",
        "volume",
        "length",
        "pressure",
        "units"
      ],
      "title": "InventoryUnitCategory",
      "type": "string"
    },
    "ListItem": {
      "description": "A single allowed value in a configurable list of options.\n\nList items back the choices offered by ``list``-type custom fields (e.g.\ndropdown options) and other fixed option sets in Albert. A\n[`CustomField`][albert.resources.custom_fields.CustomField] with\n[`LIST`][albert.resources.custom_fields.FieldType.LIST] defines a list (keyed\nby ``list_type``, typically the field's name); its selectable options are\n``ListItem`` records with a matching ``list_type``. Managed through\n[`ListsCollection`][albert.collections.lists.ListsCollection] (``client.lists``).\n\n!!! example\n    ```python\n    from albert.resources.lists import ListItem, ListItemCategory\n    item = ListItem(name=\"In Progress\", category=ListItemCategory.USER_DEFINED)\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The display name of the list item (the option value).",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the list item. Set when the item is retrieved from or created in Albert.",
          "title": "Albertid"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/ListItemCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The category of the list item. Allowed values are ``businessDefined``, ``userDefined``, ``projects``, ``extensions``, and ``inventory``."
        },
        "listType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The list this item belongs to. For a list-type custom field this is typically the field's name (see [`CustomField`][albert.resources.custom_fields.CustomField]). For built-in categories the allowed values are ``projectState`` for ``projects``, ``extensions`` for ``extensions``, and ``casCategory`` or ``inventoryFunction`` for ``inventory``.",
          "title": "Listtype"
        }
      },
      "required": [
        "name"
      ],
      "title": "ListItem",
      "type": "object"
    },
    "ListItemCategory": {
      "description": "The category a list item belongs to, which governs its allowed list types.\n\nAttributes\n----------\nBUSINESS_DEFINED : str\n    Predefined values managed at the business/organization level.\nUSER_DEFINED : str\n    Custom values defined by users.\nPROJECTS : str\n    Values used by projects (e.g. project states).\nEXTENSIONS : str\n    Values used by extensions.\nINVENTORY : str\n    Values used by inventory (e.g. CAS categories or inventory functions).",
      "enum": [
        "businessDefined",
        "userDefined",
        "projects",
        "extensions",
        "inventory"
      ],
      "title": "ListItemCategory",
      "type": "string"
    },
    "Location": {
      "description": "A physical lab or site location in Albert.\n\nLocations are referenced by Tasks and Inventory Items to record where an\nactivity is performed or where a material lives, and each Location can hold\none or more Storage Locations\n([`StorageLocation`][albert.resources.storage_locations.StorageLocation]). Managed\nthrough [`LocationCollection`][albert.collections.locations.LocationCollection].\n\n!!! example\n    ```python\n    from albert.resources.locations import Location\n    location = Location(\n        name=\"Boston Lab\",\n        latitude=42.3601,\n        longitude=-71.0589,\n        address=\"1 Main St\",\n        country=\"US\",\n    )\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The human-readable name of the location.",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the location. Assigned by Albert and populated once the location has been created or retrieved.",
          "title": "Albertid"
        },
        "latitude": {
          "description": "The latitude of the location, in decimal degrees.",
          "title": "Latitude",
          "type": "number"
        },
        "longitude": {
          "description": "The longitude of the location, in decimal degrees.",
          "title": "Longitude",
          "type": "number"
        },
        "address": {
          "description": "The street address of the location.",
          "title": "Address",
          "type": "string"
        },
        "country": {
          "anyOf": [
            {
              "maxLength": 2,
              "minLength": 2,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The two-letter country code of the location (for example, ``\"US\"``).",
          "title": "Country"
        }
      },
      "required": [
        "name",
        "latitude",
        "longitude",
        "address"
      ],
      "title": "Location",
      "type": "object"
    },
    "SecurityClass": {
      "description": "The security (access control) class of a resource.\n\nAttributes\n----------\nSHARED : str\n    Accessible to all members of the tenant.\nRESTRICTED : str\n    Access is restricted to specific teams or users.\nCONFIDENTIAL : str\n    Access is limited to designated users only.\nPRIVATE : str\n    Visible only to the owner. Used by Projects.",
      "enum": [
        "shared",
        "restricted",
        "confidential",
        "private"
      ],
      "title": "SecurityClass",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "Tag": {
      "description": "A freeform text label used to categorize and connect entities.\n\nTags are shared by name across the platform and can be applied to inventory\nitems, companies, tasks, and other records to group and filter them. Managed\nthrough [`TagCollection`][albert.collections.tags.TagCollection] (``client.tags``);\nthe usual entry point is [`get_or_create`][albert.collections.tags.TagCollection.get_or_create].\n\n!!! example\n    ```python\n    from albert.resources.tags import Tag\n    tag = Tag(tag=\"high-priority\")\n    ```\nMethods\n-------\nfrom_string(tag) -> Tag\n    Build a Tag from its name string.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The name of the tag (its text label).",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the tag (format ``TAG...``). Set when the tag is retrieved from or created in Albert. Methods ------- from_string(tag) -> Tag Build a Tag from its name string.",
          "title": "Albertid"
        }
      },
      "required": [
        "name"
      ],
      "title": "Tag",
      "type": "object"
    }
  },
  "description": "A catalog entry for a material tracked in Albert.\n\nAn ``InventoryItem`` is the canonical record for a raw material, consumable,\npiece of equipment, or formula. Its [`InventoryCategory`][albert.resources.inventory.InventoryCategory] determines how it\nis used across the platform, and once saved it is referenced everywhere by its\nInventory ID (format ``INV...``, e.g. ``\"INVA9999999\"``). Raw materials are typically\nlinked to a manufacturing ``company`` and a compositional breakdown of CAS\namounts. Formula items are designed in Worksheets rather than created here (the\n[`create`][albert.collections.inventory.InventoryCollection.create] method rejects\nFormula items), and a Formula requires a ``project_id``.\n\nItems are managed through\n[`InventoryCollection`][albert.collections.inventory.InventoryCollection] (``client.inventory``).\n\n!!! example\n    ```python\n    from albert.resources.inventory import InventoryItem, InventoryCategory\n\n    item = InventoryItem(\n        name=\"Titanium Dioxide\",\n        category=InventoryCategory.RAW_MATERIALS,\n        company=\"Acme Chemicals\",\n    )\n    ```",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The status of the resource, optional."
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the creation of the resource, optional."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the update of the resource, optional."
    },
    "Tags": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Tag"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A list of Tag objects or strings representing tags.",
      "title": "Tags"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The name of the item.",
      "title": "Name"
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert Inventory ID (format ``INV...``). Set when the item is retrieved from or created in Albert. Serialized as ``albertId``.",
      "title": "Albertid"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A free-text description of the item.",
      "title": "Description"
    },
    "category": {
      "$ref": "#/$defs/InventoryCategory",
      "description": "The kind of material this item represents. Required. One of ``RawMaterials``, ``Consumables``, ``Equipment``, or ``Formulas``."
    },
    "unitCategory": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventoryUnitCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The dimension the item is measured in (mass, volume, length, pressure, or units). If not supplied, it defaults from ``category``: mass for raw materials and formulas, units for equipment and consumables."
    },
    "class": {
      "anyOf": [
        {
          "$ref": "#/$defs/SecurityClass"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The access/security class of the item (e.g. confidential, shared, restricted)."
    },
    "Company": {
      "anyOf": [
        {
          "$ref": "#/$defs/Company"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The manufacturing Company associated with the item (links to the Company collection). Accepts a [`Company`][albert.resources.companies.Company] or a name string; a string is turned into a Company that is first-or-created on save.",
      "title": "Company"
    },
    "minimum": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/InventoryMinimum"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Per-Location reorder thresholds for the item. See [`InventoryMinimum`][albert.resources.inventory.InventoryMinimum].",
      "title": "Minimum"
    },
    "alias": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "An alternate name for the item.",
      "title": "Alias"
    },
    "Cas": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/CasAmount"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The item's compositional breakdown as CAS amounts. See [`CasAmount`][albert.resources.inventory.CasAmount].",
      "title": "Cas"
    },
    "isFormulaOverride": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the substance/CAS-level breakdown for this formula has been overridden from the auto-calculated value; commonly set to indicate the formula is not a non-reactive homogeneous mixture.",
      "title": "Isformulaoverride"
    },
    "Metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLinkWithName"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/EntityLinkWithName"
                    },
                    {
                      "$ref": "#/$defs/EntityLink"
                    }
                  ]
                },
                "type": "array"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Custom metadata fields. Allowed keys are defined by the workspace's CustomFields configuration.",
      "title": "Metadata"
    },
    "parentId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The parent Project ID. Required for Formulas. Serialized as ``parentId``.",
      "title": "Parentid"
    },
    "ACL": {
      "description": "Access-control entries governing who can act on the item.",
      "items": {
        "$ref": "#/$defs/ACL"
      },
      "title": "Acl",
      "type": "array"
    },
    "onHand": {
      "default": 0.0,
      "description": "Total amount currently on hand across all lots. Read-only.",
      "title": "Onhand",
      "type": "number"
    },
    "TaskConfig": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Task configuration associated with the item. Read-only.",
      "title": "Taskconfig"
    },
    "formulaId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The formula ID for a formula item. Read-only.",
      "title": "Formulaid"
    },
    "Symbols": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Hazard/pictogram symbols associated with the item. Read-only.",
      "title": "Symbols"
    },
    "unNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The UN hazardous-material number, when applicable. Read-only.",
      "title": "Unnumber"
    },
    "recentAttachmentId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the most recent attachment on the item. Read-only. See Also --------",
      "title": "Recentattachmentid"
    }
  },
  "required": [
    "category"
  ],
  "title": "InventoryItem",
  "type": "object"
}

Fields:

Validators:

name

name: str | None = None

The name of the item.

id

id: str | None = None

The Albert Inventory ID (format INV...). Set when the item is retrieved from or created in Albert. Serialized as albertId.

description

description: str | None = None

A free-text description of the item.

category

The kind of material this item represents. Required. One of RawMaterials, Consumables, Equipment, or Formulas.

unit_category

unit_category: InventoryUnitCategory | None = None

The dimension the item is measured in (mass, volume, length, pressure, or units). If not supplied, it defaults from category: mass for raw materials and formulas, units for equipment and consumables.

security_class

security_class: SecurityClass | None = None

The access/security class of the item (e.g. confidential, shared, restricted).

company

company: SerializeAsEntityLink[Company] | None = None

The manufacturing Company associated with the item (links to the Company collection). Accepts a Company or a name string; a string is turned into a Company that is first-or-created on save.

minimum

minimum: list[InventoryMinimum] | None = None

Per-Location reorder thresholds for the item. See InventoryMinimum.

alias

alias: str | None = None

An alternate name for the item.

cas

cas: list[CasAmount] | None = None

The item's compositional breakdown as CAS amounts. See CasAmount.

is_formula_override

is_formula_override: bool | None = None

Whether the substance/CAS-level breakdown for this formula has been overridden from the auto-calculated value; commonly set to indicate the formula is not a non-reactive homogeneous mixture.

metadata

metadata: dict[str, MetadataItem] | None = None

Custom metadata fields. Allowed keys are defined by the workspace's CustomFields configuration.

project_id

project_id: str | None = None

The parent Project ID. Required for Formulas. Serialized as parentId.

acls

acls: list[ACL]

Access-control entries governing who can act on the item.

inventory_on_hand

inventory_on_hand: float = 0.0

Total amount currently on hand across all lots. Read-only.

task_config

task_config: list[dict] | None = None

Task configuration associated with the item. Read-only.

formula_id

formula_id: str | None = None

The formula ID for a formula item. Read-only.

symbols

symbols: list[dict] | None = None

Hazard/pictogram symbols associated with the item. Read-only.

un_number

un_number: str | None = None

The UN hazardous-material number, when applicable. Read-only.

recent_atachment_id

recent_atachment_id: str | None = None

The ID of the most recent attachment on the item. Read-only. See Also --------

validate_company_string

validate_company_string(value: Any) -> Any
Source code in src/albert/resources/inventory.py
@field_validator("company", mode="before")
@classmethod
def validate_company_string(cls, value: Any) -> Any:
    if isinstance(value, str):
        value = Company(name=value)
    return value

validate_un_number

validate_un_number(value: Any) -> Any
Source code in src/albert/resources/inventory.py
@field_validator("un_number", mode="before")
@classmethod
def validate_un_number(cls, value: Any) -> Any:
    if value == "N/A":
        value = None
    return value

set_unit_category

set_unit_category() -> InventoryItem

Set unit category from category if not defined.

Source code in src/albert/resources/inventory.py
@model_validator(mode="after")
def set_unit_category(self) -> InventoryItem:
    """Set unit category from category if not defined."""
    if self.unit_category is None:
        if self.category in [InventoryCategory.RAW_MATERIALS, InventoryCategory.FORMULAS]:
            object.__setattr__(self, "unit_category", InventoryUnitCategory.MASS)
        elif self.category in [InventoryCategory.EQUIPMENT, InventoryCategory.CONSUMABLES]:
            object.__setattr__(self, "unit_category", InventoryUnitCategory.UNITS)
    return self

validate_formula_fields

validate_formula_fields() -> InventoryItem

Ensure required fields are present for formulas.

Source code in src/albert/resources/inventory.py
@model_validator(mode="after")
def validate_formula_fields(self) -> InventoryItem:
    """Ensure required fields are present for formulas."""
    if self.category == InventoryCategory.FORMULAS and not self.project_id and not self.id:
        # Some legacy on platform formulas don't have a project_id so check if its already on platform
        raise ValueError("A project_id must be supplied for all formulas.")
    return self

InventorySpecValue

Bases: BaseAlbertModel

The expected or reference value(s) of a legacy InventorySpec.

Expresses the declared value of an inventory reference property as a range (min to max), a single reference value, and/or a comparison_operator. Numeric inputs are accepted and stored as strings.

Deprecated with Inventory Specs (removed in SDK 2.0). Prefer AttributeValue and AttributeValueRange via client.attributes.

Show JSON schema:
{
  "description": "The expected or reference value(s) of a legacy [`InventorySpec`][albert.resources.inventory.InventorySpec].\n\nExpresses the declared value of an inventory reference property as a range\n(``min`` to ``max``), a single ``reference`` value, and/or a\n``comparison_operator``. Numeric inputs are accepted and stored as strings.\n\nDeprecated with Inventory Specs (removed in SDK 2.0). Prefer\n[`AttributeValue`][albert.resources.attributes.AttributeValue] and\n[`AttributeValueRange`][albert.resources.attributes.AttributeValueRange] via\n``client.attributes``.",
  "properties": {
    "min": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lower bound of the acceptable range.",
      "title": "Min"
    },
    "max": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The upper bound of the acceptable range.",
      "title": "Max"
    },
    "reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A reference or target value for the property.",
      "title": "Reference"
    },
    "comparisonOperator": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The operator used to compare a measured value against this spec (e.g. ``\">\"``, ``\"<=\"``). Serialized as ``comparisonOperator``.",
      "title": "Comparisonoperator"
    }
  },
  "title": "InventorySpecValue",
  "type": "object"
}

Fields:

Validators:

min

min: str | None = None

The lower bound of the acceptable range.

max

max: str | None = None

The upper bound of the acceptable range.

reference

reference: str | None = None

A reference or target value for the property.

comparison_operator

comparison_operator: str | None = None

The operator used to compare a measured value against this spec (e.g. ">", "<="). Serialized as comparisonOperator.

cast_float_to_str

cast_float_to_str(v: Any) -> Any
Source code in src/albert/resources/inventory.py
@field_validator("min", "max", "reference", mode="before")
@classmethod
def cast_float_to_str(cls, v: Any) -> Any:
    if isinstance(v, int | float):
        return str(v)
    return v

InventorySpec

Bases: BaseAlbertModel

A legacy inventory reference property (definition and value in one object).

An InventorySpec both defines a property and assigns its expected value on one InventoryItem: the property name, the data column (data_column_id, format DAC...), and the InventorySpecValue live inline. Specs are per-item (not shared across inventory) and are attached or read with add_specs and get_specs. Multiple specs on one item are grouped as InventorySpecList.

Use Specs for inventory reference properties (declared expectations that worksheets look up). Do not use Specs for experimentally measured results: those belong in PropertyDataCollection (client.property_data).

Deprecated

Inventory Specs are deprecated and will be removed in SDK 2.0. Prefer AttributeCollection (client.attributes), which separates reusable attribute definitions from per-item reference values. See the Specs → Attributes migration guide.

Example

from albert.resources.inventory import InventorySpec, InventorySpecValue

spec = InventorySpec(
    name="Viscosity",
    data_column_id="DAC9999999",
    value=InventorySpecValue(min=100, max=200),
)
Show JSON schema:
{
  "$defs": {
    "InventorySpecValue": {
      "description": "The expected or reference value(s) of a legacy [`InventorySpec`][albert.resources.inventory.InventorySpec].\n\nExpresses the declared value of an inventory reference property as a range\n(``min`` to ``max``), a single ``reference`` value, and/or a\n``comparison_operator``. Numeric inputs are accepted and stored as strings.\n\nDeprecated with Inventory Specs (removed in SDK 2.0). Prefer\n[`AttributeValue`][albert.resources.attributes.AttributeValue] and\n[`AttributeValueRange`][albert.resources.attributes.AttributeValueRange] via\n``client.attributes``.",
      "properties": {
        "min": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The lower bound of the acceptable range.",
          "title": "Min"
        },
        "max": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The upper bound of the acceptable range.",
          "title": "Max"
        },
        "reference": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A reference or target value for the property.",
          "title": "Reference"
        },
        "comparisonOperator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The operator used to compare a measured value against this spec (e.g. ``\">\"``, ``\"<=\"``). Serialized as ``comparisonOperator``.",
          "title": "Comparisonoperator"
        }
      },
      "title": "InventorySpecValue",
      "type": "object"
    }
  },
  "description": "A legacy inventory reference property (definition and value in one object).\n\nAn ``InventorySpec`` both *defines* a property and *assigns* its expected value\non one [`InventoryItem`][albert.resources.inventory.InventoryItem]: the property\n``name``, the data column (``data_column_id``, format ``DAC...``), and the\n[`InventorySpecValue`][albert.resources.inventory.InventorySpecValue] live\ninline. Specs are per-item (not shared across inventory) and are attached or\nread with\n[`add_specs`][albert.collections.inventory.InventoryCollection.add_specs] and\n[`get_specs`][albert.collections.inventory.InventoryCollection.get_specs].\nMultiple specs on one item are grouped as\n[`InventorySpecList`][albert.resources.inventory.InventorySpecList].\n\nUse Specs for inventory **reference** properties (declared expectations that\nworksheets look up). Do **not** use Specs for experimentally measured results:\nthose belong in\n[`PropertyDataCollection`][albert.collections.property_data.PropertyDataCollection]\n(``client.property_data``).\n\n!!! warning \"Deprecated\"\n    Inventory Specs are deprecated and will be removed in SDK 2.0. Prefer\n    [`AttributeCollection`][albert.collections.attributes.AttributeCollection]\n    (``client.attributes``), which separates reusable attribute definitions from\n    per-item reference values. See the Specs \u2192 Attributes migration guide.\n\n!!! example\n    ```python\n    from albert.resources.inventory import InventorySpec, InventorySpecValue\n\n    spec = InventorySpec(\n        name=\"Viscosity\",\n        data_column_id=\"DAC9999999\",\n        value=InventorySpecValue(min=100, max=200),\n    )\n    ```",
  "properties": {
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the spec. Serialized as ``albertId``.",
      "title": "Albertid"
    },
    "name": {
      "description": "The name of the spec. Required.",
      "title": "Name",
      "type": "string"
    },
    "datacolumnId": {
      "description": "The ID of the data column this spec applies to (format ``DAC...``). Required. Serialized as ``datacolumnId``.",
      "title": "Datacolumnid",
      "type": "string"
    },
    "datacolumnName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display name of the data column. Serialized as ``datacolumnName``.",
      "title": "Datacolumnname"
    },
    "datatemplateId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the associated data template. Serialized as ``datatemplateId``.",
      "title": "Datatemplateid"
    },
    "datatemplateName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display name of the data template. Serialized as ``datatemplateName``.",
      "title": "Datatemplatename"
    },
    "unitId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the unit for the spec value. Serialized as ``unitId``.",
      "title": "Unitid"
    },
    "unitName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display name of the unit. Serialized as ``unitName``.",
      "title": "Unitname"
    },
    "workflowId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the associated workflow. Serialized as ``workflowId``.",
      "title": "Workflowid"
    },
    "workflowName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display name of the workflow. Serialized as ``workflowName``.",
      "title": "Workflowname"
    },
    "specConfig": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Additional spec configuration. Serialized as ``specConfig``.",
      "title": "Specconfig"
    },
    "Value": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventorySpecValue"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The expected value or range for the property. Serialized as ``Value``. See Also --------"
    }
  },
  "required": [
    "name",
    "datacolumnId"
  ],
  "title": "InventorySpec",
  "type": "object"
}

Fields:

id

id: str | None = None

The Albert ID of the spec. Serialized as albertId.

name

name: str

The name of the spec. Required.

data_column_id

data_column_id: str

The ID of the data column this spec applies to (format DAC...). Required. Serialized as datacolumnId.

data_column_name

data_column_name: str | None = None

The display name of the data column. Serialized as datacolumnName.

data_template_id

data_template_id: str | None = None

The ID of the associated data template. Serialized as datatemplateId.

data_template_name

data_template_name: str | None = None

The display name of the data template. Serialized as datatemplateName.

unit_id

unit_id: str | None = None

The ID of the unit for the spec value. Serialized as unitId.

unit_name

unit_name: str | None = None

The display name of the unit. Serialized as unitName.

workflow_id

workflow_id: str | None = None

The ID of the associated workflow. Serialized as workflowId.

workflow_name

workflow_name: str | None = None

The display name of the workflow. Serialized as workflowName.

spec_config

spec_config: str | None = None

Additional spec configuration. Serialized as specConfig.

value

value: InventorySpecValue | None = None

The expected value or range for the property. Serialized as Value. See Also --------

InventorySpecList

Bases: BaseAlbertModel

The set of legacy InventorySpec entries on one inventory item.

Returned by get_specs and by add_specs. Binds a list of per-item reference specs to the InventoryItem they belong to (parent_id).

Deprecated with Inventory Specs (removed in SDK 2.0). Prefer AttributeValuesResponse from client.attributes.

Show JSON schema:
{
  "$defs": {
    "InventorySpec": {
      "description": "A legacy inventory reference property (definition and value in one object).\n\nAn ``InventorySpec`` both *defines* a property and *assigns* its expected value\non one [`InventoryItem`][albert.resources.inventory.InventoryItem]: the property\n``name``, the data column (``data_column_id``, format ``DAC...``), and the\n[`InventorySpecValue`][albert.resources.inventory.InventorySpecValue] live\ninline. Specs are per-item (not shared across inventory) and are attached or\nread with\n[`add_specs`][albert.collections.inventory.InventoryCollection.add_specs] and\n[`get_specs`][albert.collections.inventory.InventoryCollection.get_specs].\nMultiple specs on one item are grouped as\n[`InventorySpecList`][albert.resources.inventory.InventorySpecList].\n\nUse Specs for inventory **reference** properties (declared expectations that\nworksheets look up). Do **not** use Specs for experimentally measured results:\nthose belong in\n[`PropertyDataCollection`][albert.collections.property_data.PropertyDataCollection]\n(``client.property_data``).\n\n!!! warning \"Deprecated\"\n    Inventory Specs are deprecated and will be removed in SDK 2.0. Prefer\n    [`AttributeCollection`][albert.collections.attributes.AttributeCollection]\n    (``client.attributes``), which separates reusable attribute definitions from\n    per-item reference values. See the Specs \u2192 Attributes migration guide.\n\n!!! example\n    ```python\n    from albert.resources.inventory import InventorySpec, InventorySpecValue\n\n    spec = InventorySpec(\n        name=\"Viscosity\",\n        data_column_id=\"DAC9999999\",\n        value=InventorySpecValue(min=100, max=200),\n    )\n    ```",
      "properties": {
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the spec. Serialized as ``albertId``.",
          "title": "Albertid"
        },
        "name": {
          "description": "The name of the spec. Required.",
          "title": "Name",
          "type": "string"
        },
        "datacolumnId": {
          "description": "The ID of the data column this spec applies to (format ``DAC...``). Required. Serialized as ``datacolumnId``.",
          "title": "Datacolumnid",
          "type": "string"
        },
        "datacolumnName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display name of the data column. Serialized as ``datacolumnName``.",
          "title": "Datacolumnname"
        },
        "datatemplateId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the associated data template. Serialized as ``datatemplateId``.",
          "title": "Datatemplateid"
        },
        "datatemplateName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display name of the data template. Serialized as ``datatemplateName``.",
          "title": "Datatemplatename"
        },
        "unitId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the unit for the spec value. Serialized as ``unitId``.",
          "title": "Unitid"
        },
        "unitName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display name of the unit. Serialized as ``unitName``.",
          "title": "Unitname"
        },
        "workflowId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the associated workflow. Serialized as ``workflowId``.",
          "title": "Workflowid"
        },
        "workflowName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display name of the workflow. Serialized as ``workflowName``.",
          "title": "Workflowname"
        },
        "specConfig": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Additional spec configuration. Serialized as ``specConfig``.",
          "title": "Specconfig"
        },
        "Value": {
          "anyOf": [
            {
              "$ref": "#/$defs/InventorySpecValue"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The expected value or range for the property. Serialized as ``Value``. See Also --------"
        }
      },
      "required": [
        "name",
        "datacolumnId"
      ],
      "title": "InventorySpec",
      "type": "object"
    },
    "InventorySpecValue": {
      "description": "The expected or reference value(s) of a legacy [`InventorySpec`][albert.resources.inventory.InventorySpec].\n\nExpresses the declared value of an inventory reference property as a range\n(``min`` to ``max``), a single ``reference`` value, and/or a\n``comparison_operator``. Numeric inputs are accepted and stored as strings.\n\nDeprecated with Inventory Specs (removed in SDK 2.0). Prefer\n[`AttributeValue`][albert.resources.attributes.AttributeValue] and\n[`AttributeValueRange`][albert.resources.attributes.AttributeValueRange] via\n``client.attributes``.",
      "properties": {
        "min": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The lower bound of the acceptable range.",
          "title": "Min"
        },
        "max": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The upper bound of the acceptable range.",
          "title": "Max"
        },
        "reference": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A reference or target value for the property.",
          "title": "Reference"
        },
        "comparisonOperator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The operator used to compare a measured value against this spec (e.g. ``\">\"``, ``\"<=\"``). Serialized as ``comparisonOperator``.",
          "title": "Comparisonoperator"
        }
      },
      "title": "InventorySpecValue",
      "type": "object"
    }
  },
  "description": "The set of legacy [`InventorySpec`][albert.resources.inventory.InventorySpec] entries on one inventory item.\n\nReturned by\n[`get_specs`][albert.collections.inventory.InventoryCollection.get_specs] and by\n[`add_specs`][albert.collections.inventory.InventoryCollection.add_specs]. Binds a\nlist of per-item reference specs to the\n[`InventoryItem`][albert.resources.inventory.InventoryItem] they belong to\n(``parent_id``).\n\nDeprecated with Inventory Specs (removed in SDK 2.0). Prefer\n[`AttributeValuesResponse`][albert.resources.attributes.AttributeValuesResponse]\nfrom ``client.attributes``.",
  "properties": {
    "parentId": {
      "description": "The Inventory ID of the item the specs belong to. Serialized as ``parentId``.",
      "title": "Parentid",
      "type": "string"
    },
    "Specs": {
      "description": "The specs attached to the item. Serialized as ``Specs``. See Also --------",
      "items": {
        "$ref": "#/$defs/InventorySpec"
      },
      "title": "Specs",
      "type": "array"
    }
  },
  "required": [
    "parentId",
    "Specs"
  ],
  "title": "InventorySpecList",
  "type": "object"
}

Fields:

parent_id

parent_id: str

The Inventory ID of the item the specs belong to. Serialized as parentId.

specs

The specs attached to the item. Serialized as Specs. See Also --------

InventorySearchPictogramItem

Bases: BaseAlbertModel

A hazard pictogram entry returned on an InventorySearchItem.

Show JSON schema:
{
  "description": "A hazard pictogram entry returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
  "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"
}

Fields:

id

id: str

name

name: str

status

status: str | None = None

InventorySearchSDSItem

Bases: BaseAlbertModel

Safety Data Sheet summary fields returned on an InventorySearchItem.

Show JSON schema:
{
  "description": "Safety Data Sheet summary fields returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
  "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"
}

Fields:

un_number

un_number: str | None = None

storage_class_name

storage_class_name: str | None = None

shipping_description

shipping_description: str | None = None

storage_class_number

storage_class_number: str | None = None

un_classification

un_classification: str | None = None

InventorySearchCompositeMatch

Bases: BaseAlbertModel

Composite match details returned on an InventorySearchItem.

Show JSON schema:
{
  "description": "Composite match details returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
  "properties": {
    "compositeDacId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The composite DAC ID used for the match.",
      "title": "Compositedacid"
    },
    "algorithm": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The matching algorithm used.",
      "title": "Algorithm"
    },
    "subValues": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Sub-values contributing to the composite match score.",
      "title": "Subvalues"
    },
    "calculatedScore": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The calculated composite match score.",
      "title": "Calculatedscore"
    },
    "similarityScore": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The similarity score for the match.",
      "title": "Similarityscore"
    }
  },
  "title": "InventorySearchCompositeMatch",
  "type": "object"
}

Fields:

composite_dac_id

composite_dac_id: str | None = None

The composite DAC ID used for the match.

algorithm

algorithm: str | None = None

The matching algorithm used.

sub_values

sub_values: list[dict[str, Any]] | None = None

Sub-values contributing to the composite match score.

calculated_score

calculated_score: float | None = None

The calculated composite match score.

similarity_score

similarity_score: float | None = None

The similarity score for the match.

InventorySearchItem

Bases: BaseAlbertModel, HydrationMixin[InventoryItem]

A lightweight InventoryItem result returned by the search endpoint.

Search returns these partial records for speed; they carry the fields most useful for lookups, counts, and display rather than the full item. Produced by search. Because it mixes in [HydrationMixin][albert.resources._mixins.HydrationMixin], calling hydrate() on a bound instance fetches the corresponding fully populated 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": {
      "description": "The kind of material an [`InventoryItem`][albert.resources.inventory.InventoryItem] represents.\n\nEvery inventory item belongs to exactly one category, which determines how it\nis used across the platform and which fields are relevant to it.\n\nAttributes\n----------\nRAW_MATERIALS : str\n    A purchased substance used as an ingredient (e.g. a solvent or pigment).\n    Typically linked to a manufacturing ``company`` and one or more CAS numbers.\nCONSUMABLES : str\n    Lab supplies consumed during work (e.g. gloves, vials, filters).\nEQUIPMENT : str\n    Instruments and apparatus (e.g. a balance or spectrometer).\nFORMULAS : str\n    A mixture designed in Albert through a Worksheet. Formulas are not created\n    through the inventory collection; they are produced by the Worksheet\n    collection ([`WorksheetCollection`][albert.collections.worksheets.WorksheetCollection]).",
      "enum": [
        "RawMaterials",
        "Consumables",
        "Equipment",
        "Formulas"
      ],
      "title": "InventoryCategory",
      "type": "string"
    },
    "InventorySearchCompositeMatch": {
      "description": "Composite match details returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
      "properties": {
        "compositeDacId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The composite DAC ID used for the match.",
          "title": "Compositedacid"
        },
        "algorithm": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The matching algorithm used.",
          "title": "Algorithm"
        },
        "subValues": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sub-values contributing to the composite match score.",
          "title": "Subvalues"
        },
        "calculatedScore": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The calculated composite match score.",
          "title": "Calculatedscore"
        },
        "similarityScore": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The similarity score for the match.",
          "title": "Similarityscore"
        }
      },
      "title": "InventorySearchCompositeMatch",
      "type": "object"
    },
    "InventorySearchPictogramItem": {
      "description": "A hazard pictogram entry returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
      "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": {
      "description": "Safety Data Sheet summary fields returned on an [`InventorySearchItem`][albert.resources.inventory.InventorySearchItem].",
      "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": {
      "description": "The dimension of the unit an [`InventoryItem`][albert.resources.inventory.InventoryItem] is measured and stocked in.\n\nDetermines how quantities on hand and in formulas are interpreted. When not\nsupplied, the category defaults based on [`InventoryCategory`][albert.resources.inventory.InventoryCategory]: ``MASS``\nfor raw materials and formulas, ``UNITS`` for equipment and consumables.\n\nAttributes\n----------\nMASS : str\n    Measured by mass (e.g. grams, kilograms).\nVOLUME : str\n    Measured by volume (e.g. milliliters, liters).\nLENGTH : str\n    Measured by length (e.g. meters).\nPRESSURE : str\n    Measured by pressure.\nUNITS : str\n    Counted as discrete units (e.g. each item).",
      "enum": [
        "mass",
        "volume",
        "length",
        "pressure",
        "units"
      ],
      "title": "InventoryUnitCategory",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "Tag": {
      "description": "A freeform text label used to categorize and connect entities.\n\nTags are shared by name across the platform and can be applied to inventory\nitems, companies, tasks, and other records to group and filter them. Managed\nthrough [`TagCollection`][albert.collections.tags.TagCollection] (``client.tags``);\nthe usual entry point is [`get_or_create`][albert.collections.tags.TagCollection.get_or_create].\n\n!!! example\n    ```python\n    from albert.resources.tags import Tag\n    tag = Tag(tag=\"high-priority\")\n    ```\nMethods\n-------\nfrom_string(tag) -> Tag\n    Build a Tag from its name string.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The name of the tag (its text label).",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the tag (format ``TAG...``). Set when the tag is retrieved from or created in Albert. Methods ------- from_string(tag) -> Tag Build a Tag from its name string.",
          "title": "Albertid"
        }
      },
      "required": [
        "name"
      ],
      "title": "Tag",
      "type": "object"
    }
  },
  "description": "A lightweight [`InventoryItem`][albert.resources.inventory.InventoryItem] result returned by the search endpoint.\n\nSearch returns these partial records for speed; they carry the fields most useful\nfor lookups, counts, and display rather than the full item. Produced by\n[`search`][albert.collections.inventory.InventoryCollection.search]. Because it mixes\nin [`HydrationMixin`][albert.resources._mixins.HydrationMixin], calling ``hydrate()`` on a\nbound instance fetches the corresponding fully populated [`InventoryItem`][albert.resources.inventory.InventoryItem].",
  "properties": {
    "albertId": {
      "description": "The Albert Inventory ID (format ``INV...``). Serialized as ``albertId``.",
      "title": "Albertid",
      "type": "string"
    },
    "name": {
      "default": "",
      "description": "The name of the item.",
      "title": "Name",
      "type": "string"
    },
    "alias": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The alias of the item.",
      "title": "Alias"
    },
    "manufacturer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The manufacturer name of the item.",
      "title": "Manufacturer"
    },
    "description": {
      "default": "",
      "description": "The description of the item.",
      "title": "Description",
      "type": "string"
    },
    "category": {
      "$ref": "#/$defs/InventoryCategory",
      "description": "The kind of material this item represents."
    },
    "unit": {
      "$ref": "#/$defs/InventoryUnitCategory",
      "description": "The dimension the item is measured in."
    },
    "lots": {
      "description": "Lot records associated with the item.",
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "title": "Lots",
      "type": "array"
    },
    "tags": {
      "description": "Tags on the item.",
      "items": {
        "$ref": "#/$defs/Tag"
      },
      "title": "Tags",
      "type": "array"
    },
    "pictogram": {
      "description": "Hazard pictograms associated with the item.",
      "items": {
        "$ref": "#/$defs/InventorySearchPictogramItem"
      },
      "title": "Pictogram",
      "type": "array"
    },
    "inventoryOnHand": {
      "default": 0.0,
      "description": "Total amount currently on hand. Defaults to 0 when absent (none on hand). Serialized as ``inventoryOnHand``.",
      "title": "Inventoryonhand",
      "type": "number"
    },
    "SDS": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventorySearchSDSItem"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Safety Data Sheet summary fields. Serialized as ``SDS``. See Also --------"
    },
    "distance": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Search relevance distance when returned by semantic search.",
      "title": "Distance"
    },
    "compositeMatch": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventorySearchCompositeMatch"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Composite match details when returned by composite search."
    }
  },
  "required": [
    "albertId",
    "category",
    "unit"
  ],
  "title": "InventorySearchItem",
  "type": "object"
}

Fields:

id

id: str

The Albert Inventory ID (format INV...). Serialized as albertId.

name

name: str = ''

The name of the item.

alias

alias: str | None = None

The alias of the item.

manufacturer

manufacturer: str | None = None

The manufacturer name of the item.

description

description: str = ''

The description of the item.

category

The kind of material this item represents.

unit

The dimension the item is measured in.

lots

lots: list[dict[str, Any]]

Lot records associated with the item.

tags

tags: list[Tag]

Tags on the item.

pictogram

Hazard pictograms associated with the item.

inventory_on_hand

inventory_on_hand: float = 0.0

Total amount currently on hand. Defaults to 0 when absent (none on hand). Serialized as inventoryOnHand.

sds

sds: InventorySearchSDSItem | None = None

Safety Data Sheet summary fields. Serialized as SDS. See Also --------

distance

distance: float | None = None

Search relevance distance when returned by semantic search.

composite_match

composite_match: InventorySearchCompositeMatch | None = None

Composite match details when returned by composite search.

MergeInventory

Bases: BaseAlbertModel

The request payload for merging duplicate inventory items into one.

Describes a merge: one surviving parent item plus the child item(s) to fold into it, and optionally which data modules to carry over. This is the body used by merge; when modules is omitted, all InventoryMergeModule values are included.

Example

from albert.resources.inventory import MergeInventory

merge = MergeInventory(
    parent_id="INVA9999999",
    child_inventories=[{"id": "INVB1"}, {"id": "INVC1"}],
)
Show JSON schema:
{
  "$defs": {
    "InventoryMergeModule": {
      "description": "A data category that can be carried over when merging inventory items.\n\nWhen duplicate inventory items are merged (see [`MergeInventory`][albert.resources.inventory.MergeInventory] and\n[`merge`][albert.collections.inventory.InventoryCollection.merge]), each selected\nmodule names a body of data to fold from the child item(s) into the surviving\nparent item. When no modules are specified, all modules are included.\n\nAttributes\n----------\nPRICING : str\n    Pricing data.\nNOTES : str\n    Notes.\nSDS : str\n    Safety Data Sheets.\nPD : str\n    Product Design: worksheet column references for this inventory item.\nBD : str\n    Batch data.\nLOT : str\n    Lot data.\nCAS : str\n    CAS numbers.\nTAS : str\n    Tasks.\nWFL : str\n    Workflows.\nPRG : str\n    Parameter groups.\nPTD : str\n    Property data.",
      "enum": [
        "PRICING",
        "NOTES",
        "SDS",
        "PD",
        "BD",
        "LOT",
        "CAS",
        "TAS",
        "WFL",
        "PRG",
        "PTD"
      ],
      "title": "InventoryMergeModule",
      "type": "string"
    }
  },
  "description": "The request payload for merging duplicate inventory items into one.\n\nDescribes a merge: one surviving parent item plus the child item(s) to fold into\nit, and optionally which data modules to carry over. This is the body used by\n[`merge`][albert.collections.inventory.InventoryCollection.merge]; when ``modules``\nis omitted, all [`InventoryMergeModule`][albert.resources.inventory.InventoryMergeModule] values are included.\n\n!!! example\n    ```python\n    from albert.resources.inventory import MergeInventory\n\n    merge = MergeInventory(\n        parent_id=\"INVA9999999\",\n        child_inventories=[{\"id\": \"INVB1\"}, {\"id\": \"INVC1\"}],\n    )\n    ```",
  "properties": {
    "parentId": {
      "description": "The Inventory ID of the item that will survive the merge. Serialized as ``parentId``.",
      "title": "Parentid",
      "type": "string"
    },
    "ChildInventories": {
      "description": "The child item(s) to merge into the parent, each given as a mapping such as ``{\"id\": \"INVB1\"}``. Serialized as ``ChildInventories``.",
      "items": {
        "additionalProperties": {
          "type": "string"
        },
        "type": "object"
      },
      "title": "Childinventories",
      "type": "array"
    },
    "modules": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/InventoryMergeModule"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The data modules to carry over from the children. When ``None``, all modules are merged. See Also --------",
      "title": "Modules"
    }
  },
  "required": [
    "parentId",
    "ChildInventories"
  ],
  "title": "MergeInventory",
  "type": "object"
}

Fields:

parent_id

parent_id: InventoryId

The Inventory ID of the item that will survive the merge. Serialized as parentId.

child_inventories

child_inventories: list[dict[str, InventoryId]]

The child item(s) to merge into the parent, each given as a mapping such as {"id": "INVB1"}. Serialized as ChildInventories.

modules

modules: list[InventoryMergeModule] | None = None

The data modules to carry over from the children. When None, all modules are merged. See Also --------