nprapps / elections24-general

Other
0 stars 0 forks source link

County results: Show township-level instead of county-level for New England states #8

Open alykat opened 8 months ago

alykat commented 8 months ago

Exploratory

Implementation


New England states:

Related new AP API attribute that might be useful:

Township FIPS Code For New England states, the new townFIPSCode field in JSON indicates the township FIPS code of a reporting unit.


Background

Ticket ported over from the primaries rig:

Cities/towns may be more meaningful, and the maps are more granular. Noted in the API docs — pulling RU rather than FIPS might get us there?

Results by Reporting Unit This example (in XML and JSON) shows results by reporting unit for the primary races for Governor in Vermont. Since the level=ru parameter is specified in the request, the response includes results for both the specified state (Vermont) and each of the reporting units within this state (cities and towns in this example since Vermont is a New England state). Note that in addition to the reporting unit ID, the county FIPS code is also reported for each New England city or town, so that you can aggregate results to the county level.

Results by FIPS Code This example (in XML and JSON) shows results by FIPS code for the primary races for Governor in Vermont. Since the level=fipscode parameter is specified in the request, the response includes results for both the specified state (Vermont) and each of the county FIPS codes (city/town results aggregated to the county level in this example since Vermont is a New England state).

Realistically, this is more a thought for the general than the primaries, but putting it here for now.

AP documentation on mapping townships between the old counties and the new planning regions

Township-to-county crosswalk documentation from the Census Bureau

alykat commented 1 day ago

About the township maps:

generated maps all live in: src/assets/synced/towns/STATE_POSTAL.svg

individual town paths have an ID that follows the pattern "fips-STATEFIPS-COUNTYFIPS-COUNTYSUB" (so id="fips-09-140-04930") to match the pattern used by the township census data. we can update the script to use a different identifier later.