Logo Lanfrica

m-eze/naija-security-forecast

Domain:

peace and securitygeospatial

Record type:

softwaremodel
Creator:
m-e
Host:
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 …