Analysis of NC census and elections data to identify areas of low minority voter turnout.
- Clone the repo
$ git clone https://github.com/14-cities/WakeVoter.git
- Install requirements with
$ pip install -r reqs.txt
(NOTE: it is heavily encouraged to do this in a virtual environment) - Request an (API key)[https://api.census.gov/data/key_signup.html] from the US Census
- When the key arrives in an email, copy and paste it into a file called
APIkey.txt
at the root of WakeVoter - To run the applicaiton, start a new Python shell session and import the
VoteSqaud.py
file$ python
>>> import VoteSquad.py
-
On Mac OS X, if you get the error
OSError: Could not find libspatialindex_c library file
you may need to run$ brew install spatialindex
to get rtree working properly. See this GitHub issue -
On Ubuntu 18.04, if you get the missing libspatial error,
$ apt install libspatialindex-c4v5 libspatialindex-dev libspatialindex4v5
or justapt install python3-rtree
and it will pull those in as dependencies.
- https://www.ncsbe.gov/data-stats/other-election-related-data
- Voter Registration Data By County >
- Block features with population & housing data
- Demographic data
- https://factfinder.census.gov/faces/nav/jsf/pages/searchresults.xhtml?refresh=t
- Geographies:
- All geographic types
- Geographic type:
.... .... .... Block - 100
- Geographic vintage:
2010
- State:
North Carolina
- County:
Wake
- Census tract:
- Select one ore more
- Topics:
- P1: Race
- P10: Race for population 18 and over
Address points
- https://s3.amazonaws.com/dl.ncsbe.gov/ShapeFiles/list.html
- https://dl.ncsbe.gov/index.html?prefix=ShapeFiles/
- https://s3.amazonaws.com/dl.ncsbe.gov/ShapeFiles/address_points_sboe.zip
-
Pull the voter data from the NC SBE servers and subset for the selected county:
- Manually download the Statewide Voter Registration and Statewide Voter History data sets to a local folder.
- Will be replaces with code to download files from NCSBE servers...
- Manually download the Statewide Voter Registration and Statewide Voter History data sets to a local folder.
-
Run
get_county_voter_registration_file
to retrieve/build a county level registration csv file.- Run
get_county_voter_history_file
to retrieve/build a county level registration csv file from the state file. - Run
get_address_data()
to pull NC Address Points data file to a local folder.
- Run
-
Assemble a feature class of voting points for the county
- Run
get_voter_data()
to select voting records for a specific county and assemble them into a shapefile.- This uses the address file to attach coordinates to voter registration data
- Run
- Obtain block feature dataset and attribute dataset, subset for Wake Co.
- Join attributes to features and isolate block features with > 50 black voters
- Tag block features with voting precincts
- Extract voting registration and history data for Wake Co.
- Geocode voter registration data
- Tally the number of elections voted in for each voter registration & join to geocode data
- Spatially join voting registration data with census blocks & precinct information
- Compile list of super voters within each block (voters in all elections)
- Compile list of low propensity voters within each block
- Identify contiguous blocks, within precincts, and tally low propensity voters
- Assign super voters for each 100 low propensity voters in contiguous blocks.