A simple GUI for stratification for sortition/citizens' assemblies.
Random stratified selection software.
The algorithms are described in this paper (open access).
Other relevant papers:
- Procaccia et al. Is Sortition Both Representative and Fair?
- Tiago c Peixoto
The app is built using eel - a framework that allows the GUI to be defined in HTML and CSS, but then some basic JavaScript can call Python and I can do the heavy lifting in Python.
First you need to have the following installed:
- git
- python 3.11 or 3.12
- a recent version of Chrome or Chromium
uv- see https://docs.astral.sh/uv/
When you first set up a development version, you need to clone this repo, open a terminal in the root of the repo and run:
uv run python script.pyAt this point you should have a window pop up and be able to interact with it, either via uploading .csv files or else by reading directly from a google sheet.
As you update the repo or want to re-run, the above command is all you need.
The python command python script.py requires only:
- script.py
- stratification.py
- all of the files in the folder web
To use uv (as we suggest above) to control dependencies, you need pyproject.toml
To create exectuables using pyinstaller (as we describe below), you need hook-mip.py to deal with this error.
You can download executables from the latest releases page. These are built by GitHub Actions.
If you want to make an executable yourself, use PyInstaller. The following set of commands, run in the root of the repo, create a single file executable in the folder dist.
git pull
uv run python -m eel script.py web --additional-hooks-dir=. --onefile --noconsoleThe resulting executable will work on any computer running the same operating system as yours, i.e. Windows, Mac OS or Linux. So if you run the above command on Linux, you can give the file to someone else running Linux. If the person who wants the app is running Windows, you need to run the above command on Windows.