-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdata-quality-scoring.html
More file actions
85 lines (74 loc) · 2.65 KB
/
Copy pathdata-quality-scoring.html
File metadata and controls
85 lines (74 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
layout: default
title: Data Quality Scoring
---
<h1>Data Quality Scoring</h1>
<p class="text-muted">
This page explains how the Data Quality Dashboard computes the issue score used to rank
resources most in need of improvement.
</p>
<p>
<a class="btn btn-outline-secondary btn-sm" href="data-quality-dashboard.html">Back to Data Quality Dashboard</a>
</p>
<h2>Formula</h2>
<p>
The score is calculated as:
<code>score = Σ(weight × issue_count)</code>
</p>
<p class="text-muted">
A higher score indicates more (or more severe) quality issues for that resource.
</p>
<h2>Current Weights</h2>
<p class="text-muted small" id="scoring-meta"></p>
<div class="table-responsive">
<table class="table table-sm table-bordered" id="score-weights-table">
<thead>
<tr>
<th>Issue Key</th>
<th>Weight</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<h2>Tracked But Unscored Metrics</h2>
<p class="text-muted" id="unscored-metrics"></p>
<div id="scoring-error" class="alert alert-warning" style="display:none;" role="alert"></div>
<script>
const numberFmt = new Intl.NumberFormat();
function fmt(value) {
return numberFmt.format(value ?? 0);
}
async function loadScoring() {
const errorNode = document.getElementById('scoring-error');
try {
const response = await fetch('reports/quality-dashboard.json');
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
const weights = data.scoring?.weights || {};
const tbody = document.querySelector('#score-weights-table tbody');
tbody.innerHTML = '';
Object.entries(weights)
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
.forEach(([key, weight]) => {
const tr = document.createElement('tr');
tr.innerHTML = `<td><code>${key}</code></td><td>${fmt(weight)}</td>`;
tbody.appendChild(tr);
});
const generated = data.generated_at || 'unknown';
document.getElementById('scoring-meta').textContent =
`Loaded from reports/quality-dashboard.json (generated ${generated}).`;
const unscored = data.scoring?.tracked_but_unscored_metrics || [];
const unscoredText = unscored.length
? unscored.join(', ')
: 'None currently.';
document.getElementById('unscored-metrics').textContent = unscoredText;
} catch (error) {
errorNode.textContent = `Unable to load scoring details: ${error.message}`;
errorNode.style.display = 'block';
}
}
loadScoring();
</script>