ResiliTrack AI is a full-stack web app that analyzes pandemic resilience for 10 countries using Google Gemini. It combines a React/Vite frontend with a Flask API, delivering an AI-driven analysis summary plus country rankings and aspect-level heatmaps.
- Accepts a pandemic scenario headline from users.
- Uses Gemini to interpret the scenario and score 7 resilience aspects per country.
- Computes overall resilience scores and ranks countries.
- Visualizes results through a bar chart and heatmap.
- Supports email or Google login with per-user API key storage.
- AI-assisted scenario analysis with Gemini.
- 7 resilience aspects: Defence, Economy, Healthcare, Infrastructure, Social Safety, Technology, Governance.
- 10 tracked countries out of the box.
- Interactive charts and heatmaps.
- Theme, font, and layout customization.
- Email and Google OAuth login with per-user Gemini API keys.
- Frontend: React 18 + Vite single-page app.
- Backend: Flask API with analysis, chat, and auth routes.
- AI layer: Gemini API client for scenario interpretation.
- Data layer: cached World Bank indicators for baseline scoring.
- Auth storage: SQLite database under backend/data/auth.db.
- User submits a scenario in the chatbot.
- Frontend calls POST /api/analyze.
- Backend builds baseline scores from cached indicators.
- Gemini interprets the scenario and impacts aspects.
- Backend applies impacts, computes totals, and returns results.
- Frontend renders the analysis, bar chart, and heatmap.
- Visit https://aistudio.google.com/app/apikey.
- Sign in with your Google account.
- Click "Create API Key" and select a project.
- Copy the key (it starts with "AIza").
- Paste it in the app when prompted (Settings > Gemini API Key).
Frontend:
- React 18
- Vite
- Chart.js + react-chartjs-2
- Axios
Backend:
- Flask 2.3
- Python 3.8+
- google-generativeai
- Flask-CORS
- python-dotenv
- SQLite (auth storage)
RESILITRACK AI/
├── backend/
│ ├── app.py
│ ├── config.py
│ ├── requirements.txt
│ ├── routes/
│ └── utils/
├── frontend/
│ ├── index.html
│ ├── package.json
│ ├── vite.config.js
│ └── src/
├── setup.bat
├── setup.sh
├── start.bat
├── start.sh
└── README.md
- Python 3.8+
- Node.js 16+
- A Gemini API key from Google AI Studio
- Run setup.bat once.
- Run start.bat.
- Open http://localhost:5000.
Backend:
cd backend
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
python app.pyFrontend (new terminal):
cd frontend
npm install
npm run devBuild the frontend and let Flask serve it:
cd frontend
npm install
npm run build
cd ../backend
python app.pyOpen http://localhost:5000.
Analysis:
- POST /api/analyze
- GET /api/results
- GET /api/countries
- GET /api/aspects
Chat:
- GET /api/chat-history
- POST /api/chat-history
- DELETE /api/chat-history
Auth:
- GET /api/auth/me
- POST /api/auth/register
- POST /api/auth/login
- POST /api/auth/google
- POST /api/auth/api-key
- POST /api/auth/logout
- DELETE /api/auth/account
- If Google OAuth is not configured, email login still works.
- Gemini API failures fall back to safe demo data for UI testing.
- Cached World Bank data lives in backend/data.