Skip to content

Reports

albert.resources.reports

Attributes:

Name Type Description
ReportItem

ReportItem

ReportItem = dict[str, Any] | list[dict[str, Any]] | None

ReportInfo

Bases: BaseAlbertModel

Attributes:

Name Type Description
report_type_id str
report_type str
category str
items list[ReportItem]

report_type_id

report_type_id: str = Field(..., alias='reportTypeId')

report_type

report_type: str = Field(..., alias='reportType')

category

category: str

items

items: list[ReportItem] = Field(..., alias='Items')

ColumnState

Bases: BaseAlbertModel

Column State Object for reports.

Attributes:

Name Type Description
col_id str
row_group_index int | None
agg_func str | None
pivot bool
pivot_index int | None
row_group bool

col_id

col_id: str = Field(..., alias='colId')

row_group_index

row_group_index: int | None = Field(
    default=None, alias="rowGroupIndex"
)

agg_func

agg_func: str | None = Field(default=None, alias='aggFunc')

pivot

pivot: bool = Field(default=False)

pivot_index

pivot_index: int | None = Field(
    default=None, alias="pivotIndex"
)

row_group

row_group: bool = Field(default=False, alias='rowGroup')

FilterModel

Bases: BaseAlbertModel

Filter Model Object for reports.

Attributes:

Name Type Description
filter_type str
values list[Any] | None

filter_type

filter_type: str = Field(..., alias='filterType')

values

values: list[Any] | None = Field(default=None)

FilterState

Bases: BaseAlbertModel

Filters State Object for reports.

Attributes:

Name Type Description
filter_models list[FilterModel]

filter_models

filter_models: list[FilterModel] = Field(
    default_factory=list, alias="filterModels"
)

MetadataState

Bases: BaseAlbertModel

Metadata State Object for reports.

Attributes:

Name Type Description
grouped_rows list[str]

grouped_rows

grouped_rows: list[str] = Field(
    default_factory=list, alias="groupedRows"
)

ChartConfiguration

Bases: BaseAlbertModel

Chart Configuration Object for reports.

Attributes:

Name Type Description
chart_type str | None

chart_type

chart_type: str | None = Field(
    default=None, alias="chartType"
)

ChartTemplate

Bases: BaseAlbertModel

Chart Template Object for reports.

Attributes:

Name Type Description
chart_type str

chart_type

chart_type: str = Field(..., alias='chartType')

ChartModelState

Bases: BaseAlbertModel

Chart State Object for reports.

Attributes:

Name Type Description
chart_template ChartTemplate | None
chart_configuration ChartConfiguration | None

chart_template

chart_template: ChartTemplate | None = Field(
    default=None, alias="chartTemplate"
)

chart_configuration

chart_configuration: ChartConfiguration | None = Field(
    default=None, alias="chartConfiguration"
)

ColumnMapping

Bases: BaseAlbertModel

Column Mapping Object for reports.

FullAnalyticalReport

Bases: BaseResource

A full analytical report in Albert.

This resource represents a complete analytical report with all its configuration, data, and state information.

Attributes:

Name Type Description
report_data_id str | None

Unique Identifier of the Report which is created. Read-only.

report_type_id str

Type of report which will be created. Taken from reports/type API.

report_type str | None

Type of report which will be created. Name taken from reports/type API.

name str

Name of the report. Maximum length 500 characters.

description str | None

Description of the report. Maximum length 1000 characters.

project_id str | None

Project ID of the report. Not mandatory.

project_name str | None

Name of the project.

parent_id str | None

Parent ID of the report. Not mandatory.

report_v2 bool | None

Whether this is a v2 report.

input_data dict[str, Any] | None

Input data for the report.

report_state str | None

Any string representing the report state.

column_state List[ColumnState] | None

Column state objects.

filter_state FilterState | None

Filters state object.

meta_data_state MetadataState | None

Metadata state object.

chart_model_state List[ChartModelState] | None

Chart state objects.

field_mapping List[ColumnMapping] | None

Column mapping objects.

source_report_id str | None

Report ID from which to copy states to the new report.

created_by str | None

Specifies the createdBy id.

Methods:

Name Description
get_raw_dataframe

Get the raw report data as a pandas DataFrame.

id

id: ReportId | None = Field(
    default=None,
    alias=AliasChoices("id", "albertId"),
    serialization_alias="id",
    exclude=True,
    frozen=True,
)

report_type_id

report_type_id: str = Field(..., alias='reportTypeId')

name

name: str = Field(..., min_length=1, max_length=500)

report_type

report_type: str | None = Field(
    default=None, alias="reportType"
)

description

description: str | None = Field(
    default=None, max_length=1000
)

project_id

project_id: ProjectId | None = Field(
    default=None, alias="projectId"
)

project_name

project_name: str | None = Field(
    default=None, alias="projectName"
)

parent_id

parent_id: str | None = Field(
    default=None, alias="parentId"
)

report_v2

report_v2: bool | None = Field(
    default=None, alias="reportV2"
)

input_data

input_data: dict[str, Any] | None = Field(
    default=None, alias="inputData"
)

report_state

report_state: str | None = Field(
    default=None, alias="reportState"
)

column_state

column_state: list[ColumnState] | None = Field(
    default_factory=list, alias="columnState"
)

filter_state

filter_state: FilterState | None = Field(
    default=None, alias="filterState"
)

meta_data_state

meta_data_state: MetadataState | None = Field(
    default=None, alias="metaDataState"
)

chart_model_state

chart_model_state: list[ChartModelState] | None = Field(
    default_factory=list, alias="chartModelState"
)

field_mapping

field_mapping: list[ColumnMapping] | None = Field(
    default_factory=list, alias="FieldMapping"
)

source_report_id

source_report_id: ReportId | None = Field(
    default=None, alias="sourceReportId"
)

created_by

created_by: str | None = Field(
    default=None, alias="createdBy"
)

report

report: list[dict[str, Any]] | None = Field(
    default=None, frozen=True
)

get_raw_dataframe

get_raw_dataframe() -> DataFrame

Get the raw report data as a pandas DataFrame.

Returns:

Type Description
DataFrame

The raw report data.

Source code in src/albert/resources/reports.py
def get_raw_dataframe(self) -> pd.DataFrame:
    """
    Get the raw report data as a pandas DataFrame.

    Returns
    -------
    pd.DataFrame
        The raw report data.
    """
    if not self.report:
        raise ValueError("Report data is not available")
    return pd.DataFrame(self.report)