Skip to content

Commit 136b27c

Browse files
committed
Add pre-2024 diversity stats (2018 & 2022)
1 parent ac26352 commit 136b27c

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

apps/base/about.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
although some legacy content remains here.
66
"""
77

8+
import json
9+
810
from flask import (
911
redirect,
1012
render_template,
@@ -24,8 +26,18 @@ def branding():
2426
def page(page_name: str):
2527
return render_markdown(f"about/{page_name}", page_name=page_name)
2628

29+
2730
@base.route("/about/diversity/<int:year>")
2831
def yearly_diversity_stats(year: int):
32+
if year in (2018, 2022):
33+
with open(f"exports/{year}/public/UserDiversity.json", "r") as raw_data:
34+
data = json.load(raw_data)
35+
36+
return render_template(
37+
f"about/diversity/pre-2024-stats.html",
38+
year=year,
39+
data=data["diversity"],
40+
)
2941
return render_markdown(f"about/diversity/{year}")
3042

3143

templates/about/diversity.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ catalyst for a big change.
2424

2525
## The stats
2626

27+
* [2018](diversity/2018)
28+
* [2022](diversity/2022)
2729
* [2024](diversity/2024)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{% extends "about/template.html" %}
2+
{% block title %}Diversity stats {{year}}{% endblock %}
3+
{% block body %}
4+
{% macro stats_table(data, title) %}
5+
<h3>{{ title }}</h3>
6+
7+
{% set total = data.values() | sum %}
8+
<table class="table">
9+
<thead><tr>
10+
<th></th>
11+
<th>Count</th>
12+
<th>Percent of respondents</th>
13+
</tr></thead>
14+
<tbody>
15+
{% for category, count in data.items() %}
16+
<tr>
17+
<td>{{ category | capitalize }}{% if category == "" %}No response{% endif %}</td>
18+
<td>{{ count }}</td>
19+
<td>{{ (100 * count/total) | round | int }}%</td>
20+
</tr>
21+
{% endfor %}
22+
<tr>
23+
<th>Total</th>
24+
<td>{{ total }}</td>
25+
<td>{{ (100 * total/total) | round | int }}%</td>
26+
</tr>
27+
</tbody>
28+
</table>
29+
{% endmacro %}
30+
31+
<h2>Diversity stats for {{year}}</h2>
32+
33+
<h3>Note on limitations</h3>
34+
<p>This data is compiled from self reporting via free-text fields. Where obvious
35+
classification can be made it has been (e.g. for age '22' -> '15-24') but if such a
36+
classification cannot be made they've been grouped as 'other'.</p>
37+
38+
<p>All questions were optional so totals may not be consistent between categories.</p>
39+
40+
<p>Prior to 2024 there was no tracking of reviewer or speaker data.</p>
41+
42+
{{ stats_table(data["sex"], "Sex") }}
43+
{{ stats_table(data["ethnicity"], "Ethnicity") }}
44+
{{ stats_table(data["age"], "Age") }}
45+
46+
{% endblock %}

0 commit comments

Comments
 (0)