AI-powered patient triage and prescription management for rural clinics in India.
Runs on low-bandwidth networks. Optimised for tablet use.
| Feature | Description |
|---|---|
| 🤖 AI Triage | Gemini 1.5 Pro classifies patients as CRITICAL / URGENT / ROUTINE with risk score & confidence |
| 🎙️ Multi-language STT | Voice dictation in English, हिन्दी, and ଓଡ଼ିଆ via Web Speech API |
| 💊 Smart Prescription | Dynamic medication builder with time (☀️🌤️🌙) and meal (🌿🍽️) frequency toggles |
| 🖨️ Print Template | Professional clinical prescription with letterhead, triage strip, vitals, and doctor signatures |
| 📧 Email Notifications | Medication reminders, appointment confirmations, and critical doctor alerts via Gmail SMTP |
| 📋 Waiting List | Excel-backed patient queue with ticket numbers |
| 🏥 Doctor Dashboard | Login, nearby patient filtering, prescription history |
| 📱 Tablet-optimised UI | Min 48px touch targets, responsive grid |
This repo is split into two independent folders so backend and frontend developers can work without conflicts:
TriageAI/
├── backend/ ← Python / Flask API (see backend/README.md)
└── frontend/ ← HTML / JS / images + JSX components (see frontend/README.md)
git clone https://github.com/jinendrabanthia/ClinicApp.git
cd ClinicApppython -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activatecd backend
pip install -r requirements.txt# Inside backend/
copy .env.example .env # Windows
# cp .env.example .env # Mac/Linux| Variable | Description |
|---|---|
GEMINI_API_KEY |
Google Gemini API key — get one here |
SMTP_HOST |
SMTP server (default: smtp.gmail.com) |
SMTP_PORT |
SMTP port (default: 587) |
SMTP_USER |
Gmail address |
SMTP_PASS |
Gmail App Password (not your main password) |
DOCTOR_EMAIL |
Email address for critical alerts |
PATIENT_FROM_EMAIL |
Sender address for patient emails |
Gmail App Password: Enable 2FA on your Google account, then generate an App Password at myaccount.google.com/apppasswords
# from inside backend/
python app.pyOpen http://localhost:5000 in your browser.
| URL | Description |
|---|---|
/ |
Patient landing page |
/intake |
Full patient intake form |
/results |
AI triage results |
/prescription-demo |
Doctor prescription panel (SmartPrescriptionPanel) |
/prescription-print |
Printable clinical prescription |
/doctor-login |
Doctor authentication |
/doctor-dashboard |
Doctor management panel |
/admin |
Admin waiting list panel |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/triage |
Submit patient data, get AI triage result |
GET |
/api/waiting-list |
Fetch all patients in waiting list |
POST |
/api/notify |
Send medication / appointment reminder |
POST |
/api/notify/triage-confirm |
Send triage confirmation email |
GET |
/api/health |
Health check |
curl -X POST http://localhost:5000/api/triage \
-H "Content-Type: application/json" \
-d '{
"name": "Ramesh Kumar",
"age": 58,
"gender": "Male",
"symptoms": "chest pain, shortness of breath",
"medical_history": "hypertension",
"pain_scale": 8
}'TriageAI/
├── backend/ ← Python developer works here
│ ├── app.py # Flask app & all API routes
│ ├── triage_agent.py # Gemini AI triage logic
│ ├── mailer.py # SMTP email helpers
│ ├── notify.py # Patient notification helpers
│ ├── excel_log.py # Excel-based waiting list
│ ├── symptom_guide.py # Symptom severity reference
│ ├── requirements.txt
│ ├── Procfile # Gunicorn / deployment
│ ├── .env.example
│ └── README.md ← Backend-specific setup guide
│
├── frontend/ ← Frontend developer works here
│ ├── static/ # Served by Flask
│ │ ├── index.html
│ │ ├── intake.html
│ │ ├── results.html
│ │ ├── admin.html
│ │ ├── doctor-login.html
│ │ ├── doctor-dashboard.html
│ │ ├── doctor-discovery.html
│ │ ├── prescription-demo.html
│ │ ├── prescription-print.html
│ │ └── stt.js
│ ├── components/ # React/JSX components
│ │ ├── DoctorDiscovery.jsx
│ │ ├── DoctorRegistration.jsx
│ │ └── SmartPrescriptionPanel.jsx
│ └── README.md ← Frontend-specific guide
│
├── .venv/ # Shared Python virtual env
├── DESIGN.md
└── README.md
- Push to GitHub
- Create a new Web Service on render.com
- Set Root Directory:
backend - Set Build Command:
pip install -r requirements.txt - Set Start Command:
gunicorn app:app --workers 2 --bind 0.0.0.0:$PORT - Add all environment variables from
backend/.envin the Render dashboard
heroku create triageaid-clinic
heroku config:set GEMINI_API_KEY=your_key SMTP_USER=... SMTP_PASS=...
git subtree push --prefix backend heroku mainrailway login
railway new
railway up
# Set environment variables in Railway dashboardNote: The
waiting-list.xlsxfile is written to disk at runtime. On ephemeral filesystems (Render, Heroku free tier), data resets on each deploy. For production, replaceexcel_log.pywith a PostgreSQL or Firebase backend.
- Never commit
.envto version control (it is in.gitignore) - Use Gmail App Passwords, not your main password
- The Gemini API key grants billing access — rotate if exposed
- For production: enable HTTPS, use a reverse proxy (nginx), and implement doctor JWT authentication
| Layer | Technology |
|---|---|
| Backend | Python 3.10+, Flask 3, Flask-CORS |
| AI | Google Gemini 1.5 Pro |
| Frontend | Vanilla HTML/CSS/JS, Tailwind CSS (CDN) |
| React Component | React 18, lucide-react, Web Speech API |
Gmail SMTP via Python smtplib |
|
| Data | openpyxl (Excel) |
| Deployment | Gunicorn, Render/Heroku/Railway |
MIT License — see LICENSE for details.
Pull requests are welcome. For major changes, open an issue first.
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m 'feat: add my feature' - Push to the branch:
git push origin feature/my-feature - Open a Pull Request
Built for rural India. Designed for speed, simplicity, and life-saving accuracy.