Skip to content

Locations

albert.resources.locations

Location

Bases: BaseResource

A physical lab or site location in Albert.

Locations are referenced by Tasks and Inventory Items to record where an activity is performed or where a material lives, and each Location can hold one or more Storage Locations (StorageLocation). Managed through LocationCollection.

Example

from albert.resources.locations import Location
location = Location(
    name="Boston Lab",
    latitude=42.3601,
    longitude=-71.0589,
    address="1 Main St",
    country="US",
)
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"
    }
  },
  "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"
}

Fields:

name

name: str

The human-readable name of the location.

id

id: str | None = None

The Albert ID of the location. Assigned by Albert and populated once the location has been created or retrieved.

latitude

latitude: float

The latitude of the location, in decimal degrees.

longitude

longitude: float

The longitude of the location, in decimal degrees.

address

address: str

The street address of the location.

country

country: str | None = None

The two-letter country code of the location (for example, "US").