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

Axis

Bases: str, Enum

Attributes:

Name Type Description
X
Y

X

X = 'X'

Y

Y = 'Y'

CurveDBMetadata

Bases: BaseAlbertModel

Show JSON schema:
{
  "properties": {
    "tableName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Tablename"
    },
    "partitionKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Partitionkey"
    }
  },
  "title": "CurveDBMetadata",
  "type": "object"
}

Fields:

table_name

table_name: str | None = None

partition_key

partition_key: str | None = None

StorageKeyReference

Bases: BaseAlbertModel

Show JSON schema:
{
  "properties": {
    "rawfile": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Rawfile"
    },
    "s3Input": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "S3Input"
    },
    "s3Output": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "S3Output"
    },
    "preview": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Preview"
    },
    "thumb": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Thumb"
    },
    "original": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Original"
    }
  },
  "title": "StorageKeyReference",
  "type": "object"
}

Fields:

rawfile

rawfile: str | None = None

s3_input

s3_input: str | None = None

s3_output

s3_output: str | None = None

preview

preview: str | None = None

thumb

thumb: str | None = None

original

original: str | None = None

JobSummary

Bases: BaseAlbertModel

Show JSON schema:
{
  "properties": {
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Id"
    },
    "state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "State"
    }
  },
  "title": "JobSummary",
  "type": "object"
}

Fields:

id

id: str | None = None

state

state: str | None = None

Bases: EntityLinkWithName

Attributes:

Name Type Description
id DataColumnId
axis Axis | None
unit SerializeAsEntityLink[Unit] | None

id

axis

axis: Axis | None = Field(default=None)

unit

unit: SerializeAsEntityLink[Unit] | None = Field(
    default=None, alias="Unit"
)

DataColumnValue

Bases: BaseResource

Methods:

Name Description
check_for_id

Attributes:

Name Type Description
data_column DataColumn | None
data_column_id DataColumnId | None
name str | None
original_name str | None
value str | None
hidden bool
unit SerializeAsEntityLink[Unit] | None
calculation str | None
sequence str | None
script bool | None
db_metadata CurveDBMetadata | None
storage_key_reference StorageKeyReference | None
job JobSummary | None
csv_mapping dict[str, str] | CSVMapping | None
validation list[ValueValidation] | None
curve_data list[CurveDataEntityLink] | None
created AuditFields | None

data_column

data_column: DataColumn | None = Field(
    exclude=True, default=None
)

data_column_id

data_column_id: DataColumnId | None = Field(
    alias="id", default=None
)

name

name: str | None = None

original_name

original_name: str | None = Field(
    default=None,
    alias="originalName",
    exclude=True,
    frozen=True,
)

value

value: str | None = None

hidden

hidden: bool = False

unit

unit: SerializeAsEntityLink[Unit] | None = Field(
    default=None, alias="Unit"
)

calculation

calculation: str | None = None

sequence

sequence: str | None = Field(default=None)

script

script: bool | None = None

db_metadata

db_metadata: CurveDBMetadata | None = Field(
    default=None, alias="athena"
)

storage_key_reference

storage_key_reference: StorageKeyReference | None = Field(
    default=None, alias="s3Key"
)

job

job: JobSummary | None = None

csv_mapping

csv_mapping: dict[str, str] | CSVMapping | None = Field(
    default=None, alias="csvMapping"
)

validation

validation: list[ValueValidation] | None = Field(
    default_factory=list
)

curve_data

curve_data: list[CurveDataEntityLink] | None = Field(
    default=None,
    validation_alias=AliasChoices("CurveData", "curveData"),
    serialization_alias="curveData",
)

created

created: AuditFields | None = Field(
    default=None,
    alias="Created",
    validation_alias=AliasChoices("Created", "Added"),
    serialization_alias="Added",
)

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
documents list[EntityLink]
original_name str | None
full_name str | None

name

name: str

id

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

description

description: str | None = None

security_class

security_class: SecurityClass | None = Field(
    default=None, alias="class"
)

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"
)

documents

documents: list[EntityLink] = Field(
    default_factory=list,
    alias="Documents",
    exclude=True,
    frozen=True,
)

original_name

original_name: str | None = Field(
    default=None,
    alias="originalName",
    exclude=True,
    frozen=True,
)

full_name

full_name: str | None = Field(
    default=None,
    alias="fullName",
    exclude=True,
    frozen=True,
)

ImportMode

Bases: str, Enum

Attributes:

Name Type Description
SCRIPT
CSV

SCRIPT

SCRIPT = 'SCRIPT'

CSV

CSV = 'CSV'

CurveExample

Bases: BaseAlbertModel

Curve example data for a data template column.

Attributes:

Name Type Description
mode ImportMode

ImportMode.CSV ingests the CSV directly; ImportMode.SCRIPT runs the attached script first (requires a script attachment on the column).

field_mapping dict[str, str] | None

Optional header-to-curve-result mapping, e.g. {"visc": "Viscosity"}. Overrides auto-detected mappings.

file_path str | Path | None

Local path to source CSV file.

attachment_id AttachmentId | None

Existing attachment ID of source CSV file. Provide exactly one source CSV (local path or existing attachment).

Show JSON schema:
{
  "$defs": {
    "ImportMode": {
      "enum": [
        "SCRIPT",
        "CSV"
      ],
      "title": "ImportMode",
      "type": "string"
    }
  },
  "description": "Curve example data for a data template column.\n\nAttributes\n----------\nmode : ImportMode\n    ``ImportMode.CSV`` ingests the CSV directly; ``ImportMode.SCRIPT`` runs the attached\n    script first (requires a script attachment on the column).\nfield_mapping : dict[str, str] | None\n    Optional header-to-curve-result mapping, e.g. ``{\"visc\": \"Viscosity\"}``. Overrides\n    auto-detected mappings.\nfile_path : str | Path | None\n    Local path to source CSV file.\nattachment_id : AttachmentId | None\n    Existing attachment ID of source CSV file.\n    Provide exactly one source CSV (local path or existing attachment).",
  "properties": {
    "type": {
      "const": "curve",
      "default": "curve",
      "title": "Type",
      "type": "string"
    },
    "mode": {
      "$ref": "#/$defs/ImportMode",
      "default": "CSV"
    },
    "field_mapping": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Field Mapping"
    },
    "file_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "format": "path",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "File Path"
    },
    "attachment_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Attachment Id"
    }
  },
  "title": "CurveExample",
  "type": "object"
}

Fields:

Validators:

  • _require_curve_source

type

type: Literal[CURVE] = CURVE

mode

mode: ImportMode = CSV

field_mapping

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

file_path

file_path: str | Path | None = None

attachment_id

attachment_id: AttachmentId | None = None

ImageExample

Bases: BaseAlbertModel

Example data for an image data column.

Show JSON schema:
{
  "description": "Example data for an image data column.",
  "properties": {
    "type": {
      "const": "image",
      "default": "image",
      "title": "Type",
      "type": "string"
    },
    "file_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "format": "path",
          "type": "string"
        }
      ],
      "title": "File Path"
    }
  },
  "required": [
    "file_path"
  ],
  "title": "ImageExample",
  "type": "object"
}

Fields:

type

type: Literal[IMAGE] = IMAGE

file_path

file_path: str | Path

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