Skip to content

Report Templates

albert.resources.report_templates

ReportTemplateCategory

Bases: str, Enum

The category of a report template.

Attributes:

Name Type Description
ANALYTICS str

Analytics reports.

DATASCIENCE str

Data science reports.

REPORTS str

General reports.

ANALYTICS

ANALYTICS = 'analytics'

DATASCIENCE

DATASCIENCE = 'datascience'

REPORTS

REPORTS = 'reports'

ReportTemplateSubCategory

Bases: str, Enum

The sub-category of a report template, describing its subject area.

Attributes:

Name Type Description
PROJECT str

A single project.

INVENTORY str

Inventory items.

TASKS str

Tasks.

PRODUCTS str

Products.

PROJECTS str

Projects.

INVENTORY_LOTS_AND_HAZARDS str

Inventory lots and their hazards.

PRODUCTS_FORMULAS str

Products and formulas.

RESULT_AND_TASK_DATA str

Result and task data.

BATCH_TASKS_AND_INVENTORY_USAGE str

Batch tasks and inventory usage.

PROJECT

PROJECT = 'Project'

INVENTORY

INVENTORY = 'Inventory'

TASKS

TASKS = 'Tasks'

PRODUCTS

PRODUCTS = 'Products'

PROJECTS

PROJECTS = 'Projects'

INVENTORY_LOTS_AND_HAZARDS

INVENTORY_LOTS_AND_HAZARDS = 'Inventory Lots and Hazards'

PRODUCTS_FORMULAS

PRODUCTS_FORMULAS = 'Products / Formulas'

RESULT_AND_TASK_DATA

RESULT_AND_TASK_DATA = 'Result and Task Data'

BATCH_TASKS_AND_INVENTORY_USAGE

BATCH_TASKS_AND_INVENTORY_USAGE = (
    "Batch Tasks and Inventory Usage"
)

FilterType

Bases: str, Enum

The input type of a report template filter.

Attributes:

Name Type Description
DROPDOWN str

A dropdown selection populated from a data source.

ENUM str

A fixed set of enumerated values.

BOOLEAN str

A true/false toggle.

NUMBER str

A numeric value.

DROPDOWN

DROPDOWN = 'dropDown'

ENUM

ENUM = 'enum'

BOOLEAN

BOOLEAN = 'boolean'

NUMBER

NUMBER = 'number'

FilterOption

Bases: BaseAlbertModel

A filter option for a report template.

Show JSON schema:
{
  "$defs": {
    "FilterType": {
      "description": "The input type of a report template filter.\n\nAttributes\n----------\nDROPDOWN : str\n    A dropdown selection populated from a data source.\nENUM : str\n    A fixed set of enumerated values.\nBOOLEAN : str\n    A true/false toggle.\nNUMBER : str\n    A numeric value.",
      "enum": [
        "dropDown",
        "enum",
        "boolean",
        "number"
      ],
      "title": "FilterType",
      "type": "string"
    }
  },
  "description": "A filter option for a report template.",
  "properties": {
    "name": {
      "description": "Name of the filter",
      "title": "Name",
      "type": "string"
    },
    "type": {
      "anyOf": [
        {
          "$ref": "#/$defs/FilterType"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Type of the filter"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Display label for the filter",
      "title": "Label"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "URL for filter data",
      "title": "Url"
    },
    "payloadId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Payload ID for the filter",
      "title": "Payloadid"
    },
    "method": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "HTTP method for filter data",
      "title": "Method"
    },
    "values": {
      "anyOf": [
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Available values for the filter",
      "title": "Values"
    },
    "default": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether this filter is default",
      "title": "Default"
    },
    "singleSelect": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether single selection is allowed",
      "title": "Singleselect"
    },
    "defaultValue": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Default values for the filter",
      "title": "Defaultvalue"
    }
  },
  "required": [
    "name"
  ],
  "title": "FilterOption",
  "type": "object"
}

Fields:

name

name: str

Name of the filter

type

type: FilterType | None = None

Type of the filter

label

label: str | None = None

Display label for the filter

url

url: str | None = None

URL for filter data

payload_id

payload_id: str | None = None

Payload ID for the filter

method

method: str | None = None

HTTP method for filter data

values

values: list[Any] | None = None

Available values for the filter

default

default: bool | None = None

Whether this filter is default

single_select

single_select: bool | None = None

Whether single selection is allowed

default_value

default_value: list[str] | None = None

Default values for the filter

FilterOptions

Bases: BaseAlbertModel

Filter options configuration for a report template.

Show JSON schema:
{
  "$defs": {
    "FilterOption": {
      "description": "A filter option for a report template.",
      "properties": {
        "name": {
          "description": "Name of the filter",
          "title": "Name",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "$ref": "#/$defs/FilterType"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Type of the filter"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Display label for the filter",
          "title": "Label"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "URL for filter data",
          "title": "Url"
        },
        "payloadId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Payload ID for the filter",
          "title": "Payloadid"
        },
        "method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "HTTP method for filter data",
          "title": "Method"
        },
        "values": {
          "anyOf": [
            {
              "items": {},
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Available values for the filter",
          "title": "Values"
        },
        "default": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether this filter is default",
          "title": "Default"
        },
        "singleSelect": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether single selection is allowed",
          "title": "Singleselect"
        },
        "defaultValue": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Default values for the filter",
          "title": "Defaultvalue"
        }
      },
      "required": [
        "name"
      ],
      "title": "FilterOption",
      "type": "object"
    },
    "FilterType": {
      "description": "The input type of a report template filter.\n\nAttributes\n----------\nDROPDOWN : str\n    A dropdown selection populated from a data source.\nENUM : str\n    A fixed set of enumerated values.\nBOOLEAN : str\n    A true/false toggle.\nNUMBER : str\n    A numeric value.",
      "enum": [
        "dropDown",
        "enum",
        "boolean",
        "number"
      ],
      "title": "FilterType",
      "type": "string"
    }
  },
  "description": "Filter options configuration for a report template.",
  "properties": {
    "minFilters": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Minimum number of filters required",
      "title": "Minfilters"
    },
    "filters": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/FilterOption"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "List of available filters",
      "title": "Filters"
    }
  },
  "title": "FilterOptions",
  "type": "object"
}

Fields:

min_filters

min_filters: int | None = None

Minimum number of filters required

filters

filters: list[FilterOption] | None = None

List of available filters

FieldMapping

Bases: BaseAlbertModel

Field mapping configuration for a report template.

Show JSON schema:
{
  "description": "Field mapping configuration for a report template.",
  "properties": {
    "url": {
      "description": "URL for the field mapping",
      "title": "Url",
      "type": "string"
    },
    "fieldName": {
      "description": "Name of the field",
      "title": "Fieldname",
      "type": "string"
    },
    "displayName": {
      "description": "Display name for the field",
      "title": "Displayname",
      "type": "string"
    }
  },
  "required": [
    "url",
    "fieldName",
    "displayName"
  ],
  "title": "FieldMapping",
  "type": "object"
}

Fields:

url

url: str

URL for the field mapping

field_name

field_name: str

Name of the field

display_name

display_name: str

Display name for the field

ReportTemplate

Bases: BaseResource

A reusable report configuration in Albert.

A report template defines a report type that can be run: its available filters and its default column, chart, and metadata state. Templates are retrieved through ReportTemplateCollection and are grouped by ReportTemplateCategory and ReportTemplateSubCategory.

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"
    },
    "FieldMapping": {
      "description": "Field mapping configuration for a report template.",
      "properties": {
        "url": {
          "description": "URL for the field mapping",
          "title": "Url",
          "type": "string"
        },
        "fieldName": {
          "description": "Name of the field",
          "title": "Fieldname",
          "type": "string"
        },
        "displayName": {
          "description": "Display name for the field",
          "title": "Displayname",
          "type": "string"
        }
      },
      "required": [
        "url",
        "fieldName",
        "displayName"
      ],
      "title": "FieldMapping",
      "type": "object"
    },
    "FilterOption": {
      "description": "A filter option for a report template.",
      "properties": {
        "name": {
          "description": "Name of the filter",
          "title": "Name",
          "type": "string"
        },
        "type": {
          "anyOf": [
            {
              "$ref": "#/$defs/FilterType"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Type of the filter"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Display label for the filter",
          "title": "Label"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "URL for filter data",
          "title": "Url"
        },
        "payloadId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Payload ID for the filter",
          "title": "Payloadid"
        },
        "method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "HTTP method for filter data",
          "title": "Method"
        },
        "values": {
          "anyOf": [
            {
              "items": {},
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Available values for the filter",
          "title": "Values"
        },
        "default": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether this filter is default",
          "title": "Default"
        },
        "singleSelect": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether single selection is allowed",
          "title": "Singleselect"
        },
        "defaultValue": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Default values for the filter",
          "title": "Defaultvalue"
        }
      },
      "required": [
        "name"
      ],
      "title": "FilterOption",
      "type": "object"
    },
    "FilterOptions": {
      "description": "Filter options configuration for a report template.",
      "properties": {
        "minFilters": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Minimum number of filters required",
          "title": "Minfilters"
        },
        "filters": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/FilterOption"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of available filters",
          "title": "Filters"
        }
      },
      "title": "FilterOptions",
      "type": "object"
    },
    "FilterType": {
      "description": "The input type of a report template filter.\n\nAttributes\n----------\nDROPDOWN : str\n    A dropdown selection populated from a data source.\nENUM : str\n    A fixed set of enumerated values.\nBOOLEAN : str\n    A true/false toggle.\nNUMBER : str\n    A numeric value.",
      "enum": [
        "dropDown",
        "enum",
        "boolean",
        "number"
      ],
      "title": "FilterType",
      "type": "string"
    },
    "ReportTemplateCategory": {
      "description": "The category of a report template.\n\nAttributes\n----------\nANALYTICS : str\n    Analytics reports.\nDATASCIENCE : str\n    Data science reports.\nREPORTS : str\n    General reports.",
      "enum": [
        "analytics",
        "datascience",
        "reports"
      ],
      "title": "ReportTemplateCategory",
      "type": "string"
    },
    "ReportTemplateSubCategory": {
      "description": "The sub-category of a report template, describing its subject area.\n\nAttributes\n----------\nPROJECT : str\n    A single project.\nINVENTORY : str\n    Inventory items.\nTASKS : str\n    Tasks.\nPRODUCTS : str\n    Products.\nPROJECTS : str\n    Projects.\nINVENTORY_LOTS_AND_HAZARDS : str\n    Inventory lots and their hazards.\nPRODUCTS_FORMULAS : str\n    Products and formulas.\nRESULT_AND_TASK_DATA : str\n    Result and task data.\nBATCH_TASKS_AND_INVENTORY_USAGE : str\n    Batch tasks and inventory usage.",
      "enum": [
        "Project",
        "Inventory",
        "Tasks",
        "Products",
        "Projects",
        "Inventory Lots and Hazards",
        "Products / Formulas",
        "Result and Task Data",
        "Batch Tasks and Inventory Usage"
      ],
      "title": "ReportTemplateSubCategory",
      "type": "string"
    },
    "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 reusable report configuration in Albert.\n\nA report template defines a report type that can be run: its available\nfilters and its default column, chart, and metadata state. Templates are\nretrieved through\n[`ReportTemplateCollection`][albert.collections.report_templates.ReportTemplateCollection] and are\ngrouped by [`ReportTemplateCategory`][albert.resources.report_templates.ReportTemplateCategory] and [`ReportTemplateSubCategory`][albert.resources.report_templates.ReportTemplateSubCategory].",
  "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 report template. Set when the template is retrieved from Albert.",
      "title": "Albertid"
    },
    "name": {
      "description": "Name of the report template",
      "maxLength": 255,
      "minLength": 1,
      "title": "Name",
      "type": "string"
    },
    "description": {
      "anyOf": [
        {
          "maxLength": 1000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Description of the report template",
      "title": "Description"
    },
    "filterOptions": {
      "anyOf": [
        {
          "$ref": "#/$defs/FilterOptions"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter options configuration"
    },
    "filterState": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current state of filters",
      "title": "Filterstate"
    },
    "metaDataState": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current state of metadata",
      "title": "Metadatastate"
    },
    "chartModelState": {
      "anyOf": [
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current state of chart models",
      "title": "Chartmodelstate"
    },
    "columnState": {
      "anyOf": [
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current state of columns",
      "title": "Columnstate"
    },
    "spName": {
      "description": "Stored procedure name",
      "title": "Spname",
      "type": "string"
    },
    "category": {
      "$ref": "#/$defs/ReportTemplateCategory",
      "description": "Category of the report template"
    },
    "subCategory": {
      "anyOf": [
        {
          "$ref": "#/$defs/ReportTemplateSubCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Sub-category of the report template"
    },
    "customFields": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "List of custom field names",
      "title": "Customfields"
    },
    "fieldMapping": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/FieldMapping"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Field mapping configuration",
      "title": "Fieldmapping"
    }
  },
  "required": [
    "name",
    "spName",
    "category"
  ],
  "title": "ReportTemplate",
  "type": "object"
}

Fields:

id

id: str | None = None

The Albert ID of the report template. Set when the template is retrieved from Albert.

name

name: str

Name of the report template

description

description: str | None = None

Description of the report template

filter_options

filter_options: FilterOptions | None = None

Filter options configuration

filter_state

filter_state: dict[str, Any] | None = None

Current state of filters

meta_data_state

meta_data_state: dict[str, Any] | None = None

Current state of metadata

chart_model_state

chart_model_state: list[Any] | None = None

Current state of chart models

column_state

column_state: list[Any] | None = None

Current state of columns

sp_name

sp_name: str

Stored procedure name

category

Category of the report template

sub_category

sub_category: ReportTemplateSubCategory | None = None

Sub-category of the report template

custom_fields

custom_fields: list[str] | None = None

List of custom field names

field_mapping

field_mapping: list[FieldMapping] | None = None

Field mapping configuration