# Dot Swahili API
Production-ready MVP backend for an East Africa farmer early-warning platform. The system collects weather forecasts, evaluates farmer-specific risk, sends short bilingual SMS alerts, ingests SMS feedback, stores hyper-local field observations, and provides a simulation dashboard for demo and testing.
## Stack
- Python 3.12
- FastAPI + OpenAPI docs
- PostgreSQL
- SQLAlchemy 2.0 async
- Alembic migrations
- Pydantic v2
- APScheduler
- httpx
- Docker + docker-compose
- pytest
## Features
- Farmer CRUD API with E.164 validation and coordinate normalization
- Weather provider abstraction with Visual Crossing implementation and FASTA adapter stub
- Alert engine with rainfall, drought, heat, and storm evaluation
- Duplicate alert suppression using a configurable cooldown window
- SMS provider abstraction with mock provider and Twilio-ready structure
- Idempotent inbound SMS webhook handling
- Structured feedback parsing for English and Swahili replies
- Simulation event pipeline with delayed trigger and SMS countdown testing
- HTML demo dashboard at `/dashboard/`
- Structured JSON logging, health checks, readiness checks, and rate limiting
## File Tree
```text
.
├── .env.example
├── Dockerfile
├── README.md
├── alembic.ini
├── docker-compose.yml
├── pyproject.toml
├── alembic/
│ ├── env.py
│ └── versions/
│ └── 20260317_01_initial.py
├── app/
│ ├── __init__.py
│ ├── main.py
│ ├── api/
│ │ ├── __init__.py
│ │ ├── dependencies.py
│ │ ├── router.py
│ │ └── routes/
│ │ ├── __init__.py
│ │ ├── alerts.py
│ │ ├── farmers.py
│ │ ├── feedback.py
│ │ ├── health.py
│ │ ├── locations.py
│ │ ├── simulation.py
│ │ ├── sms.py
│ │ └── weather.py
│ ├── core/
│ │ ├── config.py
│ │ ├── logging.py
│ │ └── security.py
│ ├── db/
│ │ ├── base.py
│ │ └── session.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── alert.py
│ │ ├── enums.py …