SDS (🧪 Beta)
albert.collections.sds.SDSCollection
Bases: BaseCollection
Manage SDS generation for formula inventory items in the Albert platform (🧪 Beta).
Generate a GHS Safety Data Sheet (JSON plus PDF) for a formula inventory
item. Lookups (jurisdictions, languages, physical states, products, legal
entities, field options) are tenant-specific; language and legal entity are
also region-scoped. Always send lookup values on
SDSRequest, not display names.
generate_sds loads the
inventory name and unpacks the formula for ingredients, CAS-level composition,
and inventory SDS rows. Callers do not supply those lists. This collection does
not generate SDS for raw materials.
This collection is accessed as client.sds.
Beta Feature!
Please do not use in production or without explicit guidance from Albert. This feature currently falls outside of the Albert support contract, but we'd love your feedback!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for document-generator SDS requests. |
Methods:
| Name | Description |
|---|---|
generate_sds |
Generate an SDS for a formula inventory item. |
get_field_options |
Get tenant-specific options for one SDS input field. |
get_physical_states |
Get physical-state display names mapped to codes. |
get_products |
Get product-type display names mapped to codes. |
get_languages |
Get language display names mapped to codes for a jurisdiction. |
get_jurisdictions |
Get jurisdiction display names mapped to codes. |
get_jurisdiction_groups |
Get jurisdictions grouped by category. |
get_legal_entities |
Get legal entities for a jurisdiction. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/sds.py
generate_sds
generate_sds(*, sds: SDSRequest) -> GeneratedSDS
Generate an SDS for a formula inventory item.
Unpacks the formula and fills the product name, ingredients, CAS-level composition, and inventory SDS rows. Callers supply the formula Albert ID and lookup codes only.
Formula inventory only. Region, language, product type, physical state, and legal entity must already be lookup values. The product name is taken from the inventory item. The returned PDF URL is a short-lived download link.
Example
from albert import Albert
from albert.resources.sds import SDSRequest
client = Albert()
region = next(iter(client.sds.get_jurisdictions().values()))
language = next(iter(client.sds.get_languages(region=region).values()))
physical_state = next(iter(client.sds.get_physical_states().values()))
product_type = next(
iter(client.sds.get_products(region=region, physical_state=physical_state).values())
)
legal_entity = client.sds.get_legal_entities(region=region)[0].value
result = client.sds.generate_sds(
sds=SDSRequest(
albert_id="INVMO137681-012",
region=region,
language=language,
product_type=product_type,
physical_state=physical_state,
legal_entity=legal_entity,
)
)
result.sds_json["section1"]
result.pdf_url
# 'https://...'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sds
|
SDSRequest
|
The SDS generate request. Product name and formula composition are taken from the inventory item and unpack. |
required |
Returns:
| Type | Description |
|---|---|
GeneratedSDS
|
The generated SDS JSON, PDF URL, and metadata URL. |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If the inventory item is not a formula, or unpack returns no products. |
Source code in src/albert/collections/sds.py
get_field_options
get_field_options(
*,
entity: SDSDataEntity | str,
region: str | None = None,
physical_state: str | None = None,
flammability: str | None = None,
template: str | None = None,
) -> SDSFieldOptions
Get tenant-specific options for one SDS input field.
Entity query names do not always match SDSRequest
field names (e.g. flashpoint → flash_point). If display is
false, omit the field. If data is a list of objects with value,
send that value.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
SDSDataEntity or str
|
The field-options entity name. |
required |
region
|
str
|
Jurisdiction code. Required for some entities (e.g. flash point). |
None
|
physical_state
|
str
|
Physical-state code used to filter options. |
None
|
flammability
|
str
|
Flammability code used to filter burning-test options. |
None
|
template
|
str
|
Template ID used to filter some tenant-gated fields. |
None
|
Returns:
| Type | Description |
|---|---|
SDSFieldOptions
|
Display flag, required flag, and allowed values. |
Source code in src/albert/collections/sds.py
get_physical_states
Get physical-state display names mapped to codes.
Tenant-specific. Send the values (e.g. "liquid") as
SDSRequest.physical_state.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Mapping of display name to code (e.g. |
Source code in src/albert/collections/sds.py
get_products
Get product-type display names mapped to codes.
Tenant-specific and optionally filtered by jurisdiction and physical
state. Send the values (e.g. "acrylate") as
SDSRequest.product_type.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
str
|
Jurisdiction code used to filter product types. |
None
|
physical_state
|
str
|
Physical-state code used to filter product types. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Mapping of display name to code. |
Source code in src/albert/collections/sds.py
get_languages
Get language display names mapped to codes for a jurisdiction.
Tenant-specific and region-scoped. Pass region="all" for the full
set. Send the values (e.g. "EN") as
SDSRequest.language.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
str
|
Jurisdiction code, or |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Mapping of display name to code (e.g. |
Source code in src/albert/collections/sds.py
get_jurisdictions
Get jurisdiction display names mapped to codes.
Tenant-specific. Omit region for the tenant list. Pass
region="all" for the full set. Send the values (e.g. "US")
as SDSRequest.region. For
grouped jurisdictions see
get_jurisdiction_groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
str
|
|
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Mapping of display name to code. |
Source code in src/albert/collections/sds.py
get_jurisdiction_groups
Get jurisdictions grouped by category.
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
Mapping of category name to jurisdiction codes. |
Source code in src/albert/collections/sds.py
get_legal_entities
get_legal_entities(*, region: str) -> list[SDSLegalEntity]
Get legal entities for a jurisdiction.
Tenant-specific and region-scoped. Send each row's value as
SDSRequest.legal_entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
region
|
str
|
Jurisdiction code. |
required |
Returns:
| Type | Description |
|---|---|
list[SDSLegalEntity]
|
Legal entities available for the jurisdiction. |