EarlyEco Backend is a FastAPI service for participatory health intelligence, built to collect frequent user health check-ins, assess individual risk, and generate actionable insights at both user and community levels. The system supports authentication, session management, health trend tracking, warning/suggestion generation, community-location risk summaries, and synthetic data generation for demo/testing workflows.
- Clone and enter project:
git clone <your-repo-url> cd be
- Create and activate virtual environment:
python3 -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txt
- Create local environment file:
cp environment.example.env environment.env
- Update
environment.envwith real values:
MONGODB_URIMONGODB_DB_NAME- optional:
JWT_ALGORITHM - optional:
LLM_API_KEY
- Run server:
uvicorn app.main:app --host 127.0.0.1 --port 8080 --reload
- Open:
http://127.0.0.1:8080/docshttp://127.0.0.1:8080/openapi.json
- Auth with session-based JWT flow
- User health check-ins (location + symptoms + vitals + wellness)
- Risk classification and trend analysis
- Suggestions with warnings and future outlook
- Community health overview by city or nearby radius
- Mock-data generation and automatic 15-minute population loop
- FastAPI
- MongoDB Atlas (Motor/PyMongo)
- JWT auth
- Optional LLM-assisted health assessment
app/main.py- app startup, middleware, background loopapp/api/v1/endpoints/- API sections (auth,user_health,community_health,suggestions,mock_data,health)app/core/- config, db, security, assessment, auto-populationapp/schemas/- API request/response modelsapi/index.py- Vercel entrypoint
Required env vars:
MONGODB_URIMONGODB_DB_NAME
Optional:
DEBUGLLM_API_KEY
Note: environment.env is local-only. Configure env vars in Vercel dashboard.