"Har Pakistani ki Sehat, AI ki Nigrani Mein" (Every Pakistani's Health, Under AI's Care)
SehatAgent is a Multi-Agent AI Health System that provides preventive, explainable, and accessible healthcare guidance for Pakistan. Built for the IDEAX92 Hackathon, it demonstrates how specialized AI agents collaborate to analyze symptoms, assess risks, and generate personalized health recommendations.
- π©Ί Symptom Analysis - Analyzes symptoms in English, Urdu, and Roman Urdu
β οΈ Risk Assessment - Identifies health & nutrition risks (Pakistan-specific)- π Preventive Guidance - Simple language recommendations
- π¨ββοΈ Healthcare Worker Dashboard - Summarized insights for doctors/LHWs
- π£οΈ Voice Input - Supports Urdu, Punjabi, and English voice
- π΄ Offline Mode - Works without internet using cached knowledge
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Interface β
β (Web/Mobile - English/Urdu/Punjabi) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β (Google Cloud Run) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββ
β Agent Orchestrator β
βββββββββββββββ¬ββββββββββββββ¬ββββββββββββββ¬ββββββββββββββ¬ββββββββββ€
β Symptom β Risk β Health β Safety β Offline β
β Analyzer β Assessor β Advisor β Guard β Helper β
βββββββββββββββ΄βββββββ¬βββββββ΄ββββββββββββββ΄ββββββββββββββ΄ββββββββββ
β
ββββββββββββββ΄βββββββββββββ
β β
βββββββββΌββββββββ ββββββββββΌβββββββββ
β Vertex AI β β FAISS β
β (Gemini) β β (Local Index) β
βββββββββββββββββ βββββββββββββββββββ
β
βββββββββΌββββββββ
β Cloud SQL β
β (PostgreSQL) β
βββββββββββββββββ
| Agent | Role | Responsibility |
|---|---|---|
| SymptomAnalyzer | Analysis | Extract symptoms from multilingual input |
| RiskAssessor | Assessment | Identify health/nutrition risks |
| HealthAdvisor | Recommendation | Generate preventive guidance |
| SafetyGuard | Ethics | Ensure safe, ethical responses |
| OfflineHelper | Fallback | Rule-based guidance when offline |
- Python 3.11+
- Docker
- GCP Account (provided by hackathon)
- gcloud CLI installed
# Clone repository
git clone <your-repo-url>
cd sehatagent
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file
cp .env.example .env
# Edit .env with your credentialsEdit .env with your GCP credentials:
GCP_PROJECT_ID=your-project-id
DB_HOST=your-db-host
DB_NAME=sehatagent
DB_USER=your-db-user
DB_PASSWORD=your-db-passwordpython scripts/init_db.pypython scripts/build_faiss_index.pyuvicorn app.main:app --reload --port 8080Visit: http://localhost:8080
docker build -t sehatagent:latest .docker run -p 8080:8080 --env-file .env sehatagent:latestgcloud auth login
gcloud config set project YOUR_PROJECT_IDgcloud services enable \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
aiplatform.googleapis.com \
sqladmin.googleapis.com \
speech.googleapis.comgcloud artifacts repositories create sehatagent-repo \
--repository-format=docker \
--location=us-central1# Configure Docker for GCP
gcloud auth configure-docker us-central1-docker.pkg.dev
# Build and tag
docker build -t us-central1-docker.pkg.dev/YOUR_PROJECT_ID/sehatagent-repo/sehatagent:v1 .
# Push to Artifact Registry
docker push us-central1-docker.pkg.dev/YOUR_PROJECT_ID/sehatagent-repo/sehatagent:v1gcloud run deploy sehatagent \
--image us-central1-docker.pkg.dev/YOUR_PROJECT_ID/sehatagent-repo/sehatagent:v1 \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--set-env-vars "GCP_PROJECT_ID=YOUR_PROJECT_ID" \
--set-env-vars "DB_HOST=/cloudsql/YOUR_INSTANCE_CONNECTION" \
--set-env-vars "DB_NAME=sehatagent" \
--set-env-vars "DB_USER=your-user" \
--set-env-vars "DB_PASSWORD=your-password" \
--add-cloudsql-instances YOUR_INSTANCE_CONNECTION \
--memory 2Gi \
--cpu 2 \
--min-instances 0 \
--max-instances 10| Endpoint | Method | Description |
|---|---|---|
/api/v1/health/analyze |
POST | Analyze health query |
/api/v1/health/quick-check |
POST | Quick symptom check |
/api/v1/voice/transcribe |
POST | Voice to text |
/api/v1/voice/analyze |
POST | Voice health analysis |
/api/v1/worker/dashboard |
GET | Healthcare worker insights |
/api/v1/offline/analyze |
POST | Offline mode analysis |
curl -X POST "https://your-service-url/api/v1/health/analyze" \
-H "Content-Type: application/json" \
-d '{
"query": "Mujhe 3 din se bukhar hai aur sir mein dard hai",
"language": "auto"
}'{
"success": true,
"session_id": "abc123",
"mode": "full",
"language": "roman_urdu",
"symptoms_identified": ["fever", "headache"],
"risk_level": "MEDIUM",
"recommendations": [
"Rest and stay hydrated with water and ORS",
"Take paracetamol for fever",
"See doctor if fever persists beyond 3 days"
],
"explanation": {
"summary": "Based on your fever and headache...",
"agent_reasoning": [...]
},
"disclaimer": "This is not medical advice..."
}SehatAgent works offline using:
- Rule-based symptom matching - Pre-defined patterns
- Local FAISS index - Cached embeddings
- Offline knowledge base - JSON-based health data
curl -X POST "http://localhost:8080/api/v1/offline/analyze" \
-H "Content-Type: application/json" \
-d '{"query": "bukhar hai", "language": "roman_urdu"}'| Language | Input | Output | Voice |
|---|---|---|---|
| English | β | β | β |
| Urdu (Ψ§Ψ±Ψ―Ω) | β | β | β |
| Roman Urdu | β | β | - |
| Punjabi (ΩΎΩΨ¬Ψ§Ψ¨Ϋ) | - | - | β |
Access aggregated insights at /api/v1/worker/dashboard:
- Total consultations
- Common symptoms distribution
- Risk level breakdown
- Urgent cases requiring attention
- Community health trends
# Run tests
pytest tests/ -v
# Test specific module
pytest tests/test_agents.py -vsehatagent/
βββ app/
β βββ main.py # FastAPI application
β βββ config.py # Configuration
β βββ agents/ # Multi-agent system
β β βββ orchestrator.py # Agent coordination
β β βββ symptom_agent.py # Symptom analysis
β β βββ risk_agent.py # Risk assessment
β β βββ recommendation_agent.py
β β βββ safety_agent.py # Ethical guardrails
β β βββ fallback_agent.py # Offline mode
β βββ api/ # API endpoints
β βββ services/ # External services
β β βββ vertex_ai.py # Gemini integration
β β βββ rag_service.py # FAISS RAG
β β βββ language_service.py
β β βββ speech_service.py
β βββ database/ # PostgreSQL models
βββ data/ # Preloaded data
βββ scripts/ # Utility scripts
βββ Dockerfile # Container config
βββ requirements.txt # Dependencies
- Pakistan-Specific Health Knowledge - Typhoid, Dengue, TB patterns
- Multilingual Voice Input - Urdu, Punjabi support
- Robust Offline Mode - Works in low-connectivity areas
- Explainable AI - Shows reasoning for all decisions
- Healthcare Worker Support - Dashboard for LHWs
- Privacy-First - No raw health data stored
Built for IDEAX92 Hackathon by BiTech Digital
MIT License - See LICENSE for details.
- Emergency (Pakistan): 1122
- Edhi Foundation: 115
Built with β€οΈ for Pakistan's Healthcare