LabInsight AI-Powered Lab Report Analysis Platform
A full-stack healthcare web application that uses artificial intelligence to analyze lab reports, provide personalized health insights, and connect patients with doctors for professional medical guidance.
- Overview
- Features
- Technology Stack
- Architecture
- Installation
- Configuration
- Running the Application
- API Documentation
- User Roles & Flows
- Project Structure
- Team Members
- Screenshots
- License
LabInsight AI is a comprehensive healthcare platform designed to:
- Allow users to upload lab reports (PDF/images) and receive AI-generated analysis
- Provide an intelligent chatbot powered by RAG (Retrieval Augmented Generation) for health queries
- Connect patients with doctors for professional medical consultation
- Enable doctors to manage patients, view reports, and add professional comments
- Give administrators full control over users, doctors, and system reports
- Secure Authentication - Email/password login with Google OAuth 2.0
- Report Upload - Upload lab reports (PDF, JPEG, PNG) with 10MB limit
- AI Analysis - Get instant AI-generated insights including:
- Overall health summary
- Key findings & recommendations
- Severity assessment (low/medium/high)
- Individual test interpretations
- AI Chat Assistant - Ask health questions and get context-aware answers based on your reports
- Trends Visualization - Track health metrics over time with charts
- Doctor Connection - Send requests to connect with available doctors
- Profile Management - Manage personal and medical information
- Patient Management - View all connected patients
- Report Review - Access patient lab reports and AI analysis
- Professional Comments - Add medical comments and recommendations
- Connection Requests - Accept or reject patient connection requests
- Dashboard - Overview of patients, pending requests, and recent activity
- User Management - View, edit, suspend, or delete user accounts
- Doctor Management - Create and manage doctor accounts
- Report Oversight - View all reports across the platform
- System Dashboard - Statistics and analytics overview
| Technology | Purpose |
|---|---|
| React 18 | UI Framework |
| TypeScript | Type Safety |
| Vite | Build Tool |
| Tailwind CSS | Styling |
| Radix UI / shadcn | Component Library |
| React Router DOM | Routing |
| Recharts | Data Visualization |
| React Markdown | Markdown Rendering |
| Firebase Auth | Google OAuth 2.0 |
| Lucide React | Icons |
| Technology | Purpose |
|---|---|
| Node.js | Runtime Environment |
| Express.js | Web Framework |
| MongoDB | Database |
| Mongoose | ODM |
| JWT | Authentication Tokens |
| bcrypt | Password Hashing |
| Multer | File Upload |
| Swagger UI | API Documentation |
| CORS | Cross-Origin Requests |
| Technology | Purpose |
|---|---|
| Flask | Microservice Framework |
| Groq API | LLM (Llama 3.3 70B) |
| SentenceTransformers | Text Embeddings |
| LangChain | PDF Processing |
| PyMongo | MongoDB Connection |
| NumPy | Vector Operations |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT (Browser) β
β React + TypeScript + Vite β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND (Node.js + Express) β
β Port: 5000 β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β
β β Auth β β Upload β β Admin β β Doctor β β
β β Routes β β Routes β β Routes β β Routes β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β
β β β
β Swagger UI (/api-docs) β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββ βββββββββββββββββββββββββββ
β MongoDB β β File Storage β β AI Service (Python) β
β (Database) β β (uploads/) β β Port: 5001 β
β β β β β βββββββββββββββββββββ β
β - Users β β - PDFs β β β Groq LLM API β β
β - Profiles β β - Images β β β (Llama 3.3 70B) β β
β - Reports β β β β βββββββββββββββββββββ β
β - Doctors β β β β βββββββββββββββββββββ β
β - Requests β β β β β Embeddings β β
β β β β β β (RAG System) β β
βββββββββββββββββββ βββββββββββββββββ β βββββββββββββββββββββ β
βββββββββββββββββββββββββββ
- Node.js v18+ (Download)
- Python 3.9+ (Download)
- MongoDB (Local or MongoDB Atlas)
- Git (Download)
git clone https://github.com/your-username/labinsight-ai.git
cd labinsight-ai# From project root
npm installcd Backend-Node
npm install
cd ..cd AI-Service
pip install -r requirements.txt
cd ..Create Backend-Node/.env:
# MongoDB Connection
MONGODB_URI=mongodb://localhost:27017/LabInsight
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this
JWT_EXPIRES_IN=7d
# Server Port
PORT=5000
# AI Service URL
AI_SERVICE_URL=http://localhost:5001Create AI-Service/.env:
# Groq API Key (Get from https://console.groq.com/)
GROQ_API_KEY=your-groq-api-key
# MongoDB Connection
MONGO_URI=mongodb://localhost:27017/LabInsightThe Firebase configuration is already set up in src/components/firebase.ts. If you want to use your own Firebase project:
- Go to Firebase Console
- Create a new project
- Enable Google Authentication
- Update the config in
firebase.ts
Open 3 terminal windows:
Terminal 1 - Frontend:
npm run devFrontend runs at: http://localhost:5173
Terminal 2 - Backend:
cd Backend-Node
node server.jsBackend runs at: http://localhost:5000
Terminal 3 - AI Service:
cd AI-Service
python ai_service.pyAI Service runs at: http://localhost:5001
You can set up a script to run all services together. Add to root package.json:
{
"scripts": {
"dev": "vite",
"backend": "cd Backend-Node && node server.js",
"ai": "cd AI-Service && python ai_service.py"
}
}Once the backend is running, access the interactive API documentation at:
http://localhost:5000/api-docs
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/signup |
Register new user |
| POST | /auth/login |
User login |
| POST | /auth/doctor-login |
Doctor login |
| POST | /auth/change-password |
Change password |
| Method | Endpoint | Description |
|---|---|---|
| GET | /profile/:email |
Get user profile |
| PUT | /profile/:email |
Update profile |
| POST | /upload-report |
Upload lab report |
| GET | /reports?email= |
Get user's reports |
| GET | /report/:id |
Get single report |
| DELETE | /delete-report/:id |
Delete report |
| Method | Endpoint | Description |
|---|---|---|
| GET | /doctors |
List all doctors |
| POST | /send-request |
Send connection request |
| GET | /doctor/patients/:email |
Get doctor's patients |
| PUT | /doctor/request/update/:id |
Accept/reject request |
| POST | /doctor/add-comment |
Add comment to report |
| Method | Endpoint | Description |
|---|---|---|
| GET | /admin/users |
Get all users |
| PUT | /admin/users/:email/status |
Update user status |
| DELETE | /admin/users/:email |
Delete user |
| POST | /admin/create-doctor |
Create doctor account |
| Method | Endpoint | Description |
|---|---|---|
| POST | /analyze |
Analyze PDF report |
| GET | /chat/latest-report?email= |
Get latest report info |
| POST | /chat/ask |
Ask AI a question |
Sign Up β Login β Upload Report β View AI Analysis β Chat with AI
Login β Browse Doctors β Send Request β (Doctor Accepts) β View Assigned Doctor
Login β View Dashboard β Check Requests β Accept/Reject β View Patients β Add Comments
Login β Dashboard β Manage Users β Manage Doctors β View Reports
Final_Web/
βββ π AI-Service/ # Python AI Microservice
β βββ ai_service.py # Main Flask application
β βββ requirements.txt # Python dependencies
β βββ Embeddings/ # Generated embeddings (.pkl)
β βββ .env.example
β
βββ π Backend-Node/ # Node.js Backend
β βββ server.js # Express entry point
β βββ swagger.js # Swagger configuration
β βββ config/
β β βββ db.js # MongoDB connection
β βββ middleware/
β β βββ auth.js # JWT middleware
β βββ models/ # Mongoose schemas
β β βββ User.js
β β βββ Profile.js
β β βββ Report.js
β β βββ DoctorProfile.js
β β βββ AssignedDoctor.js
β β βββ ConnectionRequest.js
β βββ routes/ # API routes
β β βββ auth.js
β β βββ profile.js
β β βββ upload.js
β β βββ admin.js
β β βββ doctorRoutes.js
β β βββ ...
β βββ uploads/ # Uploaded files
β
βββ π src/ # React Frontend
β βββ App.tsx # Main app with routes
β βββ main.tsx # Entry point
β βββ index.css # Global styles
β βββ components/
β β βββ admin/ # Admin components
β β βββ doctor/ # Doctor components
β β βββ ui/ # Shared UI components
β β βββ Home.tsx
β β βββ SignIn.tsx
β β βββ Profile.tsx
β β βββ Chat.tsx
β β βββ ViewReports.tsx
β β βββ ...
β βββ styles/
β
βββ π package.json # Frontend dependencies
βββ π vite.config.ts # Vite configuration
βββ π index.html # HTML entry point
βββ π README.md # This file
βββ π TEAM_WORKFLOW.md # Team collaboration guide
βββ π .gitignore
| Name | Role | Responsibilities |
|---|---|---|
| Anushika Balamurugan | Frontend - User Module | User authentication, dashboard, reports UI |
| Venkata Sriya Kamarsu | Frontend - Admin/Doctor | Admin panel, doctor portal |
| Akshay Madavalappil Ramesh | Backend Developer | Node.js APIs, database, authentication |
| Amrin Bushra Taj | AI & Documentation | AI service, chatbot, documentation |
- Password Hashing - bcrypt with salt rounds
- JWT Authentication - Secure token-based auth
- Role-Based Access Control - Admin, Doctor, User roles
- File Validation - Type and size restrictions
- Protected Routes - Middleware-based authorization
- Google OAuth 2.0 - Secure social login
This project is created for educational purposes as part of INFO 6150 - Fall 2025.
- Groq for LLM API
- Firebase for Authentication
- shadcn/ui for UI Components
- Tailwind CSS for Styling
This application is for educational purposes only. The AI-generated health insights should not replace professional medical advice. Always consult with healthcare providers for medical decisions.




