Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"01": 7,
"04": 9,
"05": 4,
"06": 53,
"08": 7,
"06": 52,
"08": 8,
"09": 5,
"12": 27,
"12": 28,
"13": 14,
"15": 2,
"16": 2,
"17": 18,
"17": 17,
"18": 9,
"19": 4,
"20": 4,
Expand All @@ -42,7 +42,7 @@
"23": 2,
"24": 8,
"25": 9,
"26": 14,
"26": 13,
"27": 8,
"28": 4,
"29": 8,
Expand All @@ -51,20 +51,21 @@
"33": 2,
"34": 12,
"35": 3,
"36": 27,
"37": 13,
"39": 16,
"30": 2,
"36": 26,
"37": 14,
"39": 15,
"40": 5,
"41": 5,
"42": 18,
"41": 6,
"42": 17,
"44": 2,
"45": 7,
"47": 9,
"48": 36,
"48": 38,
"49": 4,
"51": 11,
"53": 10,
"54": 3,
"54": 2,
"55": 8
}
},
Expand Down
16 changes: 16 additions & 0 deletions packages/populace-build/src/populace/build/us_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
congressional_district_distribution_from_ledger_facts,
with_household_congressional_districts,
)
from populace.build.us_runtime.congressional_district_vintage import (
CONGRESSIONAL_DISTRICT_VINTAGE_CROSSWALK_SHA256_ATTR,
CONGRESSIONAL_DISTRICT_VINTAGE_TARGET_ATTR,
CURRENT_CONGRESSIONAL_DISTRICT_PREFIX,
CURRENT_CONGRESSIONAL_DISTRICT_VINTAGE,
SOURCE_CONGRESSIONAL_DISTRICT_PREFIX,
load_congressional_district_vintage_crosswalk,
translate_congressional_district_facts_to_current_vintage,
)
from populace.build.us_runtime.cps_carried import (
CPS_CARRIED_FORMULA_OWNED_COLUMNS,
CPS_CARRIED_PERSON_INPUTS,
Expand Down Expand Up @@ -133,7 +142,12 @@
"DEMOGRAPHICS_SCHEMA_VERSION",
"compute_age_distribution",
"CONGRESSIONAL_DISTRICT_GEOID_COLUMN",
"CONGRESSIONAL_DISTRICT_VINTAGE_CROSSWALK_SHA256_ATTR",
"CONGRESSIONAL_DISTRICT_VINTAGE_TARGET_ATTR",
"CURRENT_CONGRESSIONAL_DISTRICT_PREFIX",
"CURRENT_CONGRESSIONAL_DISTRICT_VINTAGE",
"SOI_CONGRESSIONAL_DISTRICT_RECORD_SET_ID",
"SOURCE_CONGRESSIONAL_DISTRICT_PREFIX",
"demographics_payload",
"write_demographics",
"US_DONORS",
Expand Down Expand Up @@ -175,6 +189,7 @@
"impute_us_puf_tax_detail_support",
"in_sample_reform_specs",
"load_default_reform_specs",
"load_congressional_district_vintage_crosswalk",
"load_asec_h5_tables",
"out_of_sample_reform_specs",
"puf_tax_unit_donor_from_arrays",
Expand All @@ -191,6 +206,7 @@
"support_clone_index_column",
"support_source_id_column",
"validation_only_family_ids",
"translate_congressional_district_facts_to_current_vintage",
"with_household_congressional_districts",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,12 @@ def _cd_geoid_series(values: Any) -> pd.Series:


def _parse_congressional_district_geoid(geography_id: str) -> str | None:
if not geography_id.startswith("5001700US"):
for prefix in ("5001700US", "5001900US"):
if geography_id.startswith(prefix):
geoid = geography_id.removeprefix(prefix)
break
else:
return None
geoid = geography_id.removeprefix("5001700US")
if len(geoid) != 4 or not geoid.isdigit():
return None
return geoid
Expand Down
Loading
Loading