Redistricting analytics in Python
This repository (rdapy) re-implements the main analytics used in Dave's Redistricting, ignoring a few DRA-specific aspects (in particular, the five [0-100] ratings). Unlike the analytics used in the app (dra-analytics) which are implememented in TypeScript, these are implemented in Python.
The analytics are organized by area:
- Compactness: Various measures of compactness
- Equal: Population deviation
- Graph: Checks for contiguity & embeddedness
- Minority: Minority opportunity metrics
- Partisan: Various measures of partisan bias & responsiveness, as well as support for rank-vote graphs and seats-votes curves
- Splitting: County- & district-splitting and COI splitting
The samples
directory contains some simple examples of how to exercies these functions
and how to preprocess raw block-level data into the formats required by the analytics.
pip install rdapy
import rdapy
pytest
Email questions to feedback.