GitHub source

evo.blockmodels.typed.report.Report

A typed wrapper for block model report specifications.

Reports provide resource estimation summaries for block models. They calculate tonnages, grades, and metal content grouped by categories (e.g., geological domains).

Example usage:

# Create a report from a block model
report = await block_model.create_report(ReportSpecificationData(
    name="Resource Report",
    columns=[ReportColumnSpec(column_name="Au", output_unit_id="g/t")],
    categories=[ReportCategorySpec(column_name="domain")],
    mass_unit_id="t",
    density_value=2.7,
    density_unit_id="t/m3",
))

# Pretty-print shows BlockSync link
report

# Get the latest result
result = await report.get_latest_result()
df = result.to_dataframe()

id

id: UUID

The unique identifier of the report specification.

name

name: str

The name of the report.

description

description: str | None

The description of the report.

block_model_uuid

block_model_uuid: UUID

The UUID of the block model this report is for.

revision

revision: int

The revision number of the report specification.

__init__

__init__(
    context: IContext,
    block_model_uuid: UUID,
    specification: ReportSpecificationWithLastRunInfo | ReportSpecificationWithJobUrl,
    block_model_name: str | None = None,
) -> None

Initialize a Report instance.

Parameters:

Name Type Description Default
context IContext

The context containing environment, connector, and cache.

required
block_model_uuid UUID

The UUID of the block model this report is for.

required
specification ReportSpecificationWithLastRunInfo | ReportSpecificationWithJobUrl

The report specification from the API.

required
block_model_name str | None

The name of the block model (for display purposes).

None

create

create(
    context: IContext,
    block_model_uuid: UUID,
    data: ReportSpecificationData,
    column_id_map: dict[str, UUID],
    fb: IFeedback = NoFeedback,
    block_model_name: str | None = None,
) -> Report

Create a new report specification.

Parameters:

Name Type Description Default
context IContext

The context containing environment, connector, and cache.

required
block_model_uuid UUID

The UUID of the block model to create the report for.

required
data ReportSpecificationData

The report specification data.

required
column_id_map dict[str, UUID]

Mapping of column names to their UUIDs in the block model.

required
fb IFeedback

Optional feedback interface for progress reporting.

NoFeedback
block_model_name str | None

The name of the block model (for display purposes).

None

Returns:

Type Description
Report

A Report instance representing the created report.

run

run(version_uuid: UUID | None = None, fb: IFeedback = NoFeedback) -> ReportResult

Run the report to generate a new result.

Parameters:

Name Type Description Default
version_uuid UUID | None

Optional specific version UUID to run the report on. If None, runs on the latest version.

None
fb IFeedback

Optional feedback interface for progress reporting.

NoFeedback

Returns:

Type Description
ReportResult

The generated report result.

refresh

refresh(fb: IFeedback = NoFeedback, timeout_seconds: float = 120.0, poll_interval_seconds: float = 2.0) -> ReportResult

Get the most recent result for this report, waiting if necessary.

If no results exist yet (e.g., report is still running), this method will poll until a result is available or the timeout is reached.

Parameters:

Name Type Description Default
fb IFeedback

Optional feedback interface for progress reporting.

NoFeedback
timeout_seconds float

Maximum time to wait for results (default 120 seconds).

120.0
poll_interval_seconds float

Time between polling attempts (default 2 seconds).

2.0

Returns:

Type Description
ReportResult

The latest report result.

Raises:

Type Description
TimeoutError

If no results are available within the timeout period.

list_results

list_results(limit: int = 50, fb: IFeedback = NoFeedback) -> list[ReportResult]

List all results for this report.

Parameters:

Name Type Description Default
limit int

Maximum number of results to return.

50
fb IFeedback

Optional feedback interface for progress reporting.

NoFeedback

Returns:

Type Description
list[ReportResult]

List of report results, ordered newest first.