LGA-level security risk forecast for Nigeria β FastAPI + PostGIS backend, Next.js choropleth frontend
# π³π¬ Naija Security Forecast
A "weather forecast for security" β a live, LGA-level risk dashboard for Nigeria that fuses historical incident data, news sentiment, and statistical trend models into a choropleth map anyone can read at a glance.
---
## What it does
| Feature | Detail |
|---|---|
| **Choropleth map** | All 775 Nigerian LGAs coloured LOW β MODERATE β HIGH β SEVERE |
| **Timeline slider** | Slide from β3 days (historical) through today to +3 days (forecast); scores use trend velocity + news sentiment decay |
| **Incident type filters** | Kidnappings, school abductions, jihadist attacks, bombings, banditry, riots, protests, and more |
| **Live news feed** | Scrapes 10 Nigerian RSS sources; NLP classifies security relevance and sentiment |
| **State rankings** | Left sidebar ranks all 36 states + FCT by average risk score |
| **LGA detail panel** | Click any LGA on the map for a full score breakdown |
---
## Architecture
```
naija-security-forecast/
βββ app/
β βββ api/routes/ # FastAPI routers (risk, news, incidents, filters)
β βββ core/ # DB engine, settings
β βββ models/ # SQLAlchemy ORM (LGA, Incident, NewsArticle, RiskScore)
β βββ schemas/ # Pydantic v2 response schemas
β βββ services/
β β βββ acled_client.py # ACLED API client (email + access_key auth)
β β βββ acled_sync.py # Historical incident sync (from 2010)
β β βββ forecaster.py # 7-day statistical forecast engine
β β βββ lga_matcher.py # Fuzzy LGA name β PostGIS point-in-polygon matcher
β β βββ news_pipeline.py # Scrape β NLP β upsert pipeline
β β βββ nlp.py # Keyword NLP: security classification + sentiment
β β βββ rss_scraper.py # feedparser scraper for 10 Nigerian news sources
β β βββ scorer.py # Composite risk scoring engine
β βββ workers/ # Celery tasks + beat schedule
βββ alembic/ # DB migrations
βββ scripts/ # Manual t β¦