Skip to content

Workbench Report Storage

Why Report Storage?

Reports (PDFs built by workbench.reports or external scripts) need a shared, addressable home alongside DataSources, FeatureSets, Models, and Endpoints. ReportStore mirrors DFStore for PDF reports, storing them under s3://<WORKBENCH_BUCKET>/reports/ in any logical namespace so they can be linked to Workbench artifacts and viewed directly inside the Workbench Dashboard.

Examples

Using Report Store
from workbench.api import Model, ReportStore

report_store = ReportStore()

# Store a PDF from a local path, bytes, or a workbench.reports.Report object
loc = report_store.upsert("/harmony/cmax/cmax_model", "cmax_model.pdf", metadata={"author": "briford"})

# List and inspect reports
report_store.list(prefix="/harmony")
report_store.summary()
report_store.metadata(loc)

# Retrieve raw PDF bytes or download to disk
pdf_bytes = report_store.get(loc)
report_store.get(loc, dest_path="/tmp/cmax_model.pdf")

# Link to any Workbench artifact (appears as a PDF link in the Dashboard)
Model("aqsol-regression").add_report(loc)

# Delete a report
report_store.delete(loc)

For full guides on Auto Reports, report sections (Data Quality, Model Readiness, Model Performance, Data Comparison, Bateman PK Quality, Archive Intake), and Dashboard display, see the Reports documentation.

ReportStore: Fast/efficient storage of PDF reports in AWS S3

ReportStore

Bases: ReportStoreCore

ReportStore: Storage and retrieval of PDF reports in AWS S3.

Orchestration-side wrapper around :class:ReportStoreCore. Pulls the workbench bucket from :class:ConfigManager and a refreshable boto3 session from :class:AWSAccountClamp. Rooted at s3://<WORKBENCH_BUCKET>/reports/.

Common Usage
from workbench.api import ReportStore

report_store = ReportStore()

# List reports (optionally under a namespace prefix)
report_store.list()
report_store.list(prefix="/harmony")

# Store a report from a local PDF path, bytes, or a Report object
report_store.upsert("/harmony/cmax/cmax_model", "cmax_model.pdf")

# Retrieve PDF bytes or download to disk
pdf_bytes = report_store.get("/harmony/cmax/cmax_model")
report_store.get("/harmony/cmax/cmax_model", dest_path="/tmp/cmax_model.pdf")

# Delete a report
report_store.delete("/harmony/cmax/cmax_model")
Source code in src/workbench/api/report_store.py
class ReportStore(ReportStoreCore):
    """ReportStore: Storage and retrieval of PDF reports in AWS S3.

    Orchestration-side wrapper around :class:`ReportStoreCore`. Pulls the
    workbench bucket from :class:`ConfigManager` and a refreshable boto3
    session from :class:`AWSAccountClamp`. Rooted at ``s3://<WORKBENCH_BUCKET>/reports/``.

    Common Usage:
        ```python
        from workbench.api import ReportStore

        report_store = ReportStore()

        # List reports (optionally under a namespace prefix)
        report_store.list()
        report_store.list(prefix="/harmony")

        # Store a report from a local PDF path, bytes, or a Report object
        report_store.upsert("/harmony/cmax/cmax_model", "cmax_model.pdf")

        # Retrieve PDF bytes or download to disk
        pdf_bytes = report_store.get("/harmony/cmax/cmax_model")
        report_store.get("/harmony/cmax/cmax_model", dest_path="/tmp/cmax_model.pdf")

        # Delete a report
        report_store.delete("/harmony/cmax/cmax_model")
        ```
    """

    def __init__(self, path_prefix: Union[str, None] = None):
        """ReportStore Init Method

        Args:
            path_prefix (Union[str, None], optional): Add a path prefix under ``reports/`` (Defaults to None)
        """
        bucket = ConfigManager().get_config("WORKBENCH_BUCKET")
        session = AWSAccountClamp().boto3_session
        super().__init__(path_prefix=path_prefix, s3_bucket=bucket, boto3_session=session)
        self.log = logging.getLogger("workbench")

__init__(path_prefix=None)

ReportStore Init Method

Parameters:

Name Type Description Default
path_prefix Union[str, None]

Add a path prefix under reports/ (Defaults to None)

None
Source code in src/workbench/api/report_store.py
def __init__(self, path_prefix: Union[str, None] = None):
    """ReportStore Init Method

    Args:
        path_prefix (Union[str, None], optional): Add a path prefix under ``reports/`` (Defaults to None)
    """
    bucket = ConfigManager().get_config("WORKBENCH_BUCKET")
    session = AWSAccountClamp().boto3_session
    super().__init__(path_prefix=path_prefix, s3_bucket=bucket, boto3_session=session)
    self.log = logging.getLogger("workbench")