HiteshSonetaNEU/Mental-health-Assistant

0

stars

7

commits

Python

primary language

Aug 15, 2025

updated

README

Mental Health AI Assistant

A sophisticated generative AI system that provides mental health support through voice chat, mood tracking, and analytics. Built with Flutter (frontend) and Python FastAPI (backend).

🎯 Project Overview

This application demonstrates mastery of generative AI technologies including:

  • Prompt Engineering: Systematic prompting strategies for mental health conversations
  • Multimodal Integration: Voice chat with speech-to-text and text-to-speech capabilities
  • Real-time emotion detection and mood analysis
  • Comprehensive analytics and data visualization

πŸ—οΈ Project Structure

Mental-Health-AI-Assistant/
β”œβ”€β”€ mental_health_chatbot/          # Python Backend (FastAPI)
β”‚   β”œβ”€β”€ chatbot_api.py             # Main API server
β”‚   β”œβ”€β”€ database.py                # Database models
β”‚   β”œβ”€β”€ emotion_detection.py       # AI emotion analysis
β”‚   β”œβ”€β”€ voice_processing.py        # Speech processing
β”‚   β”œβ”€β”€ requirements.txt           # Python dependencies
β”‚   └── chatbot_env/              # Virtual environment
β”‚
β”œβ”€β”€ mental_health_chat_ui/          # Flutter Frontend
β”‚   β”œβ”€β”€ lib/                      # Dart source code
β”‚   β”œβ”€β”€ android/                  # Android platform
β”‚   β”œβ”€β”€ ios/                      # iOS platform
β”‚   β”œβ”€β”€ web/                      # Web platform
β”‚   β”œβ”€β”€ windows/                  # Windows platform
β”‚   └── pubspec.yaml             # Flutter dependencies
β”‚
β”œβ”€β”€ mental_health.db               # SQLite database
└── README.md                     # This file

πŸš€ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/HiteshSonetaNEU/Mental-health-Assistant
cd Mental-Health-AI-Assistant

2. Backend Setup (Python)

# Navigate to backend directory
cd mental_health_chatbot

# Create virtual environment (recommended)
python -m venv chatbot_env

# Activate virtual environment
# On Windows:
chatbot_env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start backend server
python chatbot_api.py

The backend will be available at:

3. Flutter Setup & Frontend

Install Flutter SDK

  1. Download Flutter:

    • Visit Flutter Install Guide
    • Download Flutter SDK for Windows
    • Extract to C:\flutter (or your preferred location)
  2. Add Flutter to PATH:

    # Add to your system PATH environment variable:
    C:\flutter\bin
    
  3. Verify Installation:

    flutter doctor
    
  4. Enable Web Support:

    flutter config --enable-web
    

Run Frontend

# Navigate to frontend directory
cd mental_health_chat_ui

# Install dependencies
flutter pub get

# Run on Chrome (Recommended)
flutter run -d chrome

# Alternative: Run on web server
flutter run -d web-server --web-port 3000

The frontend will be available at:

🎯 Features

πŸ—£οΈ Voice Chat

  • Real-time speech-to-text conversion
  • AI-powered text-to-speech responses
  • Multimodal conversation experience

πŸ“Š Mood Tracking

  • Daily mood journal entries
  • Emotion detection and analysis
  • Mood rating system (1-10)

πŸ“ˆ Analytics Dashboard

  • Mood trends visualization
  • Weekly activity patterns
  • Data export functionality

🧘 Self-Help Tools

  • Guided breathing exercises
  • Cognitive Behavioral Therapy (CBT) techniques
  • Daily affirmations

πŸ› οΈ Development

Backend API Endpoints

  • POST /chat - Chat with AI assistant
  • POST /mood-entry - Save mood journal entries
  • GET /analytics/mood-trends - Get mood analytics
  • GET /analytics/weekly-patterns - Get activity patterns
  • GET /self-help-recommendations - Get self-help suggestions

Frontend Screens

  • Chat Screen: Voice/text chat with AI
  • Mood Journal: Daily mood tracking
  • Analytics: Data visualization
  • Self-Help: Wellness activities

Database Schema

  • MoodEntry: Mood ratings and journal entries
  • ChatMessage: Conversation history
  • SelfHelpActivity: Completed wellness activities

πŸ”§ Troubleshooting

Common Issues

  1. Flutter not found:

    # Ensure Flutter is in PATH
    echo $env:PATH | Select-String flutter
    
  2. Backend dependencies:

    # Reinstall Python packages
    pip install --force-reinstall -r requirements.txt
    
  3. Database issues:

    # Delete and recreate database
    rm mental_health.db
    python chatbot_api.py  # Will recreate automatically
    
  4. Port conflicts:

    # Kill processes using port 8000
    taskkill /F /IM python.exe
    

Flutter Doctor Issues

# Check Flutter installation
flutter doctor -v

# Accept Android licenses (if using Android)
flutter doctor --android-licenses

# Update Flutter
flutter upgrade

πŸ“± Platform Support

  • βœ… Web (Chrome, Firefox, Safari)
  • βœ… Windows (Desktop app)
  • βœ… Android (Mobile app)
  • βœ… iOS (Mobile app)

πŸ”’ Privacy & Security

  • All data stored locally in SQLite database
  • No external data transmission except to AI model API
  • Voice processing handled locally when possible
  • User data can be exported/deleted at any time

πŸ“š Technical Stack

Backend

  • Python 3.11+ - Core language
  • FastAPI - Web framework
  • SQLite - Database
  • Transformers - AI models
  • Whisper - Speech recognition
  • TTS - Text-to-speech

Frontend

  • Flutter - Cross-platform framework
  • Dart - Programming language
  • HTTP - API communication
  • Speech-to-Text - Voice input
  • Flutter TTS - Voice output

🀝 Contributing

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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

For issues or questions:

  1. Check troubleshooting section above
  2. Review Flutter documentation
  3. Check FastAPI documentation
  4. Open an issue in the repository

πŸŽ“ Assignment Requirements Met

Core Components

  • βœ… Prompt Engineering: Systematic mental health conversation prompts
  • βœ… Multimodal Integration: Voice + text chat capabilities

Technical Implementation

  • βœ… Complete source code with documentation
  • βœ… Cross-platform Flutter application
  • βœ… RESTful API with comprehensive endpoints
  • βœ… Real-time AI emotion detection
  • βœ… Data visualization and analytics

User Experience

  • βœ… Intuitive voice chat interface
  • βœ… Responsive design across platforms
  • βœ… Error handling and recovery
  • βœ… Performance optimization

Built with ❀️ for mental health support

Contributors

HiteshSonetaNEU/Mental-health-Assistant

0

stars

7

commits

Python

primary language

Aug 15, 2025

updated

README

Mental Health AI Assistant

A sophisticated generative AI system that provides mental health support through voice chat, mood tracking, and analytics. Built with Flutter (frontend) and Python FastAPI (backend).

🎯 Project Overview

This application demonstrates mastery of generative AI technologies including:

  • Prompt Engineering: Systematic prompting strategies for mental health conversations
  • Multimodal Integration: Voice chat with speech-to-text and text-to-speech capabilities
  • Real-time emotion detection and mood analysis
  • Comprehensive analytics and data visualization

πŸ—οΈ Project Structure

Mental-Health-AI-Assistant/
β”œβ”€β”€ mental_health_chatbot/          # Python Backend (FastAPI)
β”‚   β”œβ”€β”€ chatbot_api.py             # Main API server
β”‚   β”œβ”€β”€ database.py                # Database models
β”‚   β”œβ”€β”€ emotion_detection.py       # AI emotion analysis
β”‚   β”œβ”€β”€ voice_processing.py        # Speech processing
β”‚   β”œβ”€β”€ requirements.txt           # Python dependencies
β”‚   └── chatbot_env/              # Virtual environment
β”‚
β”œβ”€β”€ mental_health_chat_ui/          # Flutter Frontend
β”‚   β”œβ”€β”€ lib/                      # Dart source code
β”‚   β”œβ”€β”€ android/                  # Android platform
β”‚   β”œβ”€β”€ ios/                      # iOS platform
β”‚   β”œβ”€β”€ web/                      # Web platform
β”‚   β”œβ”€β”€ windows/                  # Windows platform
β”‚   └── pubspec.yaml             # Flutter dependencies
β”‚
β”œβ”€β”€ mental_health.db               # SQLite database
└── README.md                     # This file

πŸš€ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/HiteshSonetaNEU/Mental-health-Assistant
cd Mental-Health-AI-Assistant

2. Backend Setup (Python)

# Navigate to backend directory
cd mental_health_chatbot

# Create virtual environment (recommended)
python -m venv chatbot_env

# Activate virtual environment
# On Windows:
chatbot_env\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start backend server
python chatbot_api.py

The backend will be available at:

3. Flutter Setup & Frontend

Install Flutter SDK

  1. Download Flutter:

    • Visit Flutter Install Guide
    • Download Flutter SDK for Windows
    • Extract to C:\flutter (or your preferred location)
  2. Add Flutter to PATH:

    # Add to your system PATH environment variable:
    C:\flutter\bin
    
  3. Verify Installation:

    flutter doctor
    
  4. Enable Web Support:

    flutter config --enable-web
    

Run Frontend

# Navigate to frontend directory
cd mental_health_chat_ui

# Install dependencies
flutter pub get

# Run on Chrome (Recommended)
flutter run -d chrome

# Alternative: Run on web server
flutter run -d web-server --web-port 3000

The frontend will be available at:

🎯 Features

πŸ—£οΈ Voice Chat

  • Real-time speech-to-text conversion
  • AI-powered text-to-speech responses
  • Multimodal conversation experience

πŸ“Š Mood Tracking

  • Daily mood journal entries
  • Emotion detection and analysis
  • Mood rating system (1-10)

πŸ“ˆ Analytics Dashboard

  • Mood trends visualization
  • Weekly activity patterns
  • Data export functionality

🧘 Self-Help Tools

  • Guided breathing exercises
  • Cognitive Behavioral Therapy (CBT) techniques
  • Daily affirmations

πŸ› οΈ Development

Backend API Endpoints

  • POST /chat - Chat with AI assistant
  • POST /mood-entry - Save mood journal entries
  • GET /analytics/mood-trends - Get mood analytics
  • GET /analytics/weekly-patterns - Get activity patterns
  • GET /self-help-recommendations - Get self-help suggestions

Frontend Screens

  • Chat Screen: Voice/text chat with AI
  • Mood Journal: Daily mood tracking
  • Analytics: Data visualization
  • Self-Help: Wellness activities

Database Schema

  • MoodEntry: Mood ratings and journal entries
  • ChatMessage: Conversation history
  • SelfHelpActivity: Completed wellness activities

πŸ”§ Troubleshooting

Common Issues

  1. Flutter not found:

    # Ensure Flutter is in PATH
    echo $env:PATH | Select-String flutter
    
  2. Backend dependencies:

    # Reinstall Python packages
    pip install --force-reinstall -r requirements.txt
    
  3. Database issues:

    # Delete and recreate database
    rm mental_health.db
    python chatbot_api.py  # Will recreate automatically
    
  4. Port conflicts:

    # Kill processes using port 8000
    taskkill /F /IM python.exe
    

Flutter Doctor Issues

# Check Flutter installation
flutter doctor -v

# Accept Android licenses (if using Android)
flutter doctor --android-licenses

# Update Flutter
flutter upgrade

πŸ“± Platform Support

  • βœ… Web (Chrome, Firefox, Safari)
  • βœ… Windows (Desktop app)
  • βœ… Android (Mobile app)
  • βœ… iOS (Mobile app)

πŸ”’ Privacy & Security

  • All data stored locally in SQLite database
  • No external data transmission except to AI model API
  • Voice processing handled locally when possible
  • User data can be exported/deleted at any time

πŸ“š Technical Stack

Backend

  • Python 3.11+ - Core language
  • FastAPI - Web framework
  • SQLite - Database
  • Transformers - AI models
  • Whisper - Speech recognition
  • TTS - Text-to-speech

Frontend

  • Flutter - Cross-platform framework
  • Dart - Programming language
  • HTTP - API communication
  • Speech-to-Text - Voice input
  • Flutter TTS - Voice output

🀝 Contributing

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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

For issues or questions:

  1. Check troubleshooting section above
  2. Review Flutter documentation
  3. Check FastAPI documentation
  4. Open an issue in the repository

πŸŽ“ Assignment Requirements Met

Core Components

  • βœ… Prompt Engineering: Systematic mental health conversation prompts
  • βœ… Multimodal Integration: Voice + text chat capabilities

Technical Implementation

  • βœ… Complete source code with documentation
  • βœ… Cross-platform Flutter application
  • βœ… RESTful API with comprehensive endpoints
  • βœ… Real-time AI emotion detection
  • βœ… Data visualization and analytics

User Experience

  • βœ… Intuitive voice chat interface
  • βœ… Responsive design across platforms
  • βœ… Error handling and recovery
  • βœ… Performance optimization

Built with ❀️ for mental health support

Contributors

Languages

Python

69.6%

C++

17.6%

CMake

9.5%

HTML

1.1%