Reports
albert.resources.reports
Attributes:
| Name | Type | Description |
|---|---|---|
ReportItem |
|
ReportInfo
Bases: BaseAlbertModel
The result of running a report on demand.
Returned by the get_report family of methods on
ReportCollection.
Show JSON schema:
{
"description": "The result of running a report on demand.\n\nReturned by the ``get_report`` family of methods on\n[`ReportCollection`][albert.collections.reports.ReportCollection].",
"properties": {
"reportTypeId": {
"description": "The report type ID that was run (e.g. ``\"RET51\"``).",
"title": "Reporttypeid",
"type": "string"
},
"reportType": {
"description": "The human-readable name of the report type.",
"title": "Reporttype",
"type": "string"
},
"category": {
"description": "The report category (e.g. ``\"analytics\"`` or ``\"datascience\"``).",
"title": "Category",
"type": "string"
},
"Items": {
"description": "The computed report result rows. Each item is a dict (or list of dicts) whose shape depends on the report type.",
"items": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"items": {
"additionalProperties": true,
"type": "object"
},
"type": "array"
},
{
"type": "null"
}
]
},
"title": "Items",
"type": "array"
}
},
"required": [
"reportTypeId",
"reportType",
"category",
"Items"
],
"title": "ReportInfo",
"type": "object"
}
Fields:
-
report_type_id(str) -
report_type(str) -
category(str) -
items(list[ReportItem])
items
items: list[ReportItem]
The computed report result rows. Each item is a dict (or list of dicts) whose shape depends on the report type.
ColumnState
Bases: BaseAlbertModel
The display and grouping state of a single report column.
Show JSON schema:
{
"description": "The display and grouping state of a single report column.",
"properties": {
"colId": {
"description": "The identifier of the column.",
"title": "Colid",
"type": "string"
},
"rowGroupIndex": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "The column's position among the row-grouping columns, if grouped.",
"title": "Rowgroupindex"
},
"aggFunc": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The aggregation function applied to the column (e.g. ``\"sum\"``).",
"title": "Aggfunc"
},
"pivot": {
"default": false,
"description": "Whether the column is used as a pivot column.",
"title": "Pivot",
"type": "boolean"
},
"pivotIndex": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "The column's position among the pivot columns, if pivoted.",
"title": "Pivotindex"
},
"rowGroup": {
"default": false,
"description": "Whether the column is used to group rows.",
"title": "Rowgroup",
"type": "boolean"
}
},
"required": [
"colId"
],
"title": "ColumnState",
"type": "object"
}
Fields:
FilterModel
Bases: BaseAlbertModel
A single filter applied to a report.
Show JSON schema:
{
"description": "A single filter applied to a report.",
"properties": {
"filterType": {
"description": "The kind of filter (e.g. ``\"set\"`` or ``\"text\"``).",
"title": "Filtertype",
"type": "string"
},
"values": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "The values the filter matches against.",
"title": "Values"
}
},
"required": [
"filterType"
],
"title": "FilterModel",
"type": "object"
}
Fields:
-
filter_type(str) -
values(list[Any] | None)
FilterState
Bases: BaseAlbertModel
The collection of filters applied to a report.
Show JSON schema:
{
"$defs": {
"FilterModel": {
"description": "A single filter applied to a report.",
"properties": {
"filterType": {
"description": "The kind of filter (e.g. ``\"set\"`` or ``\"text\"``).",
"title": "Filtertype",
"type": "string"
},
"values": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "The values the filter matches against.",
"title": "Values"
}
},
"required": [
"filterType"
],
"title": "FilterModel",
"type": "object"
}
},
"description": "The collection of filters applied to a report.",
"properties": {
"filterModels": {
"description": "The individual filters that make up the report's filter state.",
"items": {
"$ref": "#/$defs/FilterModel"
},
"title": "Filtermodels",
"type": "array"
}
},
"title": "FilterState",
"type": "object"
}
Fields:
filter_models
filter_models: list[FilterModel]
The individual filters that make up the report's filter state.
MetadataState
Bases: BaseAlbertModel
The metadata state of a report.
Show JSON schema:
Fields:
-
grouped_rows(list[str])
ChartConfiguration
Bases: BaseAlbertModel
The configuration of a chart on a report.
Show JSON schema:
{
"description": "The configuration of a chart on a report.",
"properties": {
"chartType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The type of chart (e.g. ``\"bar\"`` or ``\"line\"``).",
"title": "Charttype"
}
},
"title": "ChartConfiguration",
"type": "object"
}
Fields:
-
chart_type(str | None)
ChartTemplate
Bases: BaseAlbertModel
The template describing a chart's base type on a report.
Show JSON schema:
Fields:
ChartModelState
Bases: BaseAlbertModel
The saved state of a single chart on a report.
Show JSON schema:
{
"$defs": {
"ChartConfiguration": {
"description": "The configuration of a chart on a report.",
"properties": {
"chartType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The type of chart (e.g. ``\"bar\"`` or ``\"line\"``).",
"title": "Charttype"
}
},
"title": "ChartConfiguration",
"type": "object"
},
"ChartTemplate": {
"description": "The template describing a chart's base type on a report.",
"properties": {
"chartType": {
"description": "The type of chart (e.g. ``\"bar\"`` or ``\"line\"``).",
"title": "Charttype",
"type": "string"
}
},
"required": [
"chartType"
],
"title": "ChartTemplate",
"type": "object"
}
},
"description": "The saved state of a single chart on a report.",
"properties": {
"chartTemplate": {
"anyOf": [
{
"$ref": "#/$defs/ChartTemplate"
},
{
"type": "null"
}
],
"default": null,
"description": "The chart's base template."
},
"chartConfiguration": {
"anyOf": [
{
"$ref": "#/$defs/ChartConfiguration"
},
{
"type": "null"
}
],
"default": null,
"description": "The chart's configuration."
}
},
"title": "ChartModelState",
"type": "object"
}
Fields:
-
chart_template(ChartTemplate | None) -
chart_configuration(ChartConfiguration | None)
chart_configuration
chart_configuration: ChartConfiguration | None = None
The chart's configuration.
ColumnMapping
FullAnalyticalReport
Bases: BaseResource
A saved analytical report in Albert.
This resource represents a complete analytical report: its report type, the
data it was run over, and its saved display state (columns, filters, grouping,
and charts). Retrieve one with
get_full_report or create
one with create_report.
Example
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"
},
"ChartConfiguration": {
"description": "The configuration of a chart on a report.",
"properties": {
"chartType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The type of chart (e.g. ``\"bar\"`` or ``\"line\"``).",
"title": "Charttype"
}
},
"title": "ChartConfiguration",
"type": "object"
},
"ChartModelState": {
"description": "The saved state of a single chart on a report.",
"properties": {
"chartTemplate": {
"anyOf": [
{
"$ref": "#/$defs/ChartTemplate"
},
{
"type": "null"
}
],
"default": null,
"description": "The chart's base template."
},
"chartConfiguration": {
"anyOf": [
{
"$ref": "#/$defs/ChartConfiguration"
},
{
"type": "null"
}
],
"default": null,
"description": "The chart's configuration."
}
},
"title": "ChartModelState",
"type": "object"
},
"ChartTemplate": {
"description": "The template describing a chart's base type on a report.",
"properties": {
"chartType": {
"description": "The type of chart (e.g. ``\"bar\"`` or ``\"line\"``).",
"title": "Charttype",
"type": "string"
}
},
"required": [
"chartType"
],
"title": "ChartTemplate",
"type": "object"
},
"ColumnMapping": {
"description": "A mapping of report fields to columns.\n\nThis model currently defines no fields.",
"properties": {},
"title": "ColumnMapping",
"type": "object"
},
"ColumnState": {
"description": "The display and grouping state of a single report column.",
"properties": {
"colId": {
"description": "The identifier of the column.",
"title": "Colid",
"type": "string"
},
"rowGroupIndex": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "The column's position among the row-grouping columns, if grouped.",
"title": "Rowgroupindex"
},
"aggFunc": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The aggregation function applied to the column (e.g. ``\"sum\"``).",
"title": "Aggfunc"
},
"pivot": {
"default": false,
"description": "Whether the column is used as a pivot column.",
"title": "Pivot",
"type": "boolean"
},
"pivotIndex": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "The column's position among the pivot columns, if pivoted.",
"title": "Pivotindex"
},
"rowGroup": {
"default": false,
"description": "Whether the column is used to group rows.",
"title": "Rowgroup",
"type": "boolean"
}
},
"required": [
"colId"
],
"title": "ColumnState",
"type": "object"
},
"FilterModel": {
"description": "A single filter applied to a report.",
"properties": {
"filterType": {
"description": "The kind of filter (e.g. ``\"set\"`` or ``\"text\"``).",
"title": "Filtertype",
"type": "string"
},
"values": {
"anyOf": [
{
"items": {},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "The values the filter matches against.",
"title": "Values"
}
},
"required": [
"filterType"
],
"title": "FilterModel",
"type": "object"
},
"FilterState": {
"description": "The collection of filters applied to a report.",
"properties": {
"filterModels": {
"description": "The individual filters that make up the report's filter state.",
"items": {
"$ref": "#/$defs/FilterModel"
},
"title": "Filtermodels",
"type": "array"
}
},
"title": "FilterState",
"type": "object"
},
"MetadataState": {
"description": "The metadata state of a report.",
"properties": {
"groupedRows": {
"description": "The identifiers of rows that are grouped in the report.",
"items": {
"type": "string"
},
"title": "Groupedrows",
"type": "array"
}
},
"title": "MetadataState",
"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 saved analytical report in Albert.\n\nThis resource represents a complete analytical report: its report type, the\ndata it was run over, and its saved display state (columns, filters, grouping,\nand charts). Retrieve one with\n[`get_full_report`][albert.collections.reports.ReportCollection.get_full_report] or create\none with [`create_report`][albert.collections.reports.ReportCollection.create_report].\n\n!!! example\n ```python\n from albert.resources.reports import FullAnalyticalReport\n\n report = FullAnalyticalReport(\n report_type_id=\"ALB#RET22\",\n name=\"My New Report\",\n description=\"A test report\",\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."
},
"id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Albert ID of the report (format ``REP...``). Set by Albert; read-only.",
"title": "Id"
},
"reportTypeId": {
"description": "The report type ID identifying which report to run. Required.",
"title": "Reporttypeid",
"type": "string"
},
"name": {
"description": "The report's name (1 to 500 characters). Required.",
"maxLength": 500,
"minLength": 1,
"title": "Name",
"type": "string"
},
"reportType": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The human-readable name of the report type.",
"title": "Reporttype"
},
"description": {
"anyOf": [
{
"maxLength": 1000,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A description of the report (maximum 1000 characters).",
"title": "Description"
},
"projectId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The Project the report is scoped to, if any (format ``PRO...``).",
"title": "Projectid"
},
"projectName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The name of the scoped project.",
"title": "Projectname"
},
"parentId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The parent entity the report belongs to, if any.",
"title": "Parentid"
},
"reportV2": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"description": "Whether this is a v2 report.",
"title": "Reportv2"
},
"inputData": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"description": "Input describing what the report is run over, keyed by field name.",
"title": "Inputdata"
},
"reportState": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A string capturing the overall report state.",
"title": "Reportstate"
},
"columnState": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/ColumnState"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The saved display and grouping state of each column.",
"title": "Columnstate"
},
"filterState": {
"anyOf": [
{
"$ref": "#/$defs/FilterState"
},
{
"type": "null"
}
],
"default": null,
"description": "The saved filters applied to the report."
},
"metaDataState": {
"anyOf": [
{
"$ref": "#/$defs/MetadataState"
},
{
"type": "null"
}
],
"default": null,
"description": "The saved metadata state (e.g. grouped rows)."
},
"chartModelState": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/ChartModelState"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The saved state of each chart on the report.",
"title": "Chartmodelstate"
},
"FieldMapping": {
"anyOf": [
{
"items": {
"$ref": "#/$defs/ColumnMapping"
},
"type": "array"
},
{
"type": "null"
}
],
"description": "The mapping of report fields to columns.",
"title": "Fieldmapping"
},
"sourceReportId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "A report to copy state from when creating this report (format ``REP...``).",
"title": "Sourcereportid"
},
"createdBy": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The ID of the user who created the report. Read-only.",
"title": "Createdby"
},
"report": {
"anyOf": [
{
"items": {
"additionalProperties": true,
"type": "object"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "The raw report result rows. Populated when the report is retrieved; read-only. Use [`get_raw_dataframe`][albert.resources.reports.FullAnalyticalReport.get_raw_dataframe] to read it as a DataFrame.",
"title": "Report"
}
},
"required": [
"reportTypeId",
"name"
],
"title": "FullAnalyticalReport",
"type": "object"
}
Fields:
-
status(Status | None) -
created(AuditFields | None) -
updated(AuditFields | None) -
id(ReportId | None) -
report_type_id(str) -
name(str) -
report_type(str | None) -
description(str | None) -
project_id(ProjectId | None) -
project_name(str | None) -
parent_id(str | None) -
report_v2(bool | None) -
input_data(dict[str, Any] | None) -
report_state(str | None) -
column_state(list[ColumnState] | None) -
filter_state(FilterState | None) -
meta_data_state(MetadataState | None) -
chart_model_state(list[ChartModelState] | None) -
field_mapping(list[ColumnMapping] | None) -
source_report_id(ReportId | None) -
created_by(str | None) -
report(list[dict[str, Any]] | None)
id
id: ReportId | None = None
The Albert ID of the report (format REP...). Set by Albert; read-only.
project_id
project_id: ProjectId | None = None
The Project the report is scoped to, if any (format PRO...).
input_data
Input describing what the report is run over, keyed by field name.
column_state
column_state: list[ColumnState] | None
The saved display and grouping state of each column.
meta_data_state
meta_data_state: MetadataState | None = None
The saved metadata state (e.g. grouped rows).
chart_model_state
chart_model_state: list[ChartModelState] | None
The saved state of each chart on the report.
source_report_id
source_report_id: ReportId | None = None
A report to copy state from when creating this report (format REP...).
report
The raw report result rows. Populated when the report is retrieved; read-only. Use get_raw_dataframe to read it as a DataFrame.
get_raw_dataframe
Return the raw report data as a pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
The raw report result rows. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the report has no result data (e.g. it was built locally rather than retrieved from Albert). |