How khuenlm/the-12th-man works
The Twelfth Man is a World Cup referee-bias visualization project. Its user-facing result is an interactive D3 experience presenting four views: confederation-pairing card averages, same- versus cross-confederation card distributions and a statistical test, bias trends over time, and match-level high-stakes comparisons. Python export scripts prepare visualization data from processed match and booking data; a separate analysis script tests the distribution difference. The excerpts support exporter input/output relationships, but do not show the page wiring or D3 data-loading calls, so those connections are omitted.
Main entry points: viz Visualization JSON · processed Processed match data · export_beeswarm.py Distribution export · export_heatmap.py Heatmap export
Components 12
Dataset
- World Cup data
data/raw - Processed match data
data/processed - Visualization JSON
data/viz
Data Preparation
- Distribution export
src/export_beeswarm.py - Heatmap export
src/export_heatmap.py - Timeline export
src/export_timeline.py - Match comparison export
src/export_strip.py - High-stakes export
src/export_notorious.py
Statistical Analysis
- Distribution test
src/mannwhitneyu.py
Visualization Experience
- D3 visualization suite
d3_viz.js - Tab navigation
nav_function.js - Link tooltips
tip_function.js
Connections 12
- Distribution export → Processed match data: reads bookings
src/export_beeswarm.py - Distribution export → World Cup data: reads teams
src/export_beeswarm.py - Distribution export → Visualization JSON: writes distribution
src/export_beeswarm.py - Heatmap export → Processed match data: reads bookings
src/export_heatmap.py - Heatmap export → Visualization JSON: writes heatmap
src/export_heatmap.py - Timeline export → Processed match data: reads bookings
src/export_timeline.py - Timeline export → Visualization JSON: writes timeline
src/export_timeline.py - Match comparison export → Processed match data: reads match data
src/export_strip.py - Match comparison export → Visualization JSON: writes comparisons
src/export_strip.py - High-stakes export → Processed match data: reads match data
src/export_notorious.py - High-stakes export → Visualization JSON: writes spotlight
src/export_notorious.py - Distribution test → Visualization JSON: reads distribution
src/mannwhitneyu.py