Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check area name validity using number of 118th Congressional districts #276

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tmd/areas/create_area_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def valid_area(area: str):
# Census on which Congressional districts are based:
# : cd_census_year = 2010 implies districts are for the 117th Congress
# : cd_census_year = 2020 implies districts are for the 118th Congress
cd_census_year = 2010
cd_census_year = 2020
# data in the state_info dictionary is taken from the following document:
# 2020 Census Apportionment Results, April 26, 2021,
# Table C1. Number of Seats in
Expand Down Expand Up @@ -124,6 +124,13 @@ def valid_area(area: str):
total[2020] += seats[2020]
assert total[2010] == 435
assert total[2020] == 435
compare_new_vs_old = False
if compare_new_vs_old:
text = "state,2010cds,2020cds"
for state, seats in state_info.items():
if seats[2020] != seats[2010]:
print(f"{text}= {state} {seats[2010]:2d} {seats[2020]:2d}")
sys.exit(1)
# conduct series of validity checks on specified area string
# ... check that specified area string has expected length
len_area_str = len(area)
Expand Down
Loading