Skip to content

Cas

albert.resources.cas

CasCategory

Bases: str, Enum

Attributes:

Name Type Description
USER
VERISK
TSCA_PUBLIC
TSCA_PRIVATE
NOT_TSCA
EXTERNAL
UNKNOWN
CL_INVENTORY_UPLOAD

USER

USER = 'User'

VERISK

VERISK = 'Verisk'

TSCA_PUBLIC

TSCA_PUBLIC = 'TSCA - Public'

TSCA_PRIVATE

TSCA_PRIVATE = 'TSCA - Private'

NOT_TSCA

NOT_TSCA = 'not TSCA'

EXTERNAL

EXTERNAL = 'CAS linked to External Database'

UNKNOWN

UNKNOWN = 'Unknown (Trade Secret)'

CL_INVENTORY_UPLOAD

CL_INVENTORY_UPLOAD = 'CL_Inventory Upload'

Hazard

Bases: BaseAlbertModel

A single GHS hazard classification associated with a CAS substance.

Hazards are read from the CAS record; a Cas may carry a list of them.

Show JSON schema:
{
  "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"
}

Fields:

sub_category

sub_category: str | None = None

Hazard subcategory

h_code

h_code: str | None = None

Hazard code

category

category: str | float | None = None

Hazard category

hazard_class

hazard_class: str | None = None

Hazard classification

h_code_text

h_code_text: str | None = None

Hazard code text

Cas

Bases: BaseResource

A CAS entry: a chemical substance identified by its CAS Registry Number.

A Cas is Albert's dictionary record for a substance. Raw-material Inventory Items reference these entries to declare what they are made of, pairing each Cas with an amount (see CasAmount). Manage entries through CasCollection (client.cas): most fields are populated by Albert, so you typically only build a Cas from a registry number when creating a new entry.

Example

from albert.resources.cas import Cas
# Build a CAS entry to register a new substance
cas = Cas(number="7727-37-9")
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"
    },
    "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"
    },
    "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 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"
}

Fields:

number

number: str

The CAS number.

name

name: str | None = None

Name of the CAS.

description

description: str | None = None

The description or name of the CAS.

notes

notes: str | None = None

Notes related to the CAS.

category

category: CasCategory | None = None

The category of the CAS.

smiles

smiles: str | None = None

CAS SMILES notation.

inchi_key

inchi_key: str | None = None

InChIKey of the CAS.

iupac_name

iupac_name: str | None = None

IUPAC name of the CAS.

id

id: str | None = None

The AlbertID of the CAS.

hazards

hazards: list[Hazard] | None = None

Hazards associated with the CAS.

wgk

wgk: str | None = None

German Water Hazard Class (WGK) number.

ec_number

ec_number: str | None = None

European Community (EC) number.

type

type: str | None = None

Internal classification_type reference.

classification_type

classification_type: str | None = None

Classification type of the CAS.

order

order: str | None = None

CAS order.

metadata

metadata: dict[str, MetadataItem]

Custom metadata keyed by field. Updatable.

from_string

from_string(*, number: str) -> Cas

Build a Cas from a bare registry number.

Convenience constructor equivalent to Cas(number=number), for when you only have the registry number and want a Cas object to pass to CasCollection.

Example

from albert.resources.cas import Cas
cas = Cas.from_string(number="7727-37-9")

Parameters:

Name Type Description Default
number str

The CAS Registry Number (e.g. "7727-37-9").

required

Returns:

Type Description
Cas

A Cas with only number set.

Source code in src/albert/resources/cas.py
@classmethod
def from_string(cls, *, number: str) -> Cas:
    """Build a [`Cas`][albert.resources.cas.Cas] from a bare registry number.

    Convenience constructor equivalent to ``Cas(number=number)``, for when you
    only have the registry number and want a ``Cas`` object to pass to
    [`CasCollection`][albert.collections.cas.CasCollection].

    !!! example
        ```python
        from albert.resources.cas import Cas
        cas = Cas.from_string(number="7727-37-9")
        ```

    Parameters
    ----------
    number : str
        The CAS Registry Number (e.g. ``"7727-37-9"``).

    Returns
    -------
    Cas
        A ``Cas`` with only ``number`` set.
    """
    return cls(number=number)