pdstools.adm.Analysis

Programmatic ADM health findings built on top of ADMDatamart.

Classes

Finding

A single diagnostic finding from ADM health analysis.

HealthCheckPreAggregates

Precomputed summaries reused across health-check outputs.

Analysis

Automated diagnostic analysis for ADM model data.

Module Contents

class Finding

A single diagnostic finding from ADM health analysis.

Parameters:
  • severity (Severity) – One of “critical”, “warning”, or “info”.

  • category (Category) – The area of the analysis this finding relates to.

  • title (str) – A short, one-line summary of the finding.

  • detail (str) – A longer explanation with context and recommended action.

  • data (dict) – Structured data for programmatic consumption.

severity: Severity
category: Category
title: str
detail: str
data: dict
__str__() str
Return type:

str

class HealthCheckPreAggregates

Precomputed summaries reused across health-check outputs.

last_data: polars.DataFrame
date_start: object | None = None
date_end: object | None = None
total_models: int | None = None
active_models: int | None = None
channel_count: int | None = None
configuration_count: int | None = None
action_count: int | None = None
treatment_count: int | None = None
response_count: int | None = None
positive_count: int | None = None
overall_avg_auc: float | None = None
active_avg_auc: float | None = None
predictor_count: int | None = None
channel_overview: polars.DataFrame | None = None
channel_summary: polars.DataFrame | None = None
configuration_summary: polars.DataFrame | None = None
predictor_overview: polars.DataFrame | None = None
predictor_categories: polars.DataFrame | None = None
prediction_summary: polars.DataFrame | None = None
taxonomy_counts: dict[str, int]
class Analysis(datamart: pdstools.adm.ADMDatamart.ADMDatamart)

Automated diagnostic analysis for ADM model data.

Accessed as datamart.analysis. Provides programmatic health findings that would otherwise require a human to scan through charts and tables.

Examples

>>> from pdstools import datasets
>>> dm = datasets.cdh_sample()
>>> for f in dm.analysis.findings():
...     print(f)
Parameters:

datamart (pdstools.adm.ADMDatamart.ADMDatamart)

datamart
health_check_active_filter(*, active_threshold_days: int = 30) polars.Expr

Return the shared active-model filter used by health checks.

Parameters:

active_threshold_days (int)

Return type:

polars.Expr

health_check_active_threshold_date_string(*, active_threshold_days: int = 30) str

Return the shared cutoff-date string for the active-model filter.

Parameters:

active_threshold_days (int)

Return type:

str

health_check_maturity_criteria() list[tuple[str, str, polars.Expr]]

Return the shared maturity bucket definitions for health checks.

Return type:

list[tuple[str, str, polars.Expr]]

health_check_maturity_overview(*, last_data: polars.DataFrame | None = None, active_filter: polars.Expr | None = None, active_threshold_days: int = 30) polars.DataFrame

Return the shared maturity-overview table used by health checks.

Parameters:
  • last_data (polars.DataFrame | None)

  • active_filter (polars.Expr | None)

  • active_threshold_days (int)

Return type:

polars.DataFrame

compute_health_check_preaggregates(*, active_filter: polars.Expr | None = None, active_threshold_days: int = 30, prediction: Prediction | None = None, include_markdown_sections: bool = True) HealthCheckPreAggregates

Compute reusable summaries for health-check generation.

Parameters:
  • active_filter (pl.Expr, optional) – Custom Polars expression defining which models count as active. If not provided, a default filter based on active_threshold_days is constructed.

  • active_threshold_days (int, default 30) – Default recency window used when active_filter is not provided.

  • prediction (Prediction, optional) – Optional prediction data to summarize alongside ADM data.

  • include_markdown_sections (bool, default True) – Whether to also precompute the compact tables currently used by the Markdown health check (for example configuration summaries).

Returns:

Materialized summaries that can be reused across multiple report outputs within one run.

Return type:

HealthCheckPreAggregates

findings(*, active_filter: polars.Expr | None = None, active_threshold_days: int = 30, prediction: Prediction | None = None, preaggregates: HealthCheckPreAggregates | None = None) list[Finding]

Run all diagnostic checks and return a list of findings.

Parameters:
  • active_filter (pl.Expr, optional) – A Polars expression that filters to “active” models. If not provided, a default filter based on active_threshold_days is constructed.

  • active_threshold_days (int, default 30) – If active_filter is not given, models not updated in this many days are considered inactive.

  • prediction (Prediction, optional) – A Prediction instance. If provided, prediction-level findings are included.

  • preaggregates (HealthCheckPreAggregates, optional) – Pre-computed aggregates to reuse. When omitted they are computed from the datamart. Pass an existing set to avoid recomputing them across several calls.

Returns:

Sorted by severity (critical first, then warning, then info).

Return type:

list[Finding]

markdown(*, title: str = 'ADM Health Check', subtitle: str = '', disclaimer: str = '', active_filter: polars.Expr | None = None, active_threshold_days: int = 30, prediction: Prediction | None = None, preaggregates: HealthCheckPreAggregates | None = None) str

Render findings as agent-friendly GitHub-flavored Markdown.

Parameters:
  • title (str, default "ADM Health Check") – Report title shown at the top of the markdown document.

  • subtitle (str, default "") – Optional subtitle shown below the title.

  • disclaimer (str, default "") – Optional disclaimer shown as a blockquote near the top.

  • active_filter (pl.Expr, optional) – Custom Polars expression defining which models count as active.

  • active_threshold_days (int, default 30) – Default recency window used when active_filter is not provided.

  • prediction (Prediction, optional) – Optional prediction data for prediction-level findings.

  • preaggregates (HealthCheckPreAggregates, optional) – Pre-computed aggregates to reuse. When omitted they are computed from the datamart.

Returns:

Markdown document summarizing the findings.

Return type:

str