Git Product home page Git Product logo

karnwaltushti / is-my-district-gerrymandered Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeffreyshen19/is-my-district-gerrymandered

0.0 0.0 0.0 10.07 MB

Data visualization project that determines how gerrymandered a congressional district is. MA-6 Congressional App Challenge Winner.

Home Page: http://ismydistrictgerrymandered.us

License: Creative Commons Zero v1.0 Universal

JavaScript 60.13% CSS 10.32% HTML 29.55%

is-my-district-gerrymandered's Introduction

Is My District Gerrymandered?

Donate

This is a project that estimates how likely a congressional district is gerrymandered based on its geographical compactness, voter wastage, and redistricting control. It was last updated for the 115th US Congressional districts (2016 election).

Check it out at ismydistrictgerrymandered.us.

Screenshot of the app

How does it work?

This project determines whether a district is gerrymandered based on 3 factors:

  1. Geographical Compactness: Basically, how compact is the district? It is more likely that a district is gerrymandered if it has an odd shape and a lot of small tendrils than if it is more regular. While this isn't necessarily a perfect gauge of gerrymandering, it can be a decent proxy. Geographical compactness is calculated using the Polsby-Popper method: dividing the area of the district by the area of a circle with the same perimeter. I used QGIS to calculate compactness.

    • What is an "acceptable" level of compactness? This project determines that a district is compact if its Polsby-Popper score is higher than 0.287. This is the 50th percentile of compactness for a sample of present and past congressional districts.
  2. Voter Wastage: Gerrymandering can essentially be done in two ways: "Packing", which crams all the voters of one party into a few districts to eliminate a majority, or "Cracking", which spreads the voters of one party into a lot of districts so they don't have a majority in any district. By calculating the number of wasted votes (the number of votes above the threshold to win, and all the votes of the losing party) for each party, we can determine if there is are more votes wasted for a specific party, a good indicator of partisan gerrymandering. Specifically, we measure voter wastage using the "efficiency gap", which you can read more about here.

    • An acceptable amount of voter wastage is less than a 2 seat efficiency gap
    • The efficiency gap is calculated with only Republican and Democrat candidates, and it is assumed the opponent would have won 25% of the vote in uncontested districts.
  3. Redistricting Control: How are district lines drawn by state? In most states, the state legislatures, or other elected officials primarily draw district lines. This can potentially be biased, as members of one party will be drawing the district lines which can influence the election of members of their own party. Some state legislatures split redistricting control between both parties, mitigating some amount of partisan bias. Even better, a few states use independent, bipartisan commissions to draw district lines. Thus, how likely a redistricting process is to be biased is factored into our assesment.

To specifically determine whether a district is gerrymandered, a "gerrymander_score" is calculated internally in data/generate_csv.js. If this score is greater than 50, the district is gerrymandered. If a state has less than or equal to 6 districts, it is unlikely to be gerrymandered, and those districts' gerrymander scores are set to 0. Otherwise, 75% of this score is from the geographical compactness of the district and 25% of the score is from the efficiency gap of the state the district is in. Though both equally important, the efficiency gap score is slightly de-emphasized because it is a state-level calculation, whereas compactness applies to individual districts. Additionally, redistricting control can only help the score, meaning that the gerrymander score is reduced if the state redistricts using a bipartisan independent commission. Having a biased redistricting process does not necessarily mean a gerrymandered district. However, having a bipartisan, independent redistricting process significantly reduces the chance of a gerrymandered district.

Table of Contents

  • index.js: the main file which hosts the webserver.
  • views/: all of the webpages stored here.
  • public/: all of the frontend code is stored here.
  • data/:
  • generate_csv.js: This file generates the master.csv, which contains all the data, for all the districts.
  • generate_efficiency.js: This file generates efficiency.csv, which contains information on voter wastage.
  • generate_geographical_compactness.js: This file generates compactness.csv, which contains the Polsby-Popper score for each district.

Disclaimer

This project was created solely out of curiosity: I had heard a lot about partisan gerrymandering, and wanted to know if my district could be gerrymandered. It was not created out of political reasons: The project does not support any one party, but just displays the data collected. In the spirit of transparency, all of the source code used for this project is in this repository, and all of the datasets used are listed below.

Issues?

Please submit an issue, or contact me at [email protected] if you believe you have found an error with this tool.

Credits

This project was written by Jeffrey Shen, a current student at Phillips Academy. I received some assistance from Varun Roy and Bill Qin.

Datasets used

Built With

  • QGIS: Used to calculate geographical compactness.
  • Leaflet and Mapbox: Used to display a map of each congressional district.
  • Geocoder: Used for converting an address into longitude and latitude, so it can later be converted into a congressional district.

General Sources

These were all the articles, books, etc. that I read to better help me understand gerrymandering:

License

This project is licensed under the CC0 License -- See the LICENSE file for more info.

is-my-district-gerrymandered's People

Contributors

jeffreyshen19 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.