Skip to content

Reports

albert.collections.reports.ReportCollection

ReportCollection(*, session: AlbertSession)

Bases: BaseCollection

ReportCollection is a collection class for managing Report entities in the Albert platform.

Parameters:

Name Type Description Default
session AlbertSession

The Albert session instance.

required

Methods:

Name Description
get_datascience_report

Get a datascience report by its report type ID.

Attributes:

Name Type Description
base_path
Source code in src/albert/collections/reports.py
def __init__(self, *, session: AlbertSession):
    """
    Initializes the ReportCollection with the provided session.

    Parameters
    ----------
    session : AlbertSession
        The Albert session instance.
    """
    super().__init__(session=session)
    self.base_path = f"/api/{ReportCollection._api_version}/reports"

base_path

base_path = f'/api/{_api_version}/reports'

get_datascience_report

get_datascience_report(
    *,
    report_type_id: str,
    input_data: dict[str, Any] | None = None,
) -> ReportInfo

Get a datascience report by its report type ID.

Parameters:

Name Type Description Default
report_type_id str

The report type ID for the report.

required
input_data dict[str, Any] | None

Additional input data for generating the report (e.g., project IDs and unique IDs).

None

Returns:

Type Description
ReportInfo

The info for the report.

Examples:

>>> report = client.reports.get_datascience_report(
...     report_type_id="RET51",
...     input_data={
...         "projectId": ["PRO123"],
...         "uniqueId": ["DAT123_DAC123"]
...     }
... )
Source code in src/albert/collections/reports.py
def get_datascience_report(
    self,
    *,
    report_type_id: str,
    input_data: dict[str, Any] | None = None,
) -> ReportInfo:
    """Get a datascience report by its report type ID.

    Parameters
    ----------
    report_type_id : str
        The report type ID for the report.
    input_data : dict[str, Any] | None
        Additional input data for generating the report
        (e.g., project IDs and unique IDs).

    Returns
    -------
    ReportInfo
        The info for the report.

    Examples
    --------
    >>> report = client.reports.get_datascience_report(
    ...     report_type_id="RET51",
    ...     input_data={
    ...         "projectId": ["PRO123"],
    ...         "uniqueId": ["DAT123_DAC123"]
    ...     }
    ... )
    """
    path = f"{self.base_path}/datascience/{report_type_id}"

    params = {}
    input_data = input_data or {}
    for key, value in input_data.items():
        params[f"inputData[{key}]"] = value

    response = self.session.get(path, params=params)
    return ReportInfo(**response.json())