Skip to content

Data Templates

albert.resources.data_templates

CSVMapping

Bases: BaseAlbertModel

Show JSON schema:
{
  "properties": {
    "mapId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "examples": "Header1:DAC2900#Header2:DAC4707",
      "title": "Mapid"
    },
    "mapData": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "examples": {
        "Header1": "DAC2900",
        "Header2": "DAC4707"
      },
      "title": "Mapdata"
    }
  },
  "title": "CSVMapping",
  "type": "object"
}

Fields:

map_id

map_id: str | None = None

map_data

map_data: dict[str, str] | None = None

DataColumnValue

Bases: BaseAlbertModel

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"
    },
    "DataColumn": {
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "defalt": {
          "default": false,
          "title": "Defalt",
          "type": "boolean"
        },
        "Metadata": {
          "anyOf": [
            {
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/EntityLink"
                  },
                  {
                    "items": {
                      "$ref": "#/$defs/EntityLink"
                    },
                    "type": "array"
                  }
                ]
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Metadata"
        },
        "albertId": {
          "default": null,
          "title": "Albertid",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "title": "DataColumn",
      "type": "object"
    },
    "DataType": {
      "enum": [
        "number",
        "string",
        "enum"
      ],
      "title": "DataType",
      "type": "string"
    },
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "EnumValidationValue": {
      "description": "Represents a value for an enum type validation.\n\nAttributes\n----------\ntext : str\n    The text of the enum value.\nid : str | None\n    The ID of the enum value. If not provided, the ID will be generated upon creation.",
      "properties": {
        "text": {
          "title": "Text",
          "type": "string"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Id"
        },
        "originalText": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Originaltext"
        }
      },
      "required": [
        "text"
      ],
      "title": "EnumValidationValue",
      "type": "object"
    },
    "Operator": {
      "enum": [
        "between",
        "lt",
        "lte",
        "gte",
        "gt",
        "eq"
      ],
      "title": "Operator",
      "type": "string"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "Unit": {
      "description": "Unit is a Pydantic model representing a unit entity.\n\nAttributes\n----------\nid : str | None\n    The Albert ID of the unit. Set when the unit is retrieved from Albert.\nname : str\n    The name of the unit.\nsymbol : str | None\n    The symbol of the unit.\nsynonyms : List[str] | None\n    The list of synonyms for the unit.\ncategory : UnitCategory\n    The category of the unit.\nverified : bool | None\n    Whether the unit is verified.\nstatus : Status | None\n    The status of the unit. Allowed values are `active`, and `inactive`",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Albertid"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "symbol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Symbol"
        },
        "Synonyms": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Synonyms"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/UnitCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "verified": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": false,
          "title": "Verified"
        }
      },
      "required": [
        "name"
      ],
      "title": "Unit",
      "type": "object"
    },
    "UnitCategory": {
      "description": "UnitCategory is an enumeration of possible unit categories.\n\nAttributes\n----------\nLENGTH : str\n    Represents length units.\nVOLUME : str\n    Represents volume units.\nLIQUID_VOLUME : str\n    Represents liquid volume units.\nANGLES : str\n    Represents angle units.\nTIME : str\n    Represents time units.\nFREQUENCY : str\n    Represents frequency units.\nMASS : str\n    Represents mass units.\nCURRENT : str\n    Represents electric current units.\nTEMPERATURE : str\n    Represents temperature units.\nAMOUNT : str\n    Represents amount of substance units.\nLUMINOSITY : str\n    Represents luminous intensity units.\nFORCE : str\n    Represents force units.\nENERGY : str\n    Represents energy units.\nPOWER : str\n    Represents power units.\nPRESSURE : str\n    Represents pressure units.\nELECTRICITY_AND_MAGNETISM : str\n    Represents electricity and magnetism units.\nOTHER : str\n    Represents other units.\nWEIGHT : str\n    Represents weight units.",
      "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"
    },
    "ValueValidation": {
      "properties": {
        "datatype": {
          "$ref": "#/$defs/DataType"
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "$ref": "#/$defs/EnumValidationValue"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Value"
        },
        "min": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Min"
        },
        "max": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Max"
        },
        "operator": {
          "anyOf": [
            {
              "$ref": "#/$defs/Operator"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "datatype"
      ],
      "title": "ValueValidation",
      "type": "object"
    }
  },
  "properties": {
    "data_column": {
      "$ref": "#/$defs/DataColumn",
      "default": null
    },
    "id": {
      "default": null,
      "title": "Id",
      "type": "string"
    },
    "value": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Value"
    },
    "hidden": {
      "default": false,
      "title": "Hidden",
      "type": "boolean"
    },
    "Unit": {
      "anyOf": [
        {
          "$ref": "#/$defs/Unit"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Unit"
    },
    "calculation": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Calculation"
    },
    "sequence": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Sequence"
    },
    "validation": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ValueValidation"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Validation"
    }
  },
  "title": "DataColumnValue",
  "type": "object"
}

Fields:

Validators:

data_column

data_column: DataColumn = None

data_column_id

data_column_id: str = None

value

value: str | None = None

hidden

hidden: bool = False

unit

unit: SerializeAsEntityLink[Unit] | None = None

calculation

calculation: str | None = None

sequence

sequence: str | None = None

validation

validation: list[ValueValidation] | None

check_for_id

check_for_id()
Source code in src/albert/resources/data_templates.py
@model_validator(mode="after")
def check_for_id(self):
    if self.data_column_id is None and self.data_column is None:
        raise ValueError("Either data_column_id or data_column must be set")
    elif (
        self.data_column_id is not None
        and self.data_column is not None
        and self.data_column.id != self.data_column_id
    ):
        raise ValueError("If both are provided, data_column_id and data_column.id must match")
    elif self.data_column_id is None:
        self.data_column_id = self.data_column.id
    return self

DataTemplate

Bases: BaseTaggedResource

Attributes:

Name Type Description
name str
id DataTemplateId | None
description str | None
security_class SecurityClass | None
verified bool
users_with_access list[SerializeAsEntityLink[User]] | None
data_column_values list[DataColumnValue] | None
parameter_values list[ParameterValue] | None
deleted_parameters list[ParameterValue] | None
metadata dict[str, MetadataItem] | None

name

name: str

id

id: DataTemplateId | None = Field(None, alias='albertId')

description

description: str | None = None

security_class

security_class: SecurityClass | None = None

verified

verified: bool = False

users_with_access

users_with_access: (
    list[SerializeAsEntityLink[User]] | None
) = Field(alias="ACL", default=None)

data_column_values

data_column_values: list[DataColumnValue] | None = Field(
    alias="DataColumns", default=None
)

parameter_values

parameter_values: list[ParameterValue] | None = Field(
    alias="Parameters", default=None
)

deleted_parameters

deleted_parameters: list[ParameterValue] | None = Field(
    alias="DeletedParameters",
    default=None,
    frozen=True,
    exclude=True,
)

metadata

metadata: dict[str, MetadataItem] | None = Field(
    default=None, alias="Metadata"
)

DataTemplateSearchItemDataColumn

Bases: BaseAlbertModel

Show JSON schema:
{
  "$defs": {
    "LocalizedNames": {
      "properties": {
        "de": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "De"
        },
        "ja": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ja"
        },
        "zh": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Zh"
        },
        "es": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Es"
        }
      },
      "title": "LocalizedNames",
      "type": "object"
    }
  },
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Name"
    },
    "localizedNames": {
      "$ref": "#/$defs/LocalizedNames"
    }
  },
  "required": [
    "id",
    "localizedNames"
  ],
  "title": "DataTemplateSearchItemDataColumn",
  "type": "object"
}

Fields:

id

id: str

name

name: str | None = None

localized_names

localized_names: LocalizedNames

DataTemplateSearchItem

Bases: BaseAlbertModel, HydrationMixin[DataTemplate]

Show JSON schema:
{
  "$defs": {
    "DataTemplateSearchItemDataColumn": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "localizedNames": {
          "$ref": "#/$defs/LocalizedNames"
        }
      },
      "required": [
        "id",
        "localizedNames"
      ],
      "title": "DataTemplateSearchItemDataColumn",
      "type": "object"
    },
    "LocalizedNames": {
      "properties": {
        "de": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "De"
        },
        "ja": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ja"
        },
        "zh": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Zh"
        },
        "es": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Es"
        }
      },
      "title": "LocalizedNames",
      "type": "object"
    }
  },
  "properties": {
    "albertId": {
      "title": "Albertid",
      "type": "string"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "dataColumns": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/DataTemplateSearchItemDataColumn"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Datacolumns"
    }
  },
  "required": [
    "albertId",
    "name"
  ],
  "title": "DataTemplateSearchItem",
  "type": "object"
}

Fields:

id

id: str

name

name: str

data_columns

data_columns: (
    list[DataTemplateSearchItemDataColumn] | None
) = None