Skip to content

Sumit-ai-dev/swasthya-setu-prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

42 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅ Swasthya-Setu โ€” เคธเฅเคตเคพเคธเฅเคฅเฅเคฏ-เคธเฅ‡เคคเฅ

License: MIT Python React AWS Lambda Status

AI for Bharat Hackathon 2026 Submission

Swasthya-Setu ("Health Bridge") demonstrates how Generative AI on AWS can support frontline healthcare workers and patients in rural India โ€” with fast AI triage, a guideline-grounded medical chatbot, and a patient management system โ€” all deployed live on AWS.


๐ŸŒ Live Demo

Service URL
Frontend (CloudFront) https://d74rck1rcmkfd.cloudfront.net
Backend API (API Gateway) https://5zdiwo4lfl.execute-api.ap-south-1.amazonaws.com/api/v1
API Docs (Swagger) https://5zdiwo4lfl.execute-api.ap-south-1.amazonaws.com/docs

๐ŸŽฏ Problem Statement

Rural India faces a severe healthcare accessibility crisis:

  • 600M+ people live in rural areas with limited access to doctors
  • Frontline health workers (ASHAs, ANMs) lack structured decision-support tools
  • Patients travel hours to clinics for conditions that can be triaged remotely
  • No affordable, multilingual, AI-powered health guidance exists at scale

Swasthya-Setu is a working proof-of-concept that shows how AI can bridge this gap โ€” today.


โœจ Features (All Live & Functional)

1. ๐Ÿง‘โ€โš•๏ธ Patient Management

  • Register patients with name, age, and gender (Male/Female)
  • Persistent patient profiles stored in AWS RDS PostgreSQL
  • Full consultation history per patient (triage + chat logs)
  • Search and browse all registered patients

2. ๐Ÿšจ AI Symptom Triage (RED / YELLOW / GREEN)

  • Enter symptoms in Hindi or English โ€” multilingual input supported
  • Powered by GPT-4o-mini for fast, structured classification
  • Returns one of three clinically meaningful levels:
    • ๐Ÿ”ด RED โ€” Emergency: Immediate hospital referral
    • ๐ŸŸก YELLOW โ€” Priority: Visit clinic or pharmacy
    • ๐ŸŸข GREEN โ€” Non-urgent: Home care with guidance
  • Includes confidence score, actionable advice, and clinical reasoning
  • Every triage is logged to the database for analytics

3. ๐Ÿ’ฌ Medical AI Chatbot (RAG-Based)

  • Conversational Q&A powered by GPT-4o-mini + Retrieval-Augmented Generation
  • Answers grounded in WHO guidelines, NHM advisories, and Ayushman Bharat documentation
  • Shows cited sources for every response โ€” transparent and trustworthy
  • Session memory for multi-turn conversations
  • Embeddings stored in pgvector on AWS RDS via Amazon Bedrock Titan

4. ๐Ÿ“Š Analytics Dashboard

  • Real-time consultation counts
  • Triage distribution breakdown (RED / YELLOW / GREEN)
  • Chat interaction metrics
  • Live data from production database

๐Ÿ—๏ธ Architecture

User (Browser)
      โ”‚
      โ–ผ
Amazon CloudFront  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  Amazon S3
(CDN, HTTPS, SSL)                    (React Frontend)
      โ”‚
      โ–ผ
Amazon API Gateway (ap-south-1)
      โ”‚
      โ–ผ
AWS Lambda โ€” FastAPI via Mangum adapter
      โ”‚
      โ”œโ”€โ”€ OpenAI GPT-4o-mini  (Triage + Chatbot LLM)
      โ”œโ”€โ”€ Amazon Bedrock Titan (Embeddings for RAG)
      โ”œโ”€โ”€ Amazon RDS PostgreSQL + pgvector (Patient data + Vector store)
      โ””โ”€โ”€ LangChain (RAG orchestration)

AWS Services Used

Service Purpose
AWS Lambda Serverless backend (FastAPI app via Mangum)
Amazon API Gateway HTTP routing and CORS
Amazon RDS (PostgreSQL) Patient data + pgvector embeddings
Amazon S3 Frontend static hosting
Amazon CloudFront CDN, HTTPS, global delivery
Amazon ECR Docker image registry for Lambda
Amazon Bedrock (Titan) Vector embeddings for RAG knowledge base

๐Ÿ—‚๏ธ Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS, Framer Motion
Backend Python 3.13, FastAPI, Mangum
AI / LLM OpenAI GPT-4o-mini
RAG LangChain, pgvector, Amazon Bedrock Titan Embeddings
Database PostgreSQL (AWS RDS), SQLAlchemy
Deployment Docker, AWS Lambda (arm64), ECR, API Gateway

๐Ÿš€ Run Locally (Docker)

# Clone the repo
git clone https://github.com/Sumit-ai-dev/swasthya-setu-prototype.git
cd swasthya-setu-prototype

# Start everything with Docker Compose
docker compose up --build
Service URL
Frontend http://localhost:5173
Backend http://localhost:8000
API Docs http://localhost:8000/docs

Required environment variables โ€” copy backend/.env.example to backend/.env and fill in:

OPENAI_API_KEY=your_openai_key
DATABASE_URL=postgresql://postgres:password@localhost:5432/swasthya_setu
EMBEDDING_PROVIDER=local   # or 'bedrock' for AWS Titan
TRIAGE_MODEL_ID=gpt-4o-mini
CHATBOT_MODEL_ID=gpt-4o-mini

โ˜๏ธ AWS Production Deployment

Backend (Lambda via ECR)

cd backend
bash scripts/deploy.sh

This script:

  1. Builds the Docker image for linux/arm64
  2. Pushes to Amazon ECR in ap-south-1
  3. Creates or updates the Lambda function
  4. Applies environment configuration

Frontend (S3 + CloudFront)

cd frontend
npm run build
aws s3 sync dist/ s3://swasthya-setu-frontend-bucket --delete
aws cloudfront create-invalidation --distribution-id <ID> --paths "/*"

Database Initialization

cd backend
export DATABASE_URL=postgresql+psycopg2://...

# Create tables
python3 -m app.scripts.init_db

# Seed WHO/NHM medical knowledge base
python3 -m app.scripts.seed_medical_data

๐Ÿ”ฌ Clinical Standards

The triage engine is calibrated against WHO Emergency Triage Assessment and Treatment (ETAT) guidelines:

  • ๐Ÿ”ด RED โ€” Airway, Breathing, Circulation, or Disability compromise; cancer/malignancy indicators; severe fever in infants
  • ๐ŸŸก YELLOW โ€” Stable but serious conditions requiring clinical investigation; persistent symptoms; chronic conditions
  • ๐ŸŸข GREEN โ€” Mild self-limiting symptoms; home care appropriate

โš ๏ธ Disclaimer: Swasthya-Setu is an AI demonstration prototype. It is not a substitute for professional medical diagnosis or treatment. Always consult a qualified healthcare provider.


๐Ÿงช Testing

cd backend
pytest app/tests/test_clinical_triage.py -v

Tests verify triage classification correctness across critical symptom profiles including fever, chest pain, respiratory distress, and oncology red flags.


๐Ÿ“ Project Structure

swasthya-setu-prototype/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ api/api_v1/endpoints/   # patients, triage, chatbot, analytics
โ”‚   โ”‚   โ”œโ”€โ”€ core/config.py          # Pydantic settings
โ”‚   โ”‚   โ”œโ”€โ”€ db/                     # SQLAlchemy models + session
โ”‚   โ”‚   โ”œโ”€โ”€ schemas/                # Pydantic request/response schemas
โ”‚   โ”‚   โ”œโ”€โ”€ services/               # RAG service, LLM calls
โ”‚   โ”‚   โ””โ”€โ”€ scripts/                # DB init, seed scripts
โ”‚   โ”œโ”€โ”€ Dockerfile                  # Lambda-compatible container
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ scripts/deploy.sh           # AWS Lambda deployment
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/             # PatientDashboard, Triage, Chatbot, Analytics
โ”‚   โ”‚   โ”œโ”€โ”€ api.js                  # Axios API client
โ”‚   โ”‚   โ””โ”€โ”€ App.jsx
โ”‚   โ””โ”€โ”€ scripts/deploy.sh           # S3 + CloudFront deployment
โ””โ”€โ”€ docker-compose.yml

๐Ÿ›ฃ๏ธ Future Roadmap

  • Offline-first Android app โ€” DistilBERT on-device triage for no-internet zones
  • Indian Sign Language (ISL) support โ€” accessibility for deaf patients
  • eSanjeevani / ABDM integration โ€” connect with national health ID
  • Voice input in regional languages โ€” Telugu, Tamil, Bengali, Marathi
  • Village-level health worker dashboards โ€” ASHA/ANM portal
  • Outbreak detection โ€” anomaly detection from triage data patterns

๐Ÿ‘จโ€๐Ÿ’ป Team

Built by Sumit Das for the AI for Bharat Hackathon 2026 ๐Ÿ‡ฎ๐Ÿ‡ณ


เคธเฅเคตเคพเคธเฅเคฅเฅเคฏ-เคธเฅ‡เคคเฅ โ€” Bridging India's healthcare gap, one consultation at a time.

About

Offline-first AI health platform for rural India with symptom triage, telemedicine integration, and ISL support. AI for Bharat Hackathon 2026.

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors