gender-balance
gender-balance copied to clipboard
'Report' page on Completed countries
Currently, when we already have gender data for everyone in a country, it's not possible to play any more:
Rather than simply showing an 'in place' report on the breakdown for the country (which doesn't always display correctly), we should link through to a page that gives more detail about that.
This page should:
- Show what the total breakdown is for the country (737 men / 156 women)
- If we know data from multiple terms, show how that has changed over time
- When there is more than one political party/group represented, show the gender breakdown for each of those.
NB: This page should be visible without being logged in.
This is a first step towards #329. We will want to very quickly evolve it into a version that applies everywhere, but for now it will only work for countries that are 'complete'.
NB: These stats should be based on the complete data, from EP, rather than any of the data in GB itself: this is a report on what we know about the country, no matter where that data came from.
The first working version of this can probably just calculate the report on request from the information in the database. If that turns out to be too slow, we can roll that up at the same time as we update the database from a webhook. (Or even move that calculation out of band, by building a "gender stats report" similar to how @davewhiteland did the EP-wide names.csv
file, and pulling the relevant summary data from that into GB for these pages).
Note to self: If this involves linking to the report page from the "completed" card in the country list, then we should also fix https://github.com/everypolitician/gender-balance/issues/322 while we're in the vicinity.
My plan for generating the summary data:
- create a gender-balance-country-stats (GBCS) heroku app that does the stats generation
- GBCS will be triggered by everypolitician-data webhooks for merged PRs
- If the PR contains updated data from GenderBalance (i.e. an updated file in data/$assembly/sources/gender-balance) then process the CSV
- Use the CSV to update a JSON file that contains summary stats for all assemblies.
- Commit the JSON file to the gender-balance-country-stats repository in a new branch and create a PR.
For simplicity GB will initially just pull the file in from GitHub and cache it (waves hands).
@struan: the stats should be EveryPolitician stats on Gender — not Gender-Balance stats (i.e it should include stats for countries where we got the data from, say, the official site, and didn't need to get people to play Gender-Balance for them).
Commit the JSON file to the gender-balance-country-stats repository in a new branch and create a PR.
Our normal approach to this is to just commit them directly to the gh-pages
branch, rather than triggering a PR.
This was half-done in #337. Midway down that PR there's a list of things that still need done — we should pull those out into separate tickets.