coalition.stakeholders.spatial
Classes
Utility class for spatial queries related to stakeholders and districts |
Module Contents
- class coalition.stakeholders.spatial.SpatialQueryUtils[source]
Utility class for spatial queries related to stakeholders and districts
- static find_districts_for_point(point: django.contrib.gis.geos.Point) dict[str, coalition.regions.models.Region | None] [source]
Find all legislative districts containing a given point
- Parameters:
point – Geographic point to search for
- Returns:
Dictionary with district types as keys and Region objects as values
- static get_stakeholders_in_district(district: coalition.regions.models.Region, include_unverified: bool = False) list[coalition.stakeholders.models.Stakeholder] [source]
Get all stakeholders within a specific district
- Parameters:
district – Region object representing the district
include_unverified – Whether to include stakeholders with unverified emails
- Returns:
List of Stakeholder objects in the district
- static get_stakeholders_by_district_type(district_type: coalition.stakeholders.constants.DistrictType | str, state_filter: str | None = None) dict[str, list[coalition.stakeholders.models.Stakeholder]] [source]
Get stakeholders grouped by districts of a specific type
- Parameters:
district_type – Type of district (DistrictType enum or string)
state_filter – Optional state abbreviation to filter by
- Returns:
Dictionary with district names as keys and lists of stakeholders as values
- static find_nearby_stakeholders(point: django.contrib.gis.geos.Point, radius_miles: float = 10.0) list[coalition.stakeholders.models.Stakeholder] [source]
Find stakeholders within a radius of a given point
- Parameters:
point – Center point for search
radius_miles – Search radius in miles
- Returns:
List of nearby Stakeholder objects, ordered by distance
- static get_district_statistics() dict[str, dict] [source]
Get statistics about stakeholder distribution across districts
- Returns:
Dictionary with district types and their stakeholder counts
- static get_unassigned_stakeholders() list[coalition.stakeholders.models.Stakeholder] [source]
Get stakeholders who have coordinates but haven’t been assigned to districts
- Returns:
List of Stakeholder objects needing district assignment