-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathprofiler.html
More file actions
391 lines (373 loc) · 20.9 KB
/
Copy pathprofiler.html
File metadata and controls
391 lines (373 loc) · 20.9 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fair Code - Open Dataset Profiler</title>
<meta name="description" content="Drop in any tabular CSV and get an instant demographic representation audit - missing subgroups, skewed age/sex distributions, geographic under-sampling. Runs entirely in your browser; your file never leaves your machine.">
<meta name="author" content="Yash Kewlani">
<meta name="robots" content="index, follow, max-image-preview:large">
<meta property="og:site_name" content="Fair Code">
<meta property="og:locale" content="en_US">
<meta property="og:title" content="Fair Code - Open Dataset Profiler">
<meta property="og:description" content="Audit any dataset for demographic imbalance in seconds. 100% client-side - your data never leaves your browser.">
<meta property="og:type" content="website">
<meta property="og:image" content="https://www.thefaircode.xyz/assets/og/profiler.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:type" content="image/png">
<meta property="og:image:alt" content="Fair Code - Open Dataset Profiler">
<meta property="og:image" content="https://www.thefaircode.xyz/assets/og-light/profiler.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:type" content="image/png">
<meta property="og:image:alt" content="Fair Code - Open Dataset Profiler (light)">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Fair Code - Open Dataset Profiler">
<meta name="twitter:description" content="Audit any CSV for demographic imbalance - instantly, privately, in your browser.">
<meta name="twitter:image" content="https://www.thefaircode.xyz/assets/og/profiler.png">
<link rel="canonical" href="https://www.thefaircode.xyz/profiler.html">
<meta property="og:url" content="https://www.thefaircode.xyz/profiler.html">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "SoftwareApplication",
"name": "Fair Code - Open Dataset Profiler",
"url": "https://www.thefaircode.xyz/profiler.html",
"description": "Drop in any tabular CSV and get an instant demographic representation audit - missing subgroups, skewed age/sex distributions, geographic under-sampling. Runs entirely in your browser; your file never leaves your machine.",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Any (runs in a web browser)",
"browserRequirements": "Requires JavaScript",
"isAccessibleForFree": true,
"offers": {"@type": "Offer", "price": "0", "priceCurrency": "USD"},
"author": {"@type": "Person", "name": "Yash Kewlani", "url": "https://github.com/yakew7"},
"creator": {"@type": "Organization", "name": "Fair Code", "url": "https://www.thefaircode.xyz/"}
},
{
"@type": "BreadcrumbList",
"itemListElement": [
{"@type": "ListItem", "position": 1, "name": "Fair Code", "item": "https://www.thefaircode.xyz/"},
{"@type": "ListItem", "position": 2, "name": "Open Dataset Profiler", "item": "https://www.thefaircode.xyz/profiler.html"}
]
}
]
}
</script>
<link rel="icon" href="/assets/icons/favicon.ico" sizes="any">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="192x192" href="/assets/icons/icon-192.png">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect x='32' y='18' width='13' height='64' fill='%2314171A'/><rect x='32' y='18' width='42' height='13' fill='%2314171A'/><rect x='32' y='44' width='36' height='13' fill='%234F7A5B'/></svg>">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&display=swap" rel="stylesheet">
<script>
(function () {
const systemPref = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
var saved = localStorage.getItem('fc-theme') || systemPref;
document.documentElement.setAttribute('data-theme', saved);
})();
</script>
<style>
/* "The Audit Ledger" design tokens - shared with index.html / explainer.html */
:root {
--bg: #f4f1e8;
--surface: #ebe7d9;
--border: #d9d3c0;
--border2: #bdb59c;
--accent: #a63a22;
--accent3: #2f6b4f;
--text: #36321f;
--muted: #7d7459;
--white: #1d1910;
--bias-track-bg: #e2dcc9;
--warn: #7a5b17; /* grade C: darkened from the brand gold to clear 4.5:1 on --surface */
--serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
--sans: 'Archivo', 'Helvetica Neue', sans-serif;
--mono: 'IBM Plex Mono', 'SF Mono', monospace;
}
html[data-theme="dark"] {
--bg: #15130d;
--surface: #1c1912;
--border: #2e2a1f;
--border2: #443e2d;
--accent: #cf6f49;
--accent3: #79b294;
--text: #cfc7b0;
--muted: #8d8367;
--white: #f1e9d4;
--bias-track-bg: #242013;
--warn: #d4ac4a;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: var(--sans);
background: var(--bg);
color: var(--text);
-webkit-font-smoothing: antialiased;
transition: background 0.3s, color 0.3s;
}
a { color: inherit; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only {
position: absolute; width: 1px; height: 1px;
padding: 0; margin: -1px; overflow: hidden;
clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
* {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}
</style>
<link rel="stylesheet" href="assets/profiler.css">
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
<script>
window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
<script defer src="https://cloud.umami.is/script.js" data-website-id="84e0aebf-44e1-466e-b2c6-62f75e1c36c7"></script>
</head>
<body class="profiler-page">
<main class="profiler-shell">
<div class="profiler-topbar">
<a class="profiler-back" href="index.html">← Back to Fair Code</a>
<div class="profiler-topbar-actions">
<a class="profiler-source" href="https://github.com/yakew7/Fair-Code" target="_blank" rel="noopener noreferrer">View source on GitHub</a>
<button class="profiler-theme-toggle" id="themeToggle" aria-label="Toggle theme" aria-pressed="false">☀</button>
</div>
</div>
<section class="profiler-hero">
<div class="profiler-kicker">Research Tools</div>
<h1 class="profiler-headline">Open Dataset Profiler</h1>
<p class="profiler-lede">
Drop in any tabular CSV - health records, hiring data, loan applications - and get an
instant <strong>demographic representation audit</strong>: under-represented or missing
subgroups, skewed age and sex distributions, geographic under-sampling, and intersectional
gaps.
</p>
<p class="profiler-privacy">
<span class="lock" aria-hidden="true">🔒</span> Your file never leaves your browser. All analysis runs locally
on this page - nothing is uploaded.
</p>
</section>
<section class="dropzone" id="dropzone" tabindex="0" role="button"
aria-label="Upload a CSV, TSV, JSON, or Excel file, or click to browse"
aria-describedby="dropzoneHint">
<input type="file" id="fileInput" accept=".csv,.tsv,.json,.xlsx,text/csv,text/tab-separated-values,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden>
<div class="dropzone-inner">
<div class="dropzone-icon" aria-hidden="true">⊕</div>
<p class="dropzone-title">Drop a CSV, TSV, JSON, or Excel file here, or <span class="link">browse</span></p>
<p class="dropzone-hint" id="dropzoneHint">Comma- or tab-separated values with a header row, JSON
(records or split orientation), or an .xlsx workbook (first sheet). (Parquet files: use
<code>faircode profile data.parquet</code> from the CLI.) Proxy-hint detection: use
<code>faircode profile/compare --proxy-hints</code> from the CLI.</p>
<button class="sample-btn" id="sampleBtn" type="button">Try it with a sample dataset</button>
</div>
</section>
<p class="profiler-status" id="fileStatus" aria-live="polite" hidden></p>
<p class="profiler-error" id="error" role="alert" hidden></p>
<p class="sr-only" id="resultsAnnouncer" aria-live="polite" aria-atomic="true"></p>
<section class="results" id="results" hidden>
<div class="score-card">
<div class="score-ring" id="scoreRing">
<span class="score-num" id="scoreNum">–</span>
<span class="score-grade" id="scoreGrade"></span>
</div>
<div class="score-meta">
<h2 id="scoreFileName">Representation score</h2>
<p id="scoreSummary" class="score-summary"></p>
<p class="score-note">A balance-only score (0–100). Missing data, imbalance ratios and
intersectional gaps are listed as flags below, not folded into the number.</p>
</div>
</div>
<div class="results-actions">
<button class="action-btn" id="downloadHtmlBtn" type="button">⬇ Download report (HTML)</button>
<button class="action-btn" id="copyJsonBtn" type="button">⧉ Copy as JSON</button>
<button class="action-btn" id="referenceBtn" type="button">⚖ Score vs reference…</button>
<button class="action-btn" id="referenceClearBtn" type="button" hidden>✕ Clear reference</button>
<input type="file" id="referenceInput" accept=".csv,.tsv,.json,.xlsx,text/csv,text/tab-separated-values,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden>
<span class="reference-status" id="referenceStatus"></span>
</div>
<div class="flags-block" id="flagsBlock" hidden>
<h3><span aria-hidden="true">⚑</span> Flags <span class="count" id="flagCount"></span></h3>
<ul id="flagsList"></ul>
</div>
<details class="mapping-block" id="mappingBlock">
<summary class="mapping-summary">
<span class="section-title" style="margin:0">Column mapping</span>
<span class="mapping-hint">auto-detection missed a column? map it here</span>
</summary>
<p class="section-note">Detection keys off column names, so an oddly-named column
(<code>gndr</code>, <code>patient_region_code</code>) can be missed or mistyped. Override any
column below and the audit re-runs instantly - nothing leaves your browser.</p>
<div class="mapping-list" id="mappingList"></div>
</details>
<details class="mapping-block" id="thresholdsBlock">
<summary class="mapping-summary">
<span class="section-title" style="margin:0">Advanced thresholds</span>
<span class="mapping-hint">tune what counts as under-represented, imbalanced, or small</span>
</summary>
<p class="section-note">Leave a field blank to use its default (shown as the placeholder).
The audit re-runs instantly - nothing leaves your browser. These match
<code>faircode profile</code>'s CLI flags of the same name.</p>
<div class="threshold-controls" id="thresholdControls">
<label>Min share (<code>--min-share</code>)
<input type="number" class="threshold-input" id="minShareInput" data-opt="min_share"
step="0.01" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label>Intersection floor (<code>--intersection-floor</code>)
<input type="number" class="threshold-input" id="intersectionFloorInput" data-opt="intersection_floor"
step="0.01" min="0" max="1" placeholder="0.01" inputmode="decimal">
</label>
<label>Imbalance flag (<code>--imbalance-flag</code>)
<input type="number" class="threshold-input" id="imbalanceFlagInput" data-opt="imbalance_flag"
step="0.1" min="1" placeholder="3.0" inputmode="decimal">
</label>
<label>Missing flag (<code>--missing-flag</code>)
<input type="number" class="threshold-input" id="missingFlagInput" data-opt="missing_flag"
step="0.01" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label>Min group size (<code>--min-group-size</code>)
<input type="number" class="threshold-input" id="minGroupSizeInput" data-opt="min_group_size"
step="1" min="1" placeholder="100" inputmode="numeric">
</label>
</div>
</details>
<h3 class="section-title">Detected demographic dimensions</h3>
<div class="dimensions" id="dimensions"></div>
<div class="intersections-block" id="intersectionsBlock" hidden>
<h3 class="section-title">Intersectional gaps</h3>
<div class="cross-controls" id="crossControls">
<label>Cross
<select class="cross-select" id="crossA" aria-label="First intersection dimension"></select>
</label>
<span aria-hidden="true">×</span>
<label>
<select class="cross-select" id="crossB" aria-label="Second intersection dimension"></select>
</label>
</div>
<p class="section-note" id="intersectionNote"></p>
<div id="intersections"></div>
</div>
</section>
<!-- ── Compare two datasets: representation drift ─────────────────── -->
<section class="compare-block" aria-labelledby="compareHeading">
<h2 class="section-title" id="compareHeading">Compare two datasets - representation drift</h2>
<p class="section-note">
Profile a baseline against a later snapshot - training vs. production, last quarter vs. this
one - to see how each demographic dimension's representation shifted. Drift is measured with
the Population Stability Index (PSI). Both files stay in your browser.
</p>
<div class="compare-drops">
<div class="mini-drop" id="dropA" tabindex="0" role="button"
aria-label="Upload baseline dataset A (CSV, TSV, JSON, or Excel)">
<input type="file" id="fileA" accept=".csv,.tsv,.json,.xlsx,text/csv,text/tab-separated-values,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden>
<span class="mini-drop-tag">A · Baseline</span>
<span class="mini-drop-name" id="nameA">Drop CSV/TSV/JSON/XLSX, or <span class="link">browse</span></span>
<span class="mini-drop-status" id="statusA" aria-live="polite"></span>
</div>
<div class="mini-drop" id="dropB" tabindex="0" role="button"
aria-label="Upload current dataset B (CSV, TSV, JSON, or Excel)">
<input type="file" id="fileB" accept=".csv,.tsv,.json,.xlsx,text/csv,text/tab-separated-values,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden>
<span class="mini-drop-tag">B · Current</span>
<span class="mini-drop-name" id="nameB">Drop CSV/TSV/JSON/XLSX, or <span class="link">browse</span></span>
<span class="mini-drop-status" id="statusB" aria-live="polite"></span>
</div>
</div>
<div class="compare-actions">
<button class="sample-btn" id="compareSampleBtn" type="button">Try with sample drift data</button>
</div>
<details class="mapping-block" id="compareMappingBlock" hidden>
<summary class="mapping-summary">
<span class="section-title" style="margin:0">Column mapping</span>
<span class="mapping-hint">auto-detection missed a column? map it here</span>
</summary>
<p class="section-note">Applies to both datasets A and B - override any column below and
the comparison re-runs instantly on both sides, nothing leaves your browser.</p>
<div class="mapping-list" id="compareMappingList"></div>
</details>
<details class="mapping-block" id="compareThresholdsBlock" hidden>
<summary class="mapping-summary">
<span class="section-title" style="margin:0">Advanced thresholds</span>
<span class="mapping-hint">tune what counts as under-represented, imbalanced, or small</span>
</summary>
<p class="section-note">Applies to both datasets A and B. Leave a field blank to use its
default (shown as the placeholder). The comparison re-runs instantly - nothing leaves your
browser. These match <code>faircode compare</code>'s CLI flags of the same name.</p>
<div class="threshold-controls" id="compareThresholdControls">
<label>Min share (<code>--min-share</code>)
<input type="number" class="threshold-input" id="compareMinShareInput" data-opt="min_share"
step="0.01" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label>Intersection floor (<code>--intersection-floor</code>)
<input type="number" class="threshold-input" id="compareIntersectionFloorInput" data-opt="intersection_floor"
step="0.01" min="0" max="1" placeholder="0.01" inputmode="decimal">
</label>
<label>Imbalance flag (<code>--imbalance-flag</code>)
<input type="number" class="threshold-input" id="compareImbalanceFlagInput" data-opt="imbalance_flag"
step="0.1" min="1" placeholder="3.0" inputmode="decimal">
</label>
<label>Missing flag (<code>--missing-flag</code>)
<input type="number" class="threshold-input" id="compareMissingFlagInput" data-opt="missing_flag"
step="0.01" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label>Min group size (<code>--min-group-size</code>)
<input type="number" class="threshold-input" id="compareMinGroupSizeInput" data-opt="min_group_size"
step="1" min="1" placeholder="100" inputmode="numeric">
</label>
</div>
</details>
<p class="profiler-error" id="compareError" role="alert" hidden></p>
<p class="sr-only" id="compareAnnouncer" aria-live="polite" aria-atomic="true"></p>
<div class="results-actions" id="compareReportActions" hidden>
<button class="action-btn" id="compareDownloadHtmlBtn" type="button">⬇ Download report (HTML)</button>
<button class="action-btn" id="compareCopyJsonBtn" type="button">⧉ Copy as JSON</button>
</div>
<section class="compare-results" id="compareResults" hidden></section>
</section>
<footer class="profiler-foot">
<p>This is the web counterpart of the <code>faircode</code> CLI. Same analysis, same numbers -
run <code>faircode profile data.csv</code> locally for terminal, JSON, and HTML reports.
The Profiler is <strong>diagnostic</strong>: it audits a dataset's representation; it does not
train or fix models. See the
<a href="https://github.com/yakew7/Fair-Code">six bias audits</a> for the model side.</p>
</footer>
</main>
<script src="assets/profiler-engine.js"></script>
<script src="assets/profiler-ui.js"></script>
<script src="assets/profiler-compare.js"></script>
<script>
(function () {
var toggle = document.getElementById('themeToggle');
var html = document.documentElement;
const systemPref = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
function sync() {
var cur = html.getAttribute('data-theme') || systemPref;
toggle.textContent = cur === 'light' ? '☾' : '☀';
toggle.setAttribute('aria-label', cur === 'light' ? 'Switch to dark mode' : 'Switch to light mode');
toggle.setAttribute('aria-pressed', cur === 'dark' ? 'true' : 'false');
}
sync();
toggle.addEventListener('click', function () {
var next = (html.getAttribute('data-theme') || systemPref) === 'dark' ? 'light' : 'dark';
html.setAttribute('data-theme', next);
localStorage.setItem('fc-theme', next);
sync();
});
})();
</script>
</body>
</html>