Repository navigation
Commit 7316feb
authored
fix: report undetectable duplicates and uniqueness as unknown instead of clean (#414)
* fix(quality): report undetectable duplicates as unknown instead of clean
_score_debt counted remaining duplicates with cleaned.duplicated() and,
when that raised (TypeError for object columns of lists or dicts, and
since #412 NotImplementedError for nested Arrow list/struct/map
columns), set dup_remaining = 0. "Cannot check" was therefore scored as
"no duplicates": the dimension read 0.0 with "0 duplicate row(s)
detected", counted as clean evidence toward the gate, and was written
to the ledger as a real 0.0, so a later measured run could be compared
against a score that was never measured.
DebtItem gains assessed (default True). When detection is impossible
and nothing was removed, the duplicates dimension is unassessed: it is
never over threshold or worsening, adds nothing to total_score, never
drives the gate status, is skipped when writing the ledger (escalation
compares against the last run that measured it), serialises with score
and over_threshold as None, and is listed in QualityDebtGate.unassessed
and in a "? duplicates: not assessed" summary line. The detail names the
columns that block detection. If rows were already removed through a
hashable duplicate_subset, that count stays a known lower bound.
Frames where duplicates can be detected take the same code path and
produce identical scores, dicts, frames and summaries.
* fix(enterprise): report undetectable uniqueness as unknown in trust scores
compute_trust_score computed uniqueness from frame.duplicated() and,
when that raised (TypeError for object columns of lists or dicts,
NotImplementedError for nested Arrow list/struct/map columns, caught
since #413), set uniqueness = 100.0. "Cannot check" was scored as "no
duplicates": a perfect dimension blended into overall at its full
weight, lifting the trust score of frames whose duplicates were never
checked. It also disagreed with the quality-debt duplicates dimension,
which now reports the same situation as not assessed.
When duplicate rows cannot be checked, uniqueness is now NaN
(TrustScore.uniqueness_assessed is False) and overall blends
completeness, validity and consistency with their weights renormalised
to sum to 1 (equal weights if all of the weight was on uniqueness).
to_dict() gives uniqueness None, str() and both Markdown tables show
n/a, and each column that blocks the check carries an "unhashable
values: duplicate rows not checked" issue.
Frames where duplicates can be detected keep the original four-way
expression and produce identical scores, dicts and renderings.
* fix(render): show unknown trust uniqueness as n/a in the report summary
TrustScore.uniqueness is NaN when duplicate rows could not be checked. The report summary formatted it with :.0f and printed 'uniqueness nan'; it now prints 'uniqueness n/a', matching TrustScore's own text and Markdown output.
* fix(quality): compare debt against each dimension's last recorded score
Unassessed dimensions are no longer written to the ledger, but _previous_scores read only the latest run's items. A run after an unassessed one therefore lost its previous score and could not be marked worsening. Read each dimension's score from the last run that recorded it; when every run records every dimension the result is unchanged.1 parent 4af1cb8 commit 7316feb
9 files changed
Lines changed: 450 additions & 50 deletions
File tree
- docs
- src/freshdata
- enterprise
- render
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
246 | 261 | | |
247 | 262 | | |
248 | 263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | | - | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| |||
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
| |||
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
74 | 93 | | |
75 | 94 | | |
76 | 95 | | |
| |||
86 | 105 | | |
87 | 106 | | |
88 | 107 | | |
89 | | - | |
| 108 | + | |
90 | 109 | | |
91 | 110 | | |
92 | 111 | | |
| |||
106 | 125 | | |
107 | 126 | | |
108 | 127 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
113 | 132 | | |
114 | | - | |
| 133 | + | |
115 | 134 | | |
116 | 135 | | |
117 | 136 | | |
| |||
126 | 145 | | |
127 | 146 | | |
128 | 147 | | |
129 | | - | |
| 148 | + | |
130 | 149 | | |
131 | 150 | | |
132 | 151 | | |
| |||
211 | 230 | | |
212 | 231 | | |
213 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
214 | 248 | | |
215 | 249 | | |
216 | 250 | | |
| |||
219 | 253 | | |
220 | 254 | | |
221 | 255 | | |
222 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
223 | 260 | | |
224 | 261 | | |
225 | 262 | | |
| |||
274 | 311 | | |
275 | 312 | | |
276 | 313 | | |
277 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
278 | 319 | | |
279 | 320 | | |
280 | 321 | | |
281 | 322 | | |
282 | 323 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
289 | 341 | | |
290 | 342 | | |
291 | 343 | | |
| |||
358 | 410 | | |
359 | 411 | | |
360 | 412 | | |
361 | | - | |
362 | | - | |
| 413 | + | |
| 414 | + | |
363 | 415 | | |
364 | 416 | | |
365 | 417 | | |
| |||
0 commit comments