Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
houseofreps
implements apportionment methods for assigning seats in the US House of Representatives.
Disclaimer: This product uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau. See Terms of Service.
Years supported:
1960, 1970, 1980, 1990, 2000, 2010, 2020
A detailed explanation of the current house seat apportionment algorithm can be found here: https://www.census.gov/topics/public-sector/congressional-apportionment/about/computing.html.
The data source is from https://www.census.gov and is completely described in the data folder.
Local installation: clone the repo, then:
pip install -r requirements.txt
pip install -e .
Tests are implemented for pytest
. In the tests
folder run:
pytest
It's fascinating to understand how seats in the US House of Representatives are assigned. Before this project, I had never thought about this problem:
What can we do?
A detailed explanation of the current house seat apportionment algorithm can be found here: https://www.census.gov/topics/public-sector/congressional-apportionment/about/computing.html. Every 10 years, the number of seats is assigned based on the latest census data (most recently: 2020).
For completeness, the description of algorithm is copied here from https://www.census.gov/topics/public-sector/congressional-apportionment/about/computing.html, with some comments:
The method assigns seats in the House of Representatives according to a "priority" value. The priority value is determined by multiplying the population of a state by a "multiplier."
Let P represent a state's total population. This already has questions, particularly regarding overseas service members, who excluded from the population counts in 1980 following the Vietnam war.
All states start by receiving 1 seat. A state cannot receive less than one seat.
Next, let n represent the number of seats a state would have if it gained a seat (because all states automatically received one seat the next seat gained is "seat two," and the next "seat three," and the next "seat four," and so on.)
Now define the multiplier:
1/sqrt(n*(n-1))
[which is called the reciprocal of the geometric mean].
Thus the formula for calculating the multiplier for the second seat is:
1 / sqrt(2(2-1)) ~ 1/1.414213562 ~ 0.70710678
and the third seat is
1 / sqrt(3(3-1)) ~ 1/2.449489743 ~ 0.40824829
Once the "multipliers" have been calculated, the next step is to multiply this figure by the population total for each of the 50 states (the District of Columbia is not included in these calculations). The resulting numbers are the priority values.
Once you've calculated priority values for the total number of potential seats for each state, the next step is to rank and assign seat numbers to the resulting priority values starting with seat 51, until all 435 seats have been assigned (remember, each state automatically received one seat). Next, tally the number of seats for each state to arrive at the total number of seats in the House of Representatives apportioned to each state.
FAQs
Apportionment of representatives in U.S. House of Representatives.
We found that houseofreps demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.