Skip to content

Khurshed-14/DermaDoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DermaDoc Logo

DermaDoc: A Multi-Agent Dermatologist

A Project for CSE327 - Software Engineering | North South University

DermaDoc is an AI-powered skin health assistant that helps users analyze skin conditions, get personalized recommendations, and chat with an AI dermatologist. The application uses deep learning models for skin lesion classification and Google Gemini AI for intelligent conversations about skin health.

πŸš€ Features

  • AI-Powered Skin Analysis: Upload skin images and get instant predictions for 7 different skin conditions
  • Intelligent Chatbot: Chat with DermaDoc, a specialized AI assistant for dermatology questions
  • Personalized Recommendations: Get tailored advice based on your skin analysis results
  • User Dashboard: Track your skin check history and results
  • Secure Authentication: JWT-based authentication with password hashing
  • Real-time Processing: Background task processing for image classification

πŸ“‹ Table of Contents

πŸ—οΈ Architecture

DermaDoc follows a full-stack architecture with clear separation between frontend and backend:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React Frontendβ”‚  ──────▢│  FastAPI Backendβ”‚  ──────▢│    MongoDB      β”‚
β”‚   (Port 5173)   β”‚         β”‚   (Port 8000)   β”‚         β”‚  (Port 27017)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚  Google Gemini  β”‚
                            β”‚      API       β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚  PyTorch Model  β”‚
                            β”‚  (EfficientNet) β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

  1. Frontend: React SPA with Vite, Tailwind CSS, and shadcn/ui components
  2. Backend: FastAPI REST API with async MongoDB operations
  3. Database: MongoDB for user data and skin check results
  4. AI Services:
    • Google Gemini 2.5 Flash Lite for chatbot
    • PyTorch EfficientNet-B4 for skin lesion classification

πŸ› οΈ Tech Stack

Frontend

  • React 18 - UI library
  • Vite - Build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • shadcn/ui - High-quality component library
  • TanStack Query - Data fetching and state management
  • React Router - Client-side routing
  • Lucide React - Icon library
  • Sonner - Toast notifications

Backend

  • FastAPI - Modern Python web framework
  • MongoDB - NoSQL database
  • Motor - Async MongoDB driver
  • PyTorch - Deep learning framework
  • Google Generative AI - Gemini API integration
  • JWT - Authentication tokens
  • bcrypt - Password hashing
  • uv - Fast Python package manager

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 18+ and pnpm (or npm/yarn)
  • Python 3.11+
  • MongoDB 6.0+ (running locally or remote)
  • uv package manager (for Python)
  • Google Gemini API Key (for chatbot functionality)

πŸš€ Quick Start

1. Clone the Repository

git clone <repository-url>
cd DermaDoc

2. Backend Setup

# Navigate to backend directory
cd backend

# Install uv (if not already installed)
# Windows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install dependencies
uv sync

# Create .env file
cp .env.example .env
# Edit .env with your configuration (see Backend README for details)

# Start MongoDB (if running locally)
# Windows: mongod
# macOS: brew services start mongodb-community
# Linux: sudo systemctl start mongod

# Run the backend server
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000

The backend will be available at http://localhost:8000

3. Frontend Setup

# Navigate to frontend directory (from project root)
cd frontend

# Install dependencies
pnpm install

# Start the development server
pnpm dev

The frontend will be available at http://localhost:5173

4. Access the Application

Demo

dermascan.demo.mp4

πŸ“ Project Structure

DermaDoc/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/          # shadcn/ui components
β”‚   β”‚   β”‚   β”œβ”€β”€ Chatbot.jsx  # AI chatbot component
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SkinCheck.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Results.jsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ contexts/        # React contexts
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthContext.jsx
β”‚   β”‚   β”‚   └── ChatbotContext.jsx
β”‚   β”‚   β”œβ”€β”€ hooks/           # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ lib/             # Utility functions
β”‚   β”‚   β”‚   β”œβ”€β”€ api.js       # API client
β”‚   β”‚   β”‚   └── utils.js
β”‚   β”‚   └── main.jsx         # Entry point
β”‚   β”œβ”€β”€ public/              # Static assets
β”‚   β”‚   └── logo.png
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ backend/                 # FastAPI backend application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ core/            # Core configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ config.py    # Settings and environment variables
β”‚   β”‚   β”‚   β”œβ”€β”€ database.py  # MongoDB connection
β”‚   β”‚   β”‚   β”œβ”€β”€ security.py  # JWT and password hashing
β”‚   β”‚   β”‚   └── storage.py   # File storage utilities
β”‚   β”‚   β”œβ”€β”€ models/          # Pydantic models
β”‚   β”‚   β”‚   β”œβ”€β”€ user.py
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py
β”‚   β”‚   β”‚   └── skin_check.py
β”‚   β”‚   β”œβ”€β”€ routers/         # API route handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py      # Authentication endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.py      # Chatbot endpoints (streaming)
β”‚   β”‚   β”‚   β”œβ”€β”€ chat_sync.py # Chatbot endpoints (sync)
β”‚   β”‚   β”‚   └── skin_check.py # Skin check endpoints
β”‚   β”‚   └── services/        # Business logic
β”‚   β”‚       β”œβ”€β”€ classifier.py      # Skin lesion classification
β”‚   β”‚       └── background_tasks.py # Async task processing
β”‚   β”œβ”€β”€ CNN models/          # Trained PyTorch models
β”‚   β”‚   └── efficientnetb4_classifier.pth
β”‚   β”œβ”€β”€ storage/             # User-uploaded files
β”‚   β”‚   β”œβ”€β”€ user_images/
β”‚   β”‚   └── skin_check_images/
β”‚   β”œβ”€β”€ main.py              # FastAPI application entry point
β”‚   β”œβ”€β”€ pyproject.toml       # Python dependencies
β”‚   └── README.md            # Backend-specific documentation
β”‚
└── README.md                # This file

πŸ’» Development

Frontend Development

cd frontend

# Start development server with hot reload
pnpm dev

# Build for production
pnpm build

# Preview production build
pnpm preview

# Install new dependencies
pnpm add <package-name>

# Install dev dependencies
pnpm add -D <package-name>

Backend Development

cd backend

# Run with auto-reload
uv run uvicorn main:app --reload

# Run with specific host and port
uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Add new dependencies
uv add <package-name>

# Add dev dependencies
uv add --dev <package-name>

Environment Variables

See backend/README.md for detailed environment variable configuration.

🚒 Deployment

Frontend Deployment

  1. Build the production bundle:
cd frontend
pnpm build
  1. The dist/ folder contains the production-ready files
  2. Deploy to your preferred hosting service (Vercel, Netlify, etc.)

Backend Deployment

  1. Ensure all environment variables are set in production
  2. Use a production ASGI server:
uv run uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
  1. Or use Gunicorn with Uvicorn workers:
uv run gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker
  1. Set up MongoDB (local or cloud like MongoDB Atlas)
  2. Configure CORS origins for your frontend domain

πŸ“š Additional Documentation

  • Backend README - Detailed backend documentation, API endpoints, and database schemas
  • API Documentation - Interactive Swagger UI (when backend is running)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Frontend: Follow React best practices, use ESLint/Prettier
  • Backend: Follow PEP 8, use type hints, document functions

πŸ“ License

This project is part of CSE327 - Software Engineering course at North South University.

πŸ‘₯ Team

CSE327 Team 2


For detailed API documentation and backend setup instructions, see backend/README.md.

About

A Project for CSE327 - Software Engineering | North South University

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors