Repository navigation
Expand file tree
/
Copy pathprofiler.html
More file actions
551 lines (532 loc) · 31.9 KB
/
Copy pathprofiler.html
File metadata and controls
551 lines (532 loc) · 31.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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<!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,.jsonl,.ndjson,.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 is available
below the results, or from the CLI with <code>faircode profile/compare --proxy-hints</code>.</p>
</div>
</section>
<button class="sample-btn" id="sampleBtn" type="button">Try it with a sample dataset</button>
<label class="encoding-picker">Text encoding (<code>--encoding</code>)
<select class="threshold-input" id="encodingSelect">
<option value="auto" selected>Auto (BOM, else UTF-8)</option>
<option value="utf-8">UTF-8</option>
<option value="utf-16">UTF-16</option>
<option value="cp1252">Windows-1252 (cp1252)</option>
<option value="latin-1">ISO-8859-1 (latin-1)</option>
</select>
</label>
<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="copyCliBtn" type="button" title="The faircode command that reproduces this run with the same options">⧉ Copy as CLI command</button>
<button class="action-btn" id="downloadCsvBtn" type="button">⬇ Download CSV</button>
<label class="csv-provenance"><input type="checkbox" id="csvProvenanceInput"> include provenance</label>
<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,.jsonl,.ndjson,.xlsx,text/csv,text/tab-separated-values,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden>
<span class="reference-status" id="referenceStatus" aria-live="polite"></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>
<label>Max categorical cardinality (<code>--max-categorical-card</code>)
<input type="number" class="threshold-input" id="maxCategoricalCardInput" data-opt="max_categorical_card"
step="1" min="2" placeholder="20" inputmode="numeric">
</label>
<label>Max dimension groups (<code>--max-dimension-groups</code>)
<input type="number" class="threshold-input" id="maxDimensionGroupsInput" data-opt="max_dimension_groups"
step="1" min="1" placeholder="50" inputmode="numeric">
</label>
<label>Max plausible age (<code>--max-age</code>)
<input type="number" class="threshold-input" id="maxAgeInput" data-opt="max_age"
step="1" min="1" placeholder="120" inputmode="numeric">
</label>
<label>Birth-year reference (<code>--age-reference-year</code>)
<input type="number" class="threshold-input" id="ageReferenceYearInput" data-opt="age_reference_year"
step="1" min="1900" placeholder="e.g. 2026" inputmode="numeric">
</label>
<label class="keywords-label">Extra column-name keywords (<code>--keywords</code>, JSON)
<textarea class="threshold-input keywords-input" id="keywordsInput" data-opt-json="keywords" rows="2" aria-describedby="keywordsError"
spellcheck="false" placeholder='{"sex": ["sesso"], "age": ["eta"]}'></textarea>
<span class="keywords-error" id="keywordsError" role="alert" hidden></span>
</label>
<p class="keywords-restored" id="keywordsRestored" hidden>Restored from your last session.
<button type="button" class="action-btn" id="keywordsForget">Forget</button></p>
</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>
<div class="proxy-hints-block" id="proxyHintsBlock" hidden>
<h3 class="section-title">Proxy-hint detection</h3>
<p class="section-note">
Opt-in chi-squared check for column pairs strongly associated with each other - a
"this column may be a proxy for a protected attribute" signal. Informational only;
it never affects the score above.
</p>
<label class="proxy-alpha">Significance level (<code>--proxy-alpha</code>)
<input type="number" class="threshold-input" id="proxyAlphaInput" step="any" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label class="proxy-alpha">Multiple-comparison correction (<code>--proxy-correction</code>)
<select class="threshold-input" id="proxyCorrectionInput">
<option value="">None</option>
<option value="bonferroni">Bonferroni</option>
<option value="holm">Holm</option>
</select>
</label>
<label class="proxy-exact-toggle">
<input type="checkbox" id="proxyExactInput"> Exact test for small cells (<code>--proxy-exact</code>)
</label>
<label class="proxy-exact-tuning">Shuffles (<code>--proxy-exact-permutations</code>)
<input type="number" class="threshold-input" id="proxyExactPermutationsInput" min="1" max="1000000" step="1"
placeholder="1000" inputmode="numeric" disabled aria-describedby="proxyExactError">
</label>
<label class="proxy-exact-tuning">Row cap (<code>--proxy-exact-max-rows</code>)
<input type="number" class="threshold-input" id="proxyExactMaxRowsInput" min="1" step="1"
placeholder="20000" inputmode="numeric" disabled aria-describedby="proxyExactError">
</label>
<span class="keywords-error" id="proxyExactError" role="alert" hidden></span>
<details class="proxy-heldout">
<summary>Test columns you already dropped (<code>--proxy-hints-with</code>)</summary>
<p class="section-note">
Upload the original file that still has the dropped protected attribute (CSV, TSV, JSON or
Excel, same rows in the same order as this dataset, or with a join key column present in
both files), and name the column. Add a row per dropped column. Each is tested against every detected dimension, so "we removed the
column" cannot hide a proxy.
</p>
<div id="heldOutRows"></div>
<button type="button" class="proxy-hints-btn" id="heldOutAddBtn">+ Add another column</button>
</details>
<button type="button" class="proxy-hints-btn" id="proxyHintsBtn">Check for proxy columns</button>
<div id="proxyHintsResults" aria-live="polite"></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,.jsonl,.ndjson,.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,.jsonl,.ndjson,.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>
<label class="encoding-picker">Text encoding (<code>--encoding</code>)
<select class="threshold-input" id="compareEncodingSelect">
<option value="auto" selected>Auto (BOM, else UTF-8)</option>
<option value="utf-8">UTF-8</option>
<option value="utf-16">UTF-16</option>
<option value="cp1252">Windows-1252 (cp1252)</option>
<option value="latin-1">ISO-8859-1 (latin-1)</option>
</select>
</label>
</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>
<label>Max categorical cardinality (<code>--max-categorical-card</code>)
<input type="number" class="threshold-input" id="compareMaxCategoricalCardInput" data-opt="max_categorical_card"
step="1" min="2" placeholder="20" inputmode="numeric">
</label>
<label>Max dimension groups (<code>--max-dimension-groups</code>)
<input type="number" class="threshold-input" id="compareMaxDimensionGroupsInput" data-opt="max_dimension_groups"
step="1" min="1" placeholder="50" inputmode="numeric">
</label>
<label>Max plausible age (<code>--max-age</code>)
<input type="number" class="threshold-input" id="compareMaxAgeInput" data-opt="max_age"
step="1" min="1" placeholder="120" inputmode="numeric">
</label>
<label>Birth-year reference (<code>--age-reference-year</code>)
<input type="number" class="threshold-input" id="compareAgeReferenceYearInput" data-opt="age_reference_year"
step="1" min="1900" placeholder="e.g. 2026" inputmode="numeric">
</label>
<label class="keywords-label">Extra column-name keywords (<code>--keywords</code>, JSON)
<textarea class="threshold-input keywords-input" id="compareKeywordsInput" data-opt-json="keywords" rows="2" aria-describedby="compareKeywordsError"
spellcheck="false" placeholder='{"sex": ["sesso"], "age": ["eta"]}'></textarea>
<span class="keywords-error" id="compareKeywordsError" role="alert" hidden></span>
</label>
<p class="keywords-restored" id="compareKeywordsRestored" hidden>Restored from your last session.
<button type="button" class="action-btn" id="compareKeywordsForget">Forget</button></p>
</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>
<button class="action-btn" id="compareCopyCliBtn" type="button" title="The faircode command that reproduces this comparison with the same options">⧉ Copy as CLI command</button>
<button class="action-btn" id="compareDownloadCsvBtn" type="button">⬇ Download CSV</button>
<label class="csv-provenance"><input type="checkbox" id="compareCsvProvenanceInput"> include provenance</label>
</div>
<section class="compare-results" id="compareResults" hidden></section>
<div class="proxy-hints-block" id="compareProxyHintsBlock" hidden>
<h3 class="section-title">Proxy-hint detection</h3>
<p class="section-note">
Opt-in chi-squared check, run separately on each dataset, for column pairs strongly
associated with each other. Informational only; it never affects either score.
</p>
<label class="proxy-alpha">Significance level (<code>--proxy-alpha</code>)
<input type="number" class="threshold-input" id="compareProxyAlphaInput" step="any" min="0" max="1" placeholder="0.05" inputmode="decimal">
</label>
<label class="proxy-alpha">Multiple-comparison correction (<code>--proxy-correction</code>)
<select class="threshold-input" id="compareProxyCorrectionInput">
<option value="">None</option>
<option value="bonferroni">Bonferroni</option>
<option value="holm">Holm</option>
</select>
</label>
<label class="proxy-exact-toggle">
<input type="checkbox" id="compareProxyExactInput"> Exact test for small cells (<code>--proxy-exact</code>)
</label>
<label class="proxy-exact-tuning">Shuffles (<code>--proxy-exact-permutations</code>)
<input type="number" class="threshold-input" id="compareProxyExactPermutationsInput" min="1" max="1000000" step="1"
placeholder="1000" inputmode="numeric" disabled aria-describedby="compareProxyExactError">
</label>
<label class="proxy-exact-tuning">Row cap (<code>--proxy-exact-max-rows</code>)
<input type="number" class="threshold-input" id="compareProxyExactMaxRowsInput" min="1" step="1"
placeholder="20000" inputmode="numeric" disabled aria-describedby="compareProxyExactError">
</label>
<span class="keywords-error" id="compareProxyExactError" role="alert" hidden></span>
<details class="proxy-heldout">
<summary>Test columns you already dropped (<code>--proxy-hints-with-a/-b</code>)</summary>
<p class="section-note">
Per dataset: a file that still has the dropped attribute (rows aligned 1:1 with that
dataset, or joined on a key column) and the column name. Add a row per dropped column.
</p>
<h4 class="proxy-hint-side">Dataset A</h4>
<div id="compareHeldOutRowsA"></div>
<button type="button" class="proxy-hints-btn" id="compareHeldOutAddA">+ Add another column (A)</button>
<h4 class="proxy-hint-side">Dataset B</h4>
<div id="compareHeldOutRowsB"></div>
<button type="button" class="proxy-hints-btn" id="compareHeldOutAddB">+ Add another column (B)</button>
</details>
<button type="button" class="proxy-hints-btn" id="compareProxyHintsBtn">Check for proxy columns</button>
<div id="compareProxyHintsResults" aria-live="polite"></div>
</div>
</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">seven bias audits</a> for the model side.</p>
</footer>
</main>
<script src="assets/profiler-engine.js"></script>
<script src="assets/profiler-shared.js"></script>
<script src="assets/profiler-heldout.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>