Skip to content

Feature: Readiness Report#123

Open
biqar wants to merge 26 commits into
idtlab:developfrom
biqar:feature-report
Open

Feature: Readiness Report#123
biqar wants to merge 26 commits into
idtlab:developfrom
biqar:feature-report

Conversation

@biqar

@biqar biqar commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Related Issues / Pull Requests

N/A

Description

This PR completes the automated AI Data Readiness Report feature in the inspector: a zero-configuration scorecard that aggregates dataset overview, data quality, impact on AI, fairness & bias, and data governance into one view.

Key themes:

  • Progressive loading: per-section API endpoints so scorecards appear as each pillar finishes computing
  • Faster initial load: detail charts deferred until the user expands a section; governance MM risk uses a vectorized groupby path (report-only)
  • Explainable automation: each section exposes auto-selection criteria, thresholds, and needs-attention lists
  • PDF export: client-side download of scorecard content (no metric re-computation) once all sections load

What changes are proposed in this pull request?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected; for instance, examples in this repository must be updated too)
  • This change requires a documentation update

Backend (web/routes/metrics.py)

  • Add GET /readiness-report/<section> for progressive section loading (dataset-overview, data-quality, impact-on-ai, fairness-bias, data-governance)
  • Add GET /readiness-report/<section>/visualizations for on-demand chart images
  • Add include_visualization parameter (default True) to metric helpers; readiness builders pass False for faster JSON responses
  • Data governance section: automated column selection (quasi-identifiers, sensitive attribute, HIPAA scan, DP demo) with documented thresholds and needs-attention signals

Metric layer (aidrin/structured_data_metrics/)

  • Add generate_single_attribute_MM_risk_scores_groupby and generate_multiple_attribute_MM_risk_scores_groupby for readiness-report MM linkage risk (parity with legacy implementations)
  • Legacy MM functions unchanged for the interactive Privacy tab and Celery tasks
  • include_visualization support in completeness, outliers, correlation, statistical rate, and add_noise where used by the report

Frontend (web/static/js/inspector.js, templates, CSS)

  • Hybrid fetch: dataset overview first, then parallel section loads with per-section status tracking
  • On-demand visualization loading when <details> panels are expanded
  • Standardized scorecard layout, group-aware number formatting, per-section build-time footer, contextual needs-attention rows
  • Download PDF report button (html2pdf.js) — exports rendered scorecards without detail charts; print-safe styling for dark mode / html2canvas
  • Readiness Report panel template and sidebar entry

Tests

  • TestMMRiskGroupbyParity in tests/unit/test_privacy.py — descriptive stats and dataset risk score parity vs legacy MM functions

Checklist:

  • My code modifies existing public API, or introduces new public API, and I updated or wrote documentation
  • I have commented my code
  • My code requires documentation updates, and I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test plan

  1. Upload a sample dataset (e.g. adult.csv) and open Readiness Report from the sidebar.
  2. Confirm sections load progressively (overview first, then quality / impact / fairness / governance).
  3. Expand Show detailed charts in a section, charts load on first open only.
  4. Verify auto-selection criteria boxes and needs-attention lists render for fairness and governance.
  5. Wait for all five sections to render and then Download PDF report appears and produces a readable scorecard PDF (no washed-out overlay).
  6. Confirm interactive Privacy Preservation tab still uses legacy MM risk behavior, this report introduce a new vectorized groupby based version which should work faster than the existing one.
  7. Run uv run pytest tests/unit/test_privacy.py::TestMMRiskGroupbyParity -q.
  8. Run full unit test suite before merge.

biqar added 16 commits June 16, 2026 18:42
Introduce a non-interactive Readiness Report in the inspector that runs without user feature or target selection. Add GET /readiness-report to aggregate dataset overview (per-feature profiles, histograms, categorical
charts), data quality scorecards, impact-on-AI signals from vectorized all-pairs correlation (leakage, redundancy, isolated features), and automated fairness & bias checks with auto-selected columns.

Wire the new sidebar panel and lazy-loaded UI renderers, add chart helpers for histograms and categorical distributions, and include info-tooltips that explain each readiness metric.
Add per-section GET /readiness-report/<section> endpoints and refactor the full-report route to reuse shared section builders. Update the readiness UI to render dataset overview first, then fetch and display Data Quality, Impact on AI, Fairness, and Governance in parallel while other sections keep their loading spinners.
Align Data Quality, Impact on AI, Fairness, and Governance sections on a consistent structure: auto-selection criteria (or analysis scope), overall grade with KPI tiles, then needs attention. Add Impact section grading and column-pruning metadata on the backend, and move supplementary charts and tables into collapsible details.
Enrich backend needs_attention payloads with target, sensitive, and quasi-identifier metadata (including worst k-anonymity groups) so each flag names the columns and groups that triggered it. Refactor Fairness, Governance, and Impact renderers to shared NA helpers for consistent, context-rich display.
…sion

Use shared formatters so floats default to two decimal places and automatically gain precision when values would otherwise show as 0.00 (e.g. minority class shares). Apply consistent decimals within each metric group across all report sections; return raw numerical summary values from the backend for client-side formatting.
Expose build_time_seconds from section API responses and render a footer (e.g. "Prepared in 55.01 seconds") after each scorecard loads, matching the timing already logged on the server.
Stop escaping the secondary line in _readinessNaRow so intentional markup (e.g. monospace column names) renders correctly instead of appearing as literal span tags.
… scorecards.

Add include_visualization flags to shared metric functions (default True so inspector tabs are unchanged), skip chart generation in readiness section builders, expose GET /readiness-report/<section>/visualizations, and load charts from inspector.js when users expand detail panels.
Add generate_*_MM_risk_scores_groupby implementations that match legacy outputs, wire them only into the readiness report governance builders, and add parity tests against the original privacy-tab functions.
Expose a download button after all five sections load, then build the PDF from the rendered scorecard HTML so metrics are not recomputed. Omit detail charts and normalize dark-mode/animation styles so html2canvas captures crisp output.
@biqar
biqar requested a review from a team as a code owner June 26, 2026 05:56
@biqar
biqar requested review from jeanbez and kaveenh June 26, 2026 05:56
@biqar biqar changed the title Feature report Feature: Readiness Report Jun 26, 2026
@biqar

biqar commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

Todo items that will go in this PR

  1. Include the FAIR Compliance in the report
  2. Provide 2 pdf report download buttons (with and without the detailed chart).
    a. Possibly move the pdf creation at the server?
  3. Limit the number of features displayed in the report summary section (MAX 500, prioritize poor > warning > available). The chart details also capped at this MAX threshold.
  4. Check on NAIRR datasets.
  5. Integrate Feature Relevance (under Impact on AI) in the report.

biqar added 9 commits June 29, 2026 15:32
When datasets exceed 500 columns, return poor → warning → good rows first, include full status counts in metadata, and show a truncation note in the UI/PDF.
Cap overview detail payloads (numerical summary, categorical distributions, excluded-column lists) and mirror those limits in the UI so collapsed panels do not build huge DOM trees. Export PDFs from scorecard sections only instead of cloning the full panel, and use html2canvas scale 1 to cut rasterization cost. Readiness scores are unchanged.
Generate histograms and categorical pie charts only for the features shown in the profile table (up to 500, poor → warning → good), including on-demand chart loads. Update the details panel to reflect this scope.
Append a metadata-driven FAIR card at the bottom of the report that reuses POST /fair-assessment and shared render helpers. Automated sections still gate PDF export; FAIR is included only after a successful evaluation.
… reload

Store each readiness section and its on-demand visualizations in TEMP_RESULTS_CACHE under user/file-scoped keys with a 30-minute TTL. Reuse existing upload invalidation via clear_all_user_cache; expose cached status in section, visualization, and full-report API responses. Add unit tests for key format, store/retrieve, error skip, expiry, and
upload-style clearing.
Expose GET /cached-result/readiness_report to return all cached sections in one response when every section is available. On first panel open, try that endpoint before progressive section fetches so reloads skip spinners and multiple round trips. Add unit tests for aggregated cache lookup.
…oad.

Store optional FAIR assessment results under user/file-scoped keys when submitted from the readiness report, keyed by metadata fingerprint so re-uploading the same JSON is instant. Expose GET /cached-result/readiness_report_fair and include fair_compliance in the aggregated readiness cache response. Restore cached FAIR on panel open without requiring metadata re-upload after page reload.
Replace client html2pdf with a WeasyPrint pipeline that builds the scorecard from cached section JSON via GET /readiness-report/pdf. Includes print templates, glossary appendix, per-section footnotes, Needs attention layout/pagination rules, FAIR principle detail tables, and unit/integration tests.
…ables.

Extend the server-side PDF pipeline with mode=full so users can download a scorecard-plus-details report matching each section's Show details panel. Add pdf_details view-model builders, detail/chart print templates and CSS, separate Scorecard PDF and Full report PDF actions in the readiness panel, and unit tests for detail blocks and full-report filenames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant