Repository navigation
fix(quality): count detected duplicates and distinct PII columns in quality-debt dimensions - #377
Merged
Merged
Conversation
…bt dimensions duplicates: the dimension was scored from report.duplicates_removed, which stays 0 under the default drop_duplicates=False (removal is opt-in), so a frame with 50% duplicate rows scored 0.0. Score max(removed, remaining) over rows_before, where remaining is cleaned.duplicated().sum(). This follows the other dimensions (missingness, outliers, type instability, PII), which describe the cleaned output, and still counts removals when drop_duplicates=True. Unhashable cells fall back to the removed count. The detail now reads "N duplicate row(s) detected (M removed)". pii_risk: the scan records one entity per matching cell, but the count was labelled and scored as columns. A 10-row email column read "10 potential PII column(s)" and scored 1.0. Count the distinct columns from scan.by_column(), skipping findings with no column key, for both the score and the detail. Closes #264 Closes #286
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two quality-debt dimensions in
evaluate_quality_debtwhose numbers didn't match their labels.report.duplicates_removed, which is always 0 under the defaultdrop_duplicates=False, so a frame with 50% duplicate rows scored 0.0. It now scoresmax(removed, remaining) / rows_before, whereremaining = cleaned.duplicated().sum(). That matches the other dimensions, which describe the cleaned output, and still counts removals whendrop_duplicates=True. Unhashable cells fall back to the removed count. The detail now reads"N duplicate row(s) detected (M removed)".scan.by_column(), skipping findings with no column, for both the score and the detail. A 10-row email column in a 2-column frame now reads"1 potential PII column(s)"with score 0.5 instead of"10 ..."/ 1.0. The PII scanner itself is unchanged.Behaviour change: frames with duplicates may now warn or fail the gate under default options;
pii_riskscores drop for tall PII columns.docs/examples/quality_debt.htmlis not regenerated here. If regenerated, duplicates would read "5 duplicate row(s) detected (0 removed)" and pii_risk would change from 1.00 "177 potential PII column(s)" to 0.17 "1 potential PII column(s)", with gate status still WARN.Limitations: detection compares whole rows (a
duplicate_subsetpassed via clean options isn't visible to the scorer), and rows that only become identical after cleaning also count.Tests
New
tests/test_quality_debt_dimensions.py:drop_duplicates=Truestill scores 0.5, detail shows 50 removedVerification
ruff check .: cleanmypy src/freshdata: no issues (202 files)-m "not online and not large")Closes #264
Closes #286