coalition.stakeholders.services

Attributes

logger

Classes

GeocodingService

Service for geocoding addresses and assigning legislative districts

Module Contents

coalition.stakeholders.services.logger[source]
class coalition.stakeholders.services.GeocodingService[source]

Service for geocoding addresses and assigning legislative districts

nominatim[source]
geocode_address(street_address: str, city: str, state: str, zip_code: str) django.contrib.gis.geos.Point | None[source]

Geocode an address using PostGIS Tiger geocoder first, then fall back to Nominatim if needed

assign_legislative_districts(point: django.contrib.gis.geos.Point) dict[str, coalition.regions.models.Region | None][source]

Find congressional and state legislative districts for a given point using spatial queries

geocode_and_assign_districts(stakeholder: coalition.stakeholders.models.Stakeholder, update_fields: bool = True) bool[source]

Geocode stakeholder address and assign legislative districts Assumes all stakeholders have complete addresses

Returns:

True if geocoding and district assignment succeeded, False otherwise