Reports
albert.collections.reports.ReportCollection
Bases: BaseCollection
Manage Reports in the Albert platform.
A Report runs a predefined server-side report type over the data you point it
at and returns the computed results. Report types fall into categories such as
"analytics" and "datascience", and each is identified by a report type
ID (e.g. "RET22" or the fully qualified "ALB#RET51"). The set of
available report types is defined by Report Templates (see
ReportTemplateCollection).
Two styles of access are provided:
- Run a report on demand and read its results directly with
get_report(or the category-specificget_analytics_reportandget_datascience_report). These takeinput_datadescribing what to run the report over (e.g. project or inventory IDs). - Persist a report configuration as a
FullAnalyticalReportwithcreate_report, then fetch it later by its Report ID (formatREP...) withget_full_report.
This collection is accessed as client.reports.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for report requests. |
Methods:
| Name | Description |
|---|---|
get_report |
Run a report of any category and return its results. |
get_analytics_report |
Run an analytics report and return its results. |
get_datascience_report |
Run a datascience report and return its results. |
get_full_report |
Get a saved report by its ID, with configuration and data. |
create_report |
Persist a new analytical report configuration. |
delete |
Delete a saved report by its ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/reports.py
get_report
get_report(
*,
category: str,
report_type_id: str,
input_data: dict[str, Any] | None = None,
) -> ReportInfo
Run a report of a given category and return its results.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
The category of the report (e.g. |
required |
report_type_id
|
str
|
The report type ID identifying which report to run (e.g. |
required |
input_data
|
dict[str, Any] | None
|
Input describing what to run the report over, keyed by field name (e.g. project IDs, inventory IDs, or unique IDs). Optional. |
None
|
Returns:
| Type | Description |
|---|---|
ReportInfo
|
The report type metadata and computed result items. |
Source code in src/albert/collections/reports.py
get_analytics_report
get_analytics_report(
*,
report_type_id: str,
input_data: dict[str, Any] | None = None,
) -> ReportInfo
Run an analytics report and return its results.
Convenience wrapper around get_report with
category="analytics".
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_type_id
|
str
|
The report type ID identifying which analytics report to run
(e.g. |
required |
input_data
|
dict[str, Any] | None
|
Input describing what to run the report over, keyed by field name (e.g. inventory IDs). Optional. |
None
|
Returns:
| Type | Description |
|---|---|
ReportInfo
|
The report type metadata and computed result items. |
Source code in src/albert/collections/reports.py
get_datascience_report
get_datascience_report(
*,
report_type_id: str,
input_data: dict[str, Any] | None = None,
) -> ReportInfo
Run a datascience report and return its results.
Convenience wrapper around get_report with
category="datascience".
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_type_id
|
str
|
The report type ID identifying which datascience report to run
(e.g. |
required |
input_data
|
dict[str, Any] | None
|
Input describing what to run the report over, keyed by field name (e.g. project IDs and unique IDs). Optional. |
None
|
Returns:
| Type | Description |
|---|---|
ReportInfo
|
The report type metadata and computed result items. |
Source code in src/albert/collections/reports.py
get_full_report
get_full_report(
*, report_id: ReportId
) -> FullAnalyticalReport
Get a saved analytical report by its ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_id
|
ReportId
|
The Report ID to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
FullAnalyticalReport
|
The saved report with all of its configuration and data. |
Source code in src/albert/collections/reports.py
create_report
create_report(
*, report: FullAnalyticalReport
) -> FullAnalyticalReport
Create a new analytical report.
Read-only fields on the supplied report (report_data_id,
created_by, and report) are ignored on creation.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report
|
FullAnalyticalReport
|
The report configuration to create. |
required |
Returns:
| Type | Description |
|---|---|
FullAnalyticalReport
|
The created report as returned by the server, including its assigned ID. |
Source code in src/albert/collections/reports.py
delete
delete(*, id: ReportId) -> None
Delete a saved report by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
ReportId
|
The Report ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|