Team 111 · Hack the Future 2025
MediScan is a full-stack AI health assistant that helps users understand possible causes of their symptoms through a clinical-style conversational interview, analyzes uploaded medical reports, finds nearby hospitals, and tracks a personal health history — with multilingual support for English, Hindi, Tamil, and Telugu.
⚠️ Medical Disclaimer: MediScan is for informational purposes only and does not replace professional medical advice, diagnosis, or treatment. Always consult a qualified physician.
- Conversational AI Doctor — a clinical-style symptom interview that asks follow-up questions before offering guidance, powered by Claude 3.5 Sonnet (via OpenRouter). Streaming responses with typing indicators.
- Dual mode — a privacy-focused General doctor (no history) and a Personal doctor that uses the user's stored profile and past conversations for context.
- RAG-grounded medical knowledge — a Python NLP service retrieves from an Indian medical knowledge base (LangChain + Qdrant vector search + BM25) to ground responses.
- Medical report analysis — upload a PDF lab/medical report; the backend parses it (
pdf-parse) and the AI summarizes findings, optionally with the user's health context. - Hospital finder — nearby-hospital search over OpenStreetMap (Overpass API for hospitals, Nominatim for geocoding) rendered on an interactive Leaflet.js map, with directions. A SerpAPI-backed path also exists server-side (
/api/hospitals). - Multilingual — responses in English, Hindi (हिंदी), Tamil (தமிழ்), and Telugu (తెలుగు).
- Reminders & dashboard — medication/health reminders, search history, and conversation archive.
- Modern UI/UX — responsive design, dark mode, terms & conditions flow.
| Layer | Technologies |
|---|---|
| Frontend | HTML5, CSS3, vanilla JavaScript, Leaflet.js (maps), Firebase Auth (client SDK) |
| Backend | Node.js, Express.js, MongoDB Atlas + Mongoose, Firebase Admin SDK (token verification) |
| AI | OpenRouter → Anthropic Claude 3.5 Sonnet (OpenAI-compatible client) |
| NLP / RAG | Python 3.12, Flask, LangChain, Qdrant, sentence-transformers, BM25 |
| External APIs | OpenRouter (AI), OpenStreetMap Overpass + Nominatim (hospitals/geocoding), SerpAPI (alternate hospital path), Firebase Authentication |
| Security | Helmet, express-rate-limit, express-mongo-sanitize, express-validator, JWT, bcrypt |
MediScan/
├── frontend/ # Static frontend (served over HTTP)
│ ├── index.html # ★ Main application (chat, hospitals, reports, reminders)
│ ├── script.js # ★ Main app logic
│ ├── auth.html / signup.html # Login / registration
│ ├── dashboard.html # User dashboard
│ ├── terms.html # Terms & conditions
│ ├── firebase-config.js # Fetches Firebase config from backend at runtime
│ ├── api.js # API client helpers
│ ├── index-modern.html+app.js # Experimental React rewrite (incomplete — not the demo path)
│ └── *-styles.css, sw.js # Styles & service worker
│
├── backend/ # Express API server
│ ├── server.js # App entry (fail-fast env checks, security middleware)
│ ├── config/ # DB & Firebase Admin init
│ ├── controllers/ # auth, chat, profile, hospital, analytics, report, reminder
│ ├── models/ # User, Conversation, PatientProfile, SearchHistory,
│ │ # Analytics, HealthReport, Reminder
│ ├── routes/ # auth, chat, profile, hospital, analytics, config,
│ │ # user, report, reminder
│ ├── services/ # aiService (OpenRouter), hospitalService (SerpAPI)
│ └── middleware/ # auth + error handling
│
├── nlp-service/ # Python Flask NLP + RAG service
│ ├── lightweight_service.py # Rule-based NLP + RAG retrieval (recommended)
│ ├── medical_nlp_service.py # Full NLP service
│ ├── rag/ # ingest.py (build index), retriever.py (query)
│ └── requirements.txt
│
├── start.sh / start.bat # Start all services
├── stop.sh / stop.bat # Stop all services
└── README.md
- Node.js v14+ and Python 3.12
- MongoDB Atlas account
- Firebase project (Email/Password + Google auth enabled) — client config and an Admin SDK service account
- OpenRouter API key (openrouter.ai/keys)
- SerpAPI key (serpapi.com)
cd backend
npm install
cp .env.example .env # then fill in your valuesKey variables (see .env.example for the full list):
MONGODB_URI=...
JWT_SECRET=... # min 32 chars
OPENROUTER_API_KEY=...
OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
GOOGLE_MAPS_API_KEY=... # SerpAPI key
NLP_SERVICE_URL=http://localhost:5001
FIREBASE_API_KEY=... # client SDK config (served to frontend)
FIREBASE_CLIENT_EMAIL=... # admin SDK (token verification)
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"The server fails fast on startup if MONGODB_URI, JWT_SECRET, or OPENROUTER_API_KEY are missing.
The frontend does not hardcode Firebase keys — it fetches them from
GET /api/config/firebaseat runtime, so the client config lives only in the backend.env.
cd nlp-service
pip3 install -r requirements.txt
python3 rag/ingest.py # optional: build the RAG index (needs Qdrant)The service starts even if Qdrant is unavailable — RAG is lazy-loaded and degrades gracefully.
# Mac/Linux
chmod +x start.sh stop.sh && ./start.sh
# Windows
start.bat# Terminal 1 — NLP service
cd nlp-service && python3 lightweight_service.py # :5001
# Terminal 2 — Backend
cd backend && npm start # :3001
# Terminal 3 — Frontend
cd frontend && python3 -m http.server 8000 # :8000- App: http://localhost:8000/index.html ← the working app
- Backend API: http://localhost:3001/api
- NLP service: http://localhost:5001
Auth (/api/auth) — POST /signup, POST /login, POST /firebase, GET /me, PUT /profile, PUT /change-password, DELETE /account
Chat (/api/chat) — POST /stream, POST /message, POST /analyze, GET /history, GET /conversation/:sessionId, POST /conversation/:sessionId/rate, DELETE /conversation/:sessionId
Profile (/api/profile) — GET /, GET /status, GET /summary, PUT /basic, PUT /medical-history, PUT /lifestyle
Hospitals (/api/hospitals) — POST /nearby, POST /geocode, POST /search
Reports (/api/reports) — POST /analyze, POST /analyze-with-context, GET /history, GET /:id
Reminders (/api/reminders) — GET /, POST /, PUT /:id, DELETE /:id
User / dashboard (/api/user) — POST /sync, GET /dashboard/:firebaseUid, POST /search-history, DELETE /search-history/:id
Config (/api/config) — GET /firebase
- Firebase Authentication + Admin-SDK token verification on protected routes
helmetsecurity headers, CORS restricted toFRONTEND_URL- Rate limiting (
express-rate-limit) and NoSQL-injection protection (express-mongo-sanitize) - Input validation via
express-validator, password hashing viabcrypt - All secrets in environment variables;
.envis gitignored and never committed
Automated tests are not yet implemented (hackathon timeline). Manual health checks:
curl http://localhost:3001/api/health # backend
curl http://localhost:5001/health # NLP serviceNext steps: unit tests for services/controllers (Jest + Supertest) and RAG-retrieval evaluation.
- Voice input for symptoms
- Automated test suite (Jest + Supertest)
- Appointment booking & telemedicine integration
- Expanded RAG knowledge base and citation display
Built by Team 111 for Hack the Future 2025.