Skip to content

AMR5210/LabInsightsAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ LabInsight AI

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.

Node.js React MongoDB Python TailwindCSS


πŸ“‹ Table of Contents


🎯 Overview

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

✨ Features

πŸ‘€ For Users (Patients)

  • 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

πŸ‘¨β€βš•οΈ For Doctors

  • 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

πŸ” For Administrators

  • 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 Stack

Frontend

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

Backend (Node.js)

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

AI Service (Python)

Technology Purpose
Flask Microservice Framework
Groq API LLM (Llama 3.3 70B)
SentenceTransformers Text Embeddings
LangChain PDF Processing
PyMongo MongoDB Connection
NumPy Vector Operations

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         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)     β”‚  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“₯ Installation

Prerequisites

Step 1: Clone the Repository

git clone https://github.com/your-username/labinsight-ai.git
cd labinsight-ai

Step 2: Install Frontend Dependencies

# From project root
npm install

Step 3: Install Backend Dependencies

cd Backend-Node
npm install
cd ..

Step 4: Install AI Service Dependencies

cd AI-Service
pip install -r requirements.txt
cd ..

βš™οΈ Configuration

Backend Environment Variables

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:5001

AI Service Environment Variables

Create 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/LabInsight

Firebase Configuration (Google OAuth)

The Firebase configuration is already set up in src/components/firebase.ts. If you want to use your own Firebase project:

  1. Go to Firebase Console
  2. Create a new project
  3. Enable Google Authentication
  4. Update the config in firebase.ts

πŸš€ Running the Application

Option 1: Run All Services

Open 3 terminal windows:

Terminal 1 - Frontend:

npm run dev

Frontend runs at: http://localhost:5173

Terminal 2 - Backend:

cd Backend-Node
node server.js

Backend runs at: http://localhost:5000

Terminal 3 - AI Service:

cd AI-Service
python ai_service.py

AI Service runs at: http://localhost:5001

Option 2: Using Concurrent Scripts (Optional)

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"
  }
}

πŸ“š API Documentation

Swagger UI

Once the backend is running, access the interactive API documentation at:

http://localhost:5000/api-docs

Key API Endpoints

Authentication

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

User Profile & Reports

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

Doctor Routes

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

Admin Routes

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

AI Service

Method Endpoint Description
POST /analyze Analyze PDF report
GET /chat/latest-report?email= Get latest report info
POST /chat/ask Ask AI a question

πŸ‘₯ User Roles & Flows

Flow 1: User Registration & Report Analysis

Sign Up β†’ Login β†’ Upload Report β†’ View AI Analysis β†’ Chat with AI

Flow 2: Patient-Doctor Connection

Login β†’ Browse Doctors β†’ Send Request β†’ (Doctor Accepts) β†’ View Assigned Doctor

Flow 3: Doctor Workflow

Login β†’ View Dashboard β†’ Check Requests β†’ Accept/Reject β†’ View Patients β†’ Add Comments

Flow 4: Admin Management

Login β†’ Dashboard β†’ Manage Users β†’ Manage Doctors β†’ View Reports

πŸ“ Project Structure

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

πŸ‘¨β€πŸ’» Team Members

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

πŸ“Έ Screenshots

Landing Page

alt text

User Dashboard

alt text

AI Chat Assistant

alt text

Admin Dashboard

alt text

Doctor Portal

alt text


πŸ”’ Security Features

  • 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

πŸ“„ License

This project is created for educational purposes as part of INFO 6150 - Fall 2025.


πŸ™ Acknowledgments


⚠️ Disclaimer

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.

About

INFO 6150 Web Dev Project - Full-stack AI healthcare app to analyze lab reports, get health insights, and connect with doctors.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors