World records by country
CountryCounts all-time WRs by competitor nationality (unlike current_world_records_by_country which counts only currently held). One cuber improving their own WR 5 times = 5 WRs; one single + one average WR = 2.
Ships with a per-year cumulative timeline — used by /globe WR choropleth + year slider, and the year slider on the /wca/world_records_by_country page itself.
By the numbers
YEAR(start_date)
Year bucketing
Based on comp start date
single + average
WR counting
Up to 2 WRs per row
years[]
Dense year axis
Empty years held as placeholders
cumulative{}
Cumulative dense array
One years.length array per country
Data source
SQL GROUP BY country.id, year, SUM(IF(... = WR, 1, 0)) counts WRs. toJson() post-processing: convert sparse (country, year, count) rows into a dense cumulative: {country: number[]} — index i corresponds to years[i] cumulative.
years[] spans minYear .. current year; empty years still take a slot to keep the timeline contiguous.
sql
SELECT country.name AS country,
YEAR(comp.start_date) AS year,
SUM(IF(regional_single_record = 'WR', 1, 0)
+ IF(regional_average_record = 'WR', 1, 0)) AS wrs
FROM results
JOIN competitions comp ON comp.id = results.competition_id
JOIN countries country ON country.id = results.country_id
WHERE regional_single_record = 'WR' OR regional_average_record = 'WR'
GROUP BY country.id, year
ORDER BY year, country.nameAlgorithm / pipeline
1
Filter WR-only rows
WHERE regional_single_record = WR OR regional_average_record = WR — drops NR / CR / blank.2
Bucket by (country, year)
YEAR(comp.start_date) for year; SUM both IF columns — single + average on same row contribute 2.3
Derive dense years[]
JS computes
minYear and pushes year by year up to current; empty years stay 0.4
Cumulative scan
Per country,
cum += byYear.get(y) ?? 0, yielding N-year cumulative sequence.5
Main rows = final-year total
rows = cumulative.map(arr => arr[last]), sorted desc + country name tiebreak; countries with 0 filtered out.Caveats & edges
- Historical WR markers don't get removed when broken — this is "ever-WR" count, so every entry in an event's WR evolution feeds the total.
- Country = competitor nationality at time of record (
result.country_idat-time); changing nationality doesn't reattribute old WRs. - WCA dump treats record markers as "did this break the WR" (ties both tagged); so tied WRs credit 2 countries each +1.
/globemapscumulativeframe-by-frame onto a choropleth — time slider replays 1982 → today WR concentration.