pdstools.adm.Analysis¶
Programmatic ADM health findings built on top of ADMDatamart.
Classes¶
A single diagnostic finding from ADM health analysis. |
|
Precomputed summaries reused across health-check outputs. |
|
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¶
- class HealthCheckPreAggregates¶
Precomputed summaries reused across health-check outputs.
- last_data: polars.DataFrame¶
- 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.
- health_check_maturity_criteria() list[tuple[str, str, polars.Expr]]¶
Return the shared maturity bucket definitions for health checks.
- 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_daysis constructed.active_threshold_days (int, default 30) – Default recency window used when
active_filteris 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:
- 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_daysis constructed.active_threshold_days (int, default 30) – If
active_filteris not given, models not updated in this many days are considered inactive.prediction (Prediction, optional) – A
Predictioninstance. 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:
- 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_filteris 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: