Skip to content

Units

albert.resources.units

UnitCategory

Bases: str, Enum

The physical quantity a unit measures.

Attributes:

Name Type Description
LENGTH str

Length units (e.g. m, cm).

VOLUME str

Volume units (e.g. m³).

LIQUID_VOLUME str

Liquid volume units (e.g. L, mL).

ANGLES str

Angle units (e.g. degrees, radians).

TIME str

Time units (e.g. s, h).

FREQUENCY str

Frequency units (e.g. Hz).

MASS str

Mass units (e.g. g, kg).

CURRENT str

Electric current units (e.g. A).

TEMPERATURE str

Temperature units (e.g. °C, K).

AMOUNT str

Amount of substance units (e.g. mol).

LUMINOSITY str

Luminous intensity units (e.g. cd).

FORCE str

Force units (e.g. N).

ENERGY str

Energy units (e.g. J).

POWER str

Power units (e.g. W).

PRESSURE str

Pressure units (e.g. Pa, bar).

ELECTRICITY_AND_MAGNETISM str

Electricity and magnetism units.

OTHER str

Units that do not fit another category.

WEIGHT str

Weight units.

AREA str

Area units (e.g. m²).

SURFACE_AREA str

Surface area units.

BINARY str

Binary/digital-information units (e.g. bytes).

CAPACITANCE str

Capacitance units (e.g. F).

SPEED str

Speed units (e.g. m/s).

ELECTRICAL_CONDUCTIVITY str

Electrical conductivity units.

ELECTRICAL_PERMITTIVITY str

Electrical permittivity units.

DENSITY str

Density units (e.g. g/mL).

RESISTANCE str

Electrical resistance units (e.g. Ω).

LENGTH

LENGTH = 'Length'

VOLUME

VOLUME = 'Volume'

LIQUID_VOLUME

LIQUID_VOLUME = 'Liquid volume'

ANGLES

ANGLES = 'Angles'

TIME

TIME = 'Time'

FREQUENCY

FREQUENCY = 'Frequency'

MASS

MASS = 'Mass'

CURRENT

CURRENT = 'Electric current'

TEMPERATURE

TEMPERATURE = 'Temperature'

AMOUNT

AMOUNT = 'Amount of substance'

LUMINOSITY

LUMINOSITY = 'Luminous intensity'

FORCE

FORCE = 'Force'

ENERGY

ENERGY = 'Energy'

POWER

POWER = 'Power'

PRESSURE

PRESSURE = 'Pressure'

ELECTRICITY_AND_MAGNETISM

ELECTRICITY_AND_MAGNETISM = 'Electricity and magnetism'

OTHER

OTHER = 'Other'

WEIGHT

WEIGHT = 'Weight'

AREA

AREA = 'Area'

SURFACE_AREA

SURFACE_AREA = 'Surface Area'

BINARY

BINARY = 'Binary'

CAPACITANCE

CAPACITANCE = 'Capacitance'

SPEED

SPEED = 'Speed'

ELECTRICAL_CONDUCTIVITY

ELECTRICAL_CONDUCTIVITY = 'Electrical conductivity'

ELECTRICAL_PERMITTIVITY

ELECTRICAL_PERMITTIVITY = 'Electrical permitivitty'

DENSITY

DENSITY = 'Density'

RESISTANCE

RESISTANCE = 'Resistance'

Unit

Bases: BaseResource

A unit of measure (e.g. g, mL, °C).

Units qualify quantities throughout the platform: inventory amounts, parameter values, and property results. Managed through UnitCollection (client.units).

Example

from albert.resources.units import Unit, UnitCategory
unit = Unit(name="milliliter", symbol="mL", category=UnitCategory.LIQUID_VOLUME)
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"
    },
    "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"
    },
    "UnitCategory": {
      "description": "The physical quantity a unit measures.\n\nAttributes\n----------\nLENGTH : str\n    Length units (e.g. m, cm).\nVOLUME : str\n    Volume units (e.g. m\u00b3).\nLIQUID_VOLUME : str\n    Liquid volume units (e.g. L, mL).\nANGLES : str\n    Angle units (e.g. degrees, radians).\nTIME : str\n    Time units (e.g. s, h).\nFREQUENCY : str\n    Frequency units (e.g. Hz).\nMASS : str\n    Mass units (e.g. g, kg).\nCURRENT : str\n    Electric current units (e.g. A).\nTEMPERATURE : str\n    Temperature units (e.g. \u00b0C, K).\nAMOUNT : str\n    Amount of substance units (e.g. mol).\nLUMINOSITY : str\n    Luminous intensity units (e.g. cd).\nFORCE : str\n    Force units (e.g. N).\nENERGY : str\n    Energy units (e.g. J).\nPOWER : str\n    Power units (e.g. W).\nPRESSURE : str\n    Pressure units (e.g. Pa, bar).\nELECTRICITY_AND_MAGNETISM : str\n    Electricity and magnetism units.\nOTHER : str\n    Units that do not fit another category.\nWEIGHT : str\n    Weight units.\nAREA : str\n    Area units (e.g. m\u00b2).\nSURFACE_AREA : str\n    Surface area units.\nBINARY : str\n    Binary/digital-information units (e.g. bytes).\nCAPACITANCE : str\n    Capacitance units (e.g. F).\nSPEED : str\n    Speed units (e.g. m/s).\nELECTRICAL_CONDUCTIVITY : str\n    Electrical conductivity units.\nELECTRICAL_PERMITTIVITY : str\n    Electrical permittivity units.\nDENSITY : str\n    Density units (e.g. g/mL).\nRESISTANCE : str\n    Electrical resistance units (e.g. \u03a9).",
      "enum": [
        "Length",
        "Volume",
        "Liquid volume",
        "Angles",
        "Time",
        "Frequency",
        "Mass",
        "Electric current",
        "Temperature",
        "Amount of substance",
        "Luminous intensity",
        "Force",
        "Energy",
        "Power",
        "Pressure",
        "Electricity and magnetism",
        "Other",
        "Weight",
        "Area",
        "Surface Area",
        "Binary",
        "Capacitance",
        "Speed",
        "Electrical conductivity",
        "Electrical permitivitty",
        "Density",
        "Resistance"
      ],
      "title": "UnitCategory",
      "type": "string"
    }
  },
  "description": "A unit of measure (e.g. ``g``, ``mL``, ``\u00b0C``).\n\nUnits qualify quantities throughout the platform: inventory amounts,\nparameter values, and property results. Managed through\n[`UnitCollection`][albert.collections.units.UnitCollection] (``client.units``).\n\n!!! example\n    ```python\n    from albert.resources.units import Unit, UnitCategory\n    unit = Unit(name=\"milliliter\", symbol=\"mL\", category=UnitCategory.LIQUID_VOLUME)\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."
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the unit (format ``UNI...``). Set when the unit is retrieved from or created in Albert.",
      "title": "Albertid"
    },
    "name": {
      "description": "Currently this is the only field that is displayed in Albert, so use this for display purposes. Therefore, users often use the symbol for the unit here as that's the preferred display.",
      "title": "Name",
      "type": "string"
    },
    "symbol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display symbol for the unit (e.g. ``\"g\"``).",
      "title": "Symbol"
    },
    "Synonyms": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "description": "Alternate names or spellings that also refer to this unit.",
      "title": "Synonyms"
    },
    "category": {
      "anyOf": [
        {
          "$ref": "#/$defs/UnitCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The physical quantity the unit measures (e.g. ``Mass``, ``Volume``)."
    },
    "verified": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": false,
      "description": "Whether the unit has been verified in Albert. Read-only.",
      "title": "Verified"
    }
  },
  "required": [
    "name"
  ],
  "title": "Unit",
  "type": "object"
}

Fields:

id

id: str | None = None

The Albert ID of the unit (format UNI...). Set when the unit is retrieved from or created in Albert.

name

name: str

Currently this is the only field that is displayed in Albert, so use this for display purposes. Therefore, users often use the symbol for the unit here as that's the preferred display.

symbol

symbol: str | None = None

The display symbol for the unit (e.g. "g").

synonyms

synonyms: list[str] | None

Alternate names or spellings that also refer to this unit.

category

category: UnitCategory | None = None

The physical quantity the unit measures (e.g. Mass, Volume).

verified

verified: bool | None = False

Whether the unit has been verified in Albert. Read-only.