Skip to main content

UT_GerryChain

This project uses GerryChain to generate neutral redistricting ensembles for Utah.

Data Files

The project works with any data/*.geojson file (UT_blocks.geojson, UT_vtds.geojson, UT_vtd_parts.geojson). All files must contain:

  • TOTPOP: Total population column
  • MUNIID: Municipality ID column
  • COUNTYID: County ID column
  • Additional COI (Communities of Interest) columns as needed

Configure neutral sampling in notebook

Use 01_configure_sampling.ipynb to:

  • Configure neutral parameters (no partisan metrics)
  • Configure transitability analysis (road connectivity and water barriers)
  • Run a short neutral sample for sanity checks
  • Export a YAML configuration to results/configurations/sampling_params.yaml

Transitability Analysis

UT_GerryChain now includes transitability analysis to ensure districts are connected by actual roads and not separated by impassable barriers. This implements Utah's requirement for "ease of travel throughout district" by:

  1. Road Connectivity: Verifying that precincts are connected by actual road networks
  2. Hierarchical Fallback: For rural areas with only local roads, fall back to municipality/county boundaries
  3. Water Barriers: Remove connections that cross major water bodies (Great Salt Lake, Lake Powell, etc.)

Data Requirements

You can now build the transitability graph offline from the original geography sources and load it at runtime.

Offline preprocessing (recommended)

Build once and reuse:

Transitability analysis uses edge penalties to discourage districts that aren't well-connected by roads. The transitability CSV file (e.g., data/transitability/precinct_no_roads.csv) can be generated by an external pipeline and should contain edge pairs (u, v) that should be penalized.

If the transitability CSV file is not found, the code will skip edge penalties with a warning.

Configuration

Transitability can be configured in the notebook or YAML:

transitability:
  enable: true
  remove_water_barriers: true
  verify_road_connectivity: true
  precomputed_path: data/transitability/transitability.graphml
  min_lake_size_sqkm: 1.0
  min_river_size_sqkm: 0.5
  road_buffer_meters: 500
  water_threshold: 0.5

Running Ensembles

Using Notebooks (Recommended)

  1. Configure sampling: Use 01_configure_sampling.ipynb to set up parameters and test with a small sample
  2. Run full ensemble: Use 02_run_ensemble.ipynb to load the configuration and run a full ensemble

Column Names

The geojson files use the following column names for Communities of Interest:

  • HIGHEREDID: Institutions of higher education
  • AIANNHID: American Indian/Alaska Native Areas (formerly RESERVATION_ID)
  • MILITID: Military installations (formerly MILITARY_ID)
  • CBSAID: Core Based Statistical Areas / Metro areas (formerly METRO_ID)
  • SCHDISTID: School districts

Note: WATER_ID and BASIN_ID are no longer used.

Metadata

Release files for utgc 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for utgc 0.1.2
File Size Uploaded Provenance Actions
utgc-0.1.2.tar.gz 58.7 kB Without provenance Details for utgc-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for utgc 0.1.2
File Interpreter ABI Platform Actions
utgc-0.1.2-py3-none-any.whl Python 3 none any Details for utgc-0.1.2-py3-none-any.whl

Total release size: 110.0 kB

Release files / utgc-0.1.2.tar.gz

Download URL utgc-0.1.2.tar.gz
Size 58.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7e16edda724f5a9d772e5ec0a2c2d994d7993b87b87c69552ef60ec165035298
BLAKE2b-256 checksum
How to use checksums
1438473024f67d543b5ca2f7a2f71f9a385f3a2c2759ba93b20e5bab1fdeb032
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / utgc-0.1.2-py3-none-any.whl

Download URL utgc-0.1.2-py3-none-any.whl
Size 51.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
341b37bb429d171776514b20913703eaca6f786e0e654a580084576d5017e65d
BLAKE2b-256 checksum
How to use checksums
25b3cf09fc393606c765022a113ece1b98362ba698666b0abde49795c16e3a78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for utgc 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page