Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Andrew Friedman
/
Fairly Draw Election Districts
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7a88c0de
authored
Apr 11, 2017
by
Andrew Friedman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating README
parent
b5a7d07f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
README.md
README.md
View file @
7a88c0de
Description of Project:
In our project, we seek to apply the concept of the efficiency gap to
create an algorithm that will not only be able to analyze existing
districting plans but develop new, fairer districts. We plan to write a
program that can create a set of hypothetical district boundaries and map
the one with the lowest efficiency gap to a map of the state.
Efficency Gap:
In their paper “Partisan Gerrymandering and the Efficiency Gap,”
Nicholas Stephanopoulos and Eric McGhee analyze the efficiency gap as
a new measure of the severity of gerrymandering. Simply put, the
efficiency gap measures the difference in “wasted votes” by Republicans
and Democrats in all the districts in a state. The efficiency gap can
also be understood as the difference between the percentage of votes
that a party receives and the percentage of seats it receives in
the legislature.
Notes about Commits:
The commits that say Anne Rogers were students committing from their
Virutal Machines.
Before Preceeding Please run:
git fetch - all
sudo pip3 install pyshp
Use the following link to download the census tract data and place it in a directory in read_shpaes called Census_tract
http://www2.census.gov/geo/tiger/TIGER2010DP1/Tract_2010Census_DP1.zip
algorithms directory:
algorithms.py contains all the functions for constructing district plans by utilizing
the efficiency gap
__name__=="__main__" Function works if no specialization is needed
if specialization is needed
RUN using python 3
[
1
]
completed_result(state, initial_percent_of_people=60, goal=5,
special_name='', better=False)
drawing.py (must be run using Python2) creates a basemap of the United States and maps color-
coded tracts (the color corresponding to their district) onto the basemap using Networkx
Run the function in the terminal as follows:
python2 state_name
ie.
Python 2
Colors.csv contains numbers and colors for drawing.py
./demo.sh contains basic shell script
FOR EASY RUN USE ./demo.sh State
if State is two words it should be first_second
reading_shapes directory:
get_combined.py contains functions to convert shapefiles of census tracts, determine which tracts
are connected to each other, and analyze demographic data to estimate the number of Republicans and Democrats in each district
RUN:
[
1
]
get_shapeRecs(shapefile_path),
[
2
]
create_state_tracts(shapeRecs)
location_api.py uses the GPS coordinates of census tracts to determine which state they are in
and sorts them accordingly, using the LocationIQ API
RUN:
[
1
]
get_shapeRecs(shapefile_path),
[
2
]
create_state_tracts(shapeRecs)
state_set_json_files contains the sets of all items in a state
state_tracts_full_json_files contains the completed tract dictionaries created by get_combined.py
state_num.csv contains the state and number of districts
tracts1.json JSON file for helping location_api.py fun
tract.py example of tract dict
util.py contains helper functions for reading and writing CSVs, JSON, and pickle files
state_runs contains the partially completed tracts as dictionaries created by
location_api.py
Census_tract contains Census tract files
test_files contains files orginally used for testing
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment