Skip to content

Entity Types (🧪Beta)

albert.resources.entity_types

EntityCategory

Bases: str, Enum

Categories that an entity type should be based on.

Attributes:

Name Type Description
PROPERTY str

Property category.

BATCH str

Batch category.

GENERAL str

General category.

RAW_MATERIALS str

Raw materials category.

CONSUMABLES str

Consumables category.

EQUIPMENT str

Equipment category.

FORMULAS str

Formulas category.

PROPERTY

PROPERTY = 'Property'

BATCH

BATCH = 'Batch'

GENERAL

GENERAL = 'General'

RAW_MATERIALS

RAW_MATERIALS = 'RawMaterials'

CONSUMABLES

CONSUMABLES = 'Consumables'

EQUIPMENT

EQUIPMENT = 'Equipment'

FORMULAS

FORMULAS = 'Formulas'

EntityServiceType

Bases: str, Enum

Types of services that an entity type can be associated with.

Attributes:

Name Type Description
TASKS str

Tasks service type.

PARAMETER_GROUPS str

Parameter Groups service type.

DATA_TEMPLATES str

Data Templates service type.

PROJECTS str

Projects service type.

LOTS str

Lots service type.

INVENTORIES str

Inventories service type.

TASKS

TASKS = 'tasks'

PARAMETER_GROUPS

PARAMETER_GROUPS = 'parametergroups'

DATA_TEMPLATES

DATA_TEMPLATES = 'datatemplates'

PROJECTS

PROJECTS = 'projects'

LOTS

LOTS = 'lots'

INVENTORIES

INVENTORIES = 'inventories'

EntityTypeType

Bases: str, Enum

Types of entity types. Used to determine if an entity type is custom or system.

Attributes:

Name Type Description
CUSTOM str

Custom entity type.

SYSTEM str

System entity type.

CUSTOM

CUSTOM = 'custom'

SYSTEM

SYSTEM = 'system'

FieldSection

Bases: str, Enum

Sections where a field can be displayed in the UI. Only Fields in the top section can be used in EntityTypeSearchQueryStrings.

Attributes:

Name Type Description
TOP str

Top section of the form.

BOTTOM str

Bottom section of the form.

TOP

TOP = 'top'

BOTTOM

BOTTOM = 'bottom'

EntityCustomField

Bases: BaseAlbertModel

Custom fields associated with an entity type.

Attributes:

Name Type Description
id CustomFieldId

The ID of the custom field.

name str | None

Read-only name of the custom field.

section FieldSection

The section where the field should be displayed (i.e., top or bottom).

hidden bool

Whether the field should be hidden.

default (str | float | EntityLink | None, optional)

The default value for the field.

id

name

name: str | None = None

section

section: FieldSection

hidden

hidden: bool

default

default: str | float | EntityLink | None = None

required

required: bool | None = None

EntityTypeStandardFieldVisibility

Bases: BaseAlbertModel

Visibility settings for standard fields in an entity type.

Attributes:

Name Type Description
notes bool

Whether the notes field should be visible.

tags bool

Whether the tags field should be visible.

due_date bool

Whether the due date field should be visible.

notes

notes: bool = Field(alias='Notes')

tags

tags: bool = Field(alias='Tags')

due_date

due_date: bool = Field(alias='DueDate')

EntityTypeStandardFieldRequired

Bases: BaseAlbertModel

Required state for standard fields in an entity type.

Attributes:

Name Type Description
notes bool
tags bool
due_date bool

notes

notes: bool = Field(alias='Notes')

tags

tags: bool = Field(alias='Tags')

due_date

due_date: bool = Field(alias='DueDate')

EntityTypeSearchQueryStrings

Bases: BaseAlbertModel

Search query strings for different entity type views. These strings define how to construct search queries for different selectable entities within the entity type. They can include placeholders for custom fields that will be replaced with actual values.

Attributes:

Name Type Description
DAT (str | None, optional)

Search query string for the data view.

PRG (str | None, optional)

Search query string for the program view.

Examples:

# In this example, the name of the custom fields are the same on the Task and the Data Templates + Parameter Groups.
search_strings = EntityTypeSearchQueryStrings(
    DAT="customField1={customField1}&customField2={customField2}",
    PRG="customField1={customField1}&customField2={customField2}"
)

DAT

DAT: str | None = None

PRG

PRG: str | None = None

EntityType

Bases: BaseResource

An entity type in the Albert system. Entity types define the structure and behavior of entities in the system. They can be custom or system types, and can have associated custom fields and rules.

Attributes:

Name Type Description
id EntityTypeId

The unique identifier for the entity type.

category EntityCategory

The category the entity type belongs to.

custom_category (str | None, optional)

A custom category name for the entity type.

label str

The display label for the entity type.

service EntityServiceType

The service type associated with this entity type.

type EntityTypeType

The type of entity type (custom or system).

prefix (str | None, optional)

The prefix used for IDs of this entity type.

standard_field_visibility EntityTypeStandardFieldVisibility

Visibility settings for standard fields.

template_based (bool | None, optional)

Whether this entity type is template-based. If True, users can only instantiate this entity type from a template.

locked_template (bool | None, optional)

Whether the template is locked. If True, users cannot edit the template.

id

id: EntityTypeId | None = Field(
    alias="albertId", default=None
)

category

category: EntityCategory

custom_category

custom_category: str | None = Field(
    default=None,
    max_length=100,
    min_length=1,
    alias="customCategory",
)

label

label: str

service

type

type: EntityTypeType = Field(default=CUSTOM)

prefix

prefix: str | None = Field(default=None, max_length=3)

custom_fields

custom_fields: list[EntityCustomField] | None = Field(
    default=None, alias="customFields"
)

standard_field_visibility

standard_field_visibility: (
    EntityTypeStandardFieldVisibility | None
) = Field(alias="standardFieldVisibility", default=None)

standard_field_required

standard_field_required: (
    EntityTypeStandardFieldRequired | None
) = Field(alias="standardFieldRequired", default=None)

template_based

template_based: bool | None = Field(
    alias="templateBased", default=None
)

locked_template

locked_template: bool | None = Field(
    alias="lockedTemplate", default=None
)

search_query_string

search_query_string: EntityTypeSearchQueryStrings | None = (
    Field(alias="searchQueryString", default=None)
)

EntityTypeOptionType

Bases: str, Enum

Types of options that can be used in entity type fields.

Attributes:

Name Type Description
STRING str

String option type.

LIST str

List option type.

LIST_CUSTOM str

Custom list option type returned by rules endpoints.

STRING

STRING = 'string'

LIST

LIST = 'list'

LIST_CUSTOM

LIST_CUSTOM = 'list-custom'

EntityLinkOption

Bases: EntityLink

Allowed options for Field Options expect a different (de)serilization than the base EntityLink. This class handles that scenario.

Attributes:

Name Type Description
id str
name str | None

id

id: str = Field(alias='albertId')

name

name: str | None = Field(default=None, exclude=False)

EntityTypeFieldOptions

EntityTypeFieldOptions(**data: Any)

Bases: BaseAlbertModel

Options for a field in an entity type.

Attributes:

Name Type Description
option_type EntityTypeOptionType

The type of option (string or list).

values (list[str | EntityLink] | None, optional)

The possible values for this option.

Source code in src/albert/resources/entity_types.py
def __init__(self, **data: Any):
    if "values" in data and isinstance(data["values"], list):
        data["values"] = [
            EntityLinkOption(id=v.id, name=v.name) if isinstance(v, EntityLink) else v
            for v in data["values"]
        ]
    super().__init__(**data)

option_type

option_type: EntityTypeOptionType = Field(alias='type')

values

values: list[str | EntityLinkOption | EntityLink] | None = (
    None
)

EntityTypeRuleAction

EntityTypeRuleAction(**data: Any)

Bases: BaseAlbertModel

An action that can be taken when a rule is triggered.

Attributes:

Name Type Description
target_field str

The name of the field that this action affects.

hidden (bool | None, optional)

Whether the field should be hidden.

required (bool | None, optional)

Whether the field should be required.

default (str | float | EntityLink | None, optional)

The default value for the field.

options (EntityTypeFieldOptions | None, optional)

Available options for the field.

Source code in src/albert/resources/entity_types.py
def __init__(self, **data: Any):
    if "default" in data and isinstance(data["default"], EntityLink):
        data["default"] = EntityLinkOption(id=data["default"].id, name=data["default"].name)
    super().__init__(**data)

target_field_name

target_field_name: str = Field(alias='target_field')

target_field_id

target_field_id: CustomFieldId | None = None

hidden

hidden: bool | None = None

required

required: bool | None = None

default

default: (
    str | float | EntityLinkOption | EntityLink | None
) = None

options

options: EntityTypeFieldOptions | None = None

EntityTypeRuleTriggerCase

Bases: BaseAlbertModel

A case in a rule that defines when actions should be taken.

Attributes:

Name Type Description
value str

The value of the triggering field that triggers this case.

actions list[EntityTypeRuleAction]

The actions to take when this case is triggered.

value

value: str

actions

EntityTypeRuleTrigger

Bases: BaseAlbertModel

A trigger that can activate rule cases.

Attributes:

Name Type Description
cases list[EntityTypeRuleTriggerCase]

The cases that should be evaluated when this trigger is activated.

EntityTypeRule

Bases: BaseResource

A rule that defines conditional behavior for entity type fields.

Attributes:

Name Type Description
id RuleId

The unique identifier for the rule.

custom_field_id CustomFieldId

The ID of the custom field this rule listens to/ triggers on.

trigger EntityTypeRuleTrigger

The triggers that activate this rule.

id

id: RuleId | None = Field(default=None)

custom_field_id

custom_field_id: CustomFieldId = Field(
    alias="customFieldId"
)

trigger

trigger: EntityTypeRuleTrigger = Field(alias='trigger')