Redistricting Analytics in Python

This repository (rdapy) re-implements the main analytics used in Dave’s Redistricting (DRA), 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 to make them easier to use outside of DRA.

There are both a PyPi package and a command-line interface.

Package

The analytics in the PyPi package are organized by area (in alphabetical order):

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.

Command-Line Interface

The command-line interface uses the package and enables high-volume offline scoring. This toolchain uses DRA GeoJSON and graph files in the dra2020/vtd_data GitHub repository. as input data and scores each plan in an ensemble or collection on several dozen metrics described in Scores (Metrics) generating a CSV file with one row of scores per plan.

There are some housekeeping scripts to support this scoring:

Installation

For installation instructions, see the README.

Questions

Email questions to feedback.