Skip to content

Report Sections & Submodules

workbench.reports composes multi-page PDF documents from modular Section builders. Every report automatically includes:

  • Page 1 Executive Summary: author conclusion, filter/scope callout box, general notes, and clickable KPI summary cards (one per section) that jump straight to each section's opening page.
  • PDF Navigation: outline bookmarks for every section and a SUMMARY return link in the top-right corner of every body page.
  • Layout Auditing: pages.check() verifies zero text overlaps and zero missing font glyphs before writing the PDF.
  • 15 / 10 Table Rule + DFStore Backing Frames: tables with 15 or fewer rows display in full; larger tables display 10 rows with their DFStore location printed underneath, plus a closing Data behind this report index page.

Built-In Report Submodules

1. Data Quality (sections.data_quality, data_quality_report)

  • Analysis module: workbench.utils.pandas_utils.data_quality
  • Report helpers: workbench.reports.sections.data_quality, workbench.reports.data_quality.data_quality_report
  • What it checks & renders:
  • Table & column health: missing values, non-finite numbers (inf/-inf), unparseable strings in numeric columns, constant columns, duplicate keys, and exact duplicate rows.
  • Outlier diagnostics: IQR outlier detection (automatically log10-fenced for positive skewed columns) paired with side-by-side box plots for the top offending columns.
  • Target health (when target is set): censoring / bound pileup, discretization, skew, and dynamic range checks.
  • Replicate noise floor (when target has repeated replicate_key measurements): pooled replicate SD, irreducible RMSE and \(R^2\) ceiling, linear vs. \(\log_{10}\) scale comparison table, replicate spread chart, and max_r2_of_mean(n) ceiling curve (noise_floor, noise_floor_comparison).
  • Warning row triage: ranked example rows behind every warning, backed by DFStore frames (<name>_findings, <name>_rows, <name>_replicates).

2. Model Readiness (workbench.algorithms.models.model_readiness, embedded in sections.data_quality)

  • Analysis module: workbench.algorithms.models.model_readiness.model_readiness
  • Report integration: rendered automatically as a Model readiness subsection inside sections.data_quality whenever target and features or smiles are present (N >= 25, readiness=True).
  • What it checks & renders:
  • Out-of-fold base probes: 5-fold CV (grouped by replicate_key when keys repeat) across XGBoost MSE, XGBoost Huber, Ridge, and kNN, compared against a Y-scramble chance baseline.
  • Empirical chemical semivariogram (readiness_variogram): pairwise target spread vs. Tanimoto/Ruzicka similarity (anchored to the replicate noise floor at similarity 1.0) and the estimated local \(R^2\) ceiling.
  • Learning curve (readiness_learning_curve): probe \(R^2\) progression from 50% to 100% of data to diagnose data-limited vs. noise-limited regimes.
  • Metadata residual shifts: \(\eta^2\) variance explained by assay/batch/source metadata_cols on OOF residuals.
  • Hero Compound Triage: OOF predicted-vs-measured scatter and color-coded breakdown of suspect rows (outliers, activity cliffs, label noise), backed by DFStore frames (<name>_readiness_findings, <name>_readiness_probes, <name>_readiness_rows, <name>_readiness_suspects, <name>_readiness_metadata, <name>_readiness_variogram).

3. Model Performance (sections.performance, model_performance_report, residual_analysis)

  • Analysis modules: workbench.utils.metrics_utils.performance_breakout, workbench.algorithms.models.residual_analysis.residual_analysis
  • Report helpers: workbench.reports.sections.performance, workbench.reports.model_performance.model_performance_report
  • What it checks & renders:
  • Metric KPI tiles: \(R^2\), RMSE, MAE, Spearman \(\rho\), and scored row count; when log=True (positive quantities like PK parameters), computes log10 metrics plus GMFE, AFE, and share within 2x, 3x, and 10x.
  • Diagnostic charts: error-colored predicted vs. measured scatter (with \(\pm 1\)/\(\pm 2\) RMSE or fold bands, dashed OLS trendline, and stats inset), tail-colored error/residual histogram, and optional group breakout bar chart (by="project").
  • Worst-miss triage: full predictions sorted by largest absolute error (or log10 fold miss), with backing DFStore frames (<name>_rows, <name>_breakout).
  • High-Residual & Neighborhood (HTG) Analysis (runs automatically when smiles or features are present): uses FingerprintProximity / FeatureSpaceProximity to diagnose why high-residual compounds (\(|z| \ge 2\)) miss — classifying HTG cliffs (High Target Gradients / activity cliffs), Duplicate conflicts, Neighborhood outliers, Isolated / OOD compounds, and Smooth-neighborhood model errors — rendered with a hero color-coded triage scatter + category cards, Error vs. 1-NN Similarity and Error vs. Local Target Jump (HTG) diagnostic plots, confidence calibration stats (when confidence is present), and per-category tables backed by <name>_high_residuals and <name>_neighborhood frames in DFStore.

4. Data Comparison (sections.comparison, compare_keyed)

  • Analysis module: workbench.utils.pandas_utils.compare_keyed
  • Report helper: workbench.reports.sections.comparison
  • What it checks & renders:
  • Method & scope summary: key columns, compared value columns, relative tolerance (rtol), repeat handling (repeats="exact" vs. "values"), scope exclusions, and optional source URIs (locations=).
  • Overlap visuals: fixed-circle overlap Venn diagram with region counts and optional one-sided breakout bars (by="year").
  • Discrepancy triage: separates "fine" from "needs a look" buckets and tables mismatched values, one-sided keys, and conflicting repeats, publishing <name>_mismatched, <name>_left_only, <name>_right_only, <name>_repeated, and <name>_not_expected.

5. Bateman PK Quality (sections.bateman_quality, bateman_quality)

  • Analysis module: workbench.utils.data_quality.bateman.bateman_quality
  • Report helper: workbench.reports.sections.bateman_quality
  • What it checks & renders:
  • 1-compartment oral/IV PK consistency: evaluates dimensionless Bateman shape and mass-balance relationships across \(C_{\max}\), \(\text{AUC}_\infty\), \(T_{\max}\), \(t_{1/2}\), \(CL\), \(V_{ss}\), and \(F\%\).
  • Hero Bateman manifold chart (bateman_manifold): plots observed records against the \(y = e^{-x}\) theoretical curve with color-coded category summary cards.
  • Color-coded row triage: classifies unit_mismatch (~10x/60x/100x/1000x), impossible_shape, hard_bound, multi_compartment, prolonged_abs, flip_flop, and mass_balance_mismatch, publishing <name>_findings, <name>_rows, and <name>_flagged.

6. Archive Intake (sections.archive, Archive)

  • Analysis module: workbench.utils.archive.Archive
  • Report helper: workbench.reports.sections.archive
  • What it checks & renders:
  • Source provenance: Archive S3 prefix or local directory, file glob pattern, total files discovered, files read cleanly, and rows extracted.
  • Unreadable file audit: lists every file where the client reader raised an exception along with the error reason, publishing <name>_unreadable.

Authoring Custom Sections & Notes

You can mix built-in sections with custom Paginator pages and severity-badged Note callouts in the same Report:

from workbench.reports import Note, Paginator, Panel, Report, Section, Summary

def custom_section(report: Report):
    flow = Paginator(report, "Dose power law check", "Oral Cmax scales sub-linearly with dose.")
    flow.notes(["cmax_data"])
    flow.tiles([("Arms", "412"), ("Slope", "0.84")])
    flow.para("Measured Cmax across 1-100 mpk follows a power law with exponent 0.84.")
    flow.charts(0.24, Panel(0.15, 0.70, lambda ax: ax.plot([1, 10, 100], [1, 7, 48])))
    return flow.figs

note = Note(
    "10 arms carry values copied from a sibling study sheet.",
    severity="serious",
    about="cmax_data",
)
card = Summary("Dose scaling", "Sub-linear scaling (0.84) across 412 arms.", [("Slope", "0.84")], hero=("0.84", "exponent"))

report = Report("Mouse Oral Cmax Study", summary="Data is ready after removing 10 mis-mapped arms.", notes=[note])
report.add(Section(pages=[custom_section], frames={}, summary=card, about=["cmax_data"]))

Low-Level Page Helpers

All sections are built on workbench.utils.plots.report (theme, new_page, head, sec, para, equation, table, stat_row, stat_tiles, panel, badge, rule, footer, tidy, audit, fit_axes, navigate) and reusable Matplotlib chart functions in workbench.utils.plots.data and workbench.utils.plots.performance.