Skip to content

feat: Add data metrics for numeric columns - #46

Merged
Moritz Potthoff (MoritzPotthoffQC) merged 29 commits into
mainfrom
more-data-metrics
Jul 28, 2026
Merged

feat: Add data metrics for numeric columns#46
Moritz Potthoff (MoritzPotthoffQC) merged 29 commits into
mainfrom
more-data-metrics

Conversation

@MoritzPotthoffQC

@MoritzPotthoffQC Moritz Potthoff (MoritzPotthoffQC) commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

Building on #43 and #47, we would like to provide a few more "data" metrics, this time for numeric columns only.

Changes

  • Add new data metrics, similar to the change metrics

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a626117) to head (5cd68e1).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         1127      1127           
=========================================
  Hits          1127      1127           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from generalize-metrics-add-nullability to main July 16, 2026 10:57
@github-actions github-actions Bot added the enhancement New feature or request label Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds additional data metrics (computed per-side, then rendered as old -> new (delta)) for numeric columns, and updates summary rendering + golden fixtures to accommodate the expanded metric set.

Changes:

  • Added new data-metric functions (mean_data, median_data, min_data, max_data, std_data) and expanded DEFAULT_DATA_METRICS.
  • Updated summary table rendering to apply consistent overflow handling to metric columns.
  • Updated tests, docs, and regenerated summary fixtures to reflect the new preset metrics/labels and the updated table layout.

Reviewed changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
diffly/metrics/data.py Adds numeric “data” metrics and updates the data-metric presets/utilities.
diffly/summary.py Applies consistent overflow behavior to metric columns in the Columns section.
docs/api/metrics.rst Updates API docs to list the newly added data metrics and renamed null-fraction metric.
tests/test_metrics.py Adds unit tests for new data metrics and renames null-fraction test targets.
tests/cli/test_cli.py Updates CLI metric-selection test to use the new data-metric preset label.
tests/summary/fixtures/metrics_null_fraction/test_metrics_null_fraction.py Updates fixture generator test to use the expanded data-metric preset set.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_True_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_presets_many/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for new/wrapped metric headers.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_null_fraction/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for expanded data metrics in the Columns table.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_True_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_True_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_True_sample_pk_True.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_True_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_True_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_True_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.
tests/summary/fixtures/metrics_long_labels/gen/pretty_False_perfect_False_top_False_slim_False_sample_rows_False_sample_pk_False.txt Golden fixture updated for wrapped headers with long metric labels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread diffly/metrics/data.py Outdated
Comment thread diffly/metrics/data.py Outdated
Comment thread diffly/metrics/data.py Outdated
Comment thread diffly/metrics/data.py Outdated
@MoritzPotthoffQC
Moritz Potthoff (MoritzPotthoffQC) marked this pull request as draft July 17, 2026 11:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

diffly/metrics/data.py:63

  • The newly added preset data metrics (Mean/Median/Min/Max) don’t have direct unit-test coverage. tests/test_metrics.py currently tests only null_fraction for data metrics, and there are no assertions anywhere for DEFAULT_DATA_METRICS["Mean"|"Median"|"Min"|"Max"] evaluation/selector behavior. Adding a few small tests (e.g., for a numeric column with/without nulls) would protect these presets from regressions independently of summary fixture generation.
    "Mean": DataMetric(
        fn=lambda col: col.mean(),
        formatter=lambda value: f"{round(value, 2)}",
        selector=cs.numeric(),
    ),

@MoritzPotthoffQC
Moritz Potthoff (MoritzPotthoffQC) merged commit 3769d7d into main Jul 28, 2026
21 checks passed
@MoritzPotthoffQC
Moritz Potthoff (MoritzPotthoffQC) deleted the more-data-metrics branch July 28, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants