ZIP lookup (GET /api/members/by-zip/{zip}):
- Two-step geocoding: Nominatim (ZIP → lat/lng) then Census TIGERweb
Legislative identify (lat/lng → congressional district via GEOID)
- Handles at-large states (AK, DE, MT, ND, SD, VT, WY)
- Added rep_lookup health check to admin External API Health panel
congress_api.py fixes:
- parse_member_from_api: normalize state full name → 2-letter code
(Congress.gov returns "Florida", DB expects "FL")
- parse_member_from_api: read district from top-level data field,
not current_term (district is not inside the term object)
Celery beat: schedule sync_members daily at 1 AM UTC so chamber,
district, and contact info stay current without manual triggering
Members page redesign: photo avatars, party/state/chamber chips,
phone + website links, ZIP lookup form to find your reps
Draft letter improvements: pass rep_name from ZIP lookup so letter
opens with "Dear Representative Franklin," instead of generic salutation;
add has_document filter to bills list endpoint
UX additions: HelpTip component, How It Works page, "How it works"
sidebar nav link, collections page description copy
Authored-By: Jack Levy
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
from functools import lru_cache
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
# URLs
|
|
LOCAL_URL: str = "http://localhost"
|
|
PUBLIC_URL: str = ""
|
|
|
|
# Auth / JWT
|
|
JWT_SECRET_KEY: str = "change-me-in-production"
|
|
JWT_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
|
|
|
|
# Database
|
|
DATABASE_URL: str = "postgresql+asyncpg://congress:congress@postgres:5432/pocketveto"
|
|
SYNC_DATABASE_URL: str = "postgresql://congress:congress@postgres:5432/pocketveto"
|
|
|
|
# Redis
|
|
REDIS_URL: str = "redis://redis:6379/0"
|
|
|
|
# api.data.gov (shared key for Congress.gov and GovInfo)
|
|
DATA_GOV_API_KEY: str = ""
|
|
CONGRESS_POLL_INTERVAL_MINUTES: int = 30
|
|
|
|
# LLM
|
|
LLM_PROVIDER: str = "openai" # openai | anthropic | gemini | ollama
|
|
|
|
OPENAI_API_KEY: str = ""
|
|
OPENAI_MODEL: str = "gpt-4o"
|
|
|
|
ANTHROPIC_API_KEY: str = ""
|
|
ANTHROPIC_MODEL: str = "claude-opus-4-6"
|
|
|
|
GEMINI_API_KEY: str = ""
|
|
GEMINI_MODEL: str = "gemini-2.0-flash"
|
|
|
|
OLLAMA_BASE_URL: str = "http://host.docker.internal:11434"
|
|
OLLAMA_MODEL: str = "llama3.1"
|
|
|
|
# Google Civic Information API (zip → representative lookup)
|
|
# Free key: https://console.cloud.google.com/apis/library/civicinfo.googleapis.com
|
|
CIVIC_API_KEY: str = ""
|
|
|
|
# News
|
|
NEWSAPI_KEY: str = ""
|
|
|
|
# pytrends
|
|
PYTRENDS_ENABLED: bool = True
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
|
|
settings = get_settings()
|