Skip to content

KanishqGandharv219/help-yourself-mental-health-app

Repository files navigation

Help Yourself - Mental Health AI Assistant

A comprehensive Android application designed to provide mental health support, wellness tracking, and AI-powered assistance. Built with modern Android development practices and a Python backend server with RAG (Retrieval Augmented Generation) capabilities.

Overview

Help Yourself (also known as Custom AI Assistant) is an intelligent mental health companion app that combines:

  • AI-Powered Conversations: Chat with an empathetic AI assistant powered by local Ollama models with RAG
  • Mental Health Assessments: Self-assessment tests for depression, anxiety, and stress
  • Wellness Tracking: Track and monitor your mental health metrics over time
  • Resource Discovery: Find nearby therapy centers and mental health resources using Google Maps
  • Educational Resources: Access curated mental health and academic resources
  • Crisis Support: Built-in crisis detection and helpline information for India

Features

Core Features

  • AI Chat Assistant: Conversational AI with context-aware responses using RAG
Screenshot_20250703_022714 Screenshot_20250703_022323 Screenshot_20250703_022323 Screenshot_20250703_022558 Screenshot_20250703_022639
  • Mental Health Assessments:
Screenshot_20250703_022911 Screenshot_20250703_022937
  • Depression Test (PHQ-9 based)
Screenshot_20250703_023158
  • Anxiety Test (GAD-7 based)
Screenshot_20250703_023219
  • Stress Test
Screenshot_20250703_023233
  • Wellness Tracking: Track depression, anxiety, and stress levels over time
Screenshot_20250703_023507
  • Nearby Resources: Find therapy centers and mental health facilities using Google Maps
Screenshot_20250703_023118
  • Resource Library: Access mental health and academic resources
Screenshot_20250703_022747
  • Breathing Exercises: Guided breathing exercises for stress relief
Screenshot_2026-01-18-10-43-57-77_957b39ce7caa0d8ecb2d9a9eb9b96f66
  • Personalized Reviews: AI-generated personalized mental health reviews using Google Gemini
Screenshot_20250703_023547
  • Web Search Integration: Tavily API integration for real-time information retrieval
image
  • Firebase Authentication: Secure user authentication with Google, Email, and Phone sign-in
image Screenshot_20250703_022836

Technical Features

  • Modern Android Architecture: MVVM pattern with Jetpack Compose
  • Dependency Injection: Dagger Hilt for clean architecture
  • Local AI Processing: Ollama integration for privacy-focused AI responses
  • RAG Implementation: Retrieval Augmented Generation for context-aware responses
  • Real-time Data: Firebase Realtime Database for data synchronization
  • Offline Support: Local caching and offline capabilities

Architecture

Android App

  • Language: Kotlin
  • UI Framework: Jetpack Compose
  • Architecture: MVVM (Model-View-ViewModel)
  • Dependency Injection: Dagger Hilt
  • Networking: Retrofit + OkHttp
  • Database: Room Database (local) + Firebase Realtime Database (cloud)
  • Authentication: Firebase Auth

Backend Server

  • Framework: Flask (Python)
  • AI Model: Ollama (Qwen2.5, Nomic Embed)
  • Vector Database: ChromaDB
  • RAG: LangChain with Ollama embeddings
  • CORS: Enabled for cross-origin requests

Prerequisites

For Android Development

  • Android Studio Hedgehog (2023.1.1) or later
  • JDK 17 or later
  • Android SDK (API 24+)
  • Gradle 8.0+

For Backend Server

  • Python 3.10 or later
  • Ollama installed and running locally
  • Required Python packages (see server/requirements.txt)

API Keys Required

  • Firebase: For authentication and database
  • Google Maps API: For location services
  • Google Gemini API: For personalized reviews
  • Tavily API: For web search integration

Getting Started

1. Clone the Repository

git clone <repository-url>
cd final

2. Android App Setup

Step 1: Configure Firebase

  1. Create a Firebase project at Firebase Console
  2. Add an Android app to your Firebase project
  3. Download google-services.json
  4. Place it in:
    • app/compose-chatgpt-kotlin-android-chatbot/app/google-services.json
    • app/compose-chatgpt-kotlin-android-chatbot/app/src/main/google-services.json

Step 2: Configure API Keys

  1. Create local.properties file in app/compose-chatgpt-kotlin-android-chatbot/:

    sdk.dir=/path/to/your/android/sdk
    GEMINI_API_KEY=your_gemini_api_key_here
    TAVILY_API_KEY=your_tavily_api_key_here
  2. Create secrets.xml in app/compose-chatgpt-kotlin-android-chatbot/app/src/main/res/values/:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="google_maps_api_key">your_google_maps_api_key_here</string>
    </resources>

Step 3: Build and Run

cd app/compose-chatgpt-kotlin-android-chatbot
./gradlew assembleDebug

Or open the project in Android Studio and run it.

3. Backend Server Setup

Step 1: Install Ollama

# Visit https://ollama.ai/ for installation instructions
# Pull required models
ollama pull qwen2.5:latest
ollama pull nomic-embed-text

Step 2: Install Python Dependencies

cd server
pip install -r requirements.txt

Step 3: Configure Server

Update the server URL in NetworkModule.kt if needed:

  • For emulator: http://10.0.2.2:5002/
  • For physical device: Update LOCAL_DEVICE_URL with your computer's IP

Step 4: Run the Server

cd server
python server.py
# Server runs on http://localhost:5002

Project Structure

final/
├── app/
│   └── compose-chatgpt-kotlin-android-chatbot/
│       ├── app/
│       │   ├── src/main/
│       │   │   ├── java/com/helpyourself/com/
│       │   │   │   ├── data/          # Data layer (repositories, API services)
│       │   │   │   ├── di/            # Dependency injection modules
│       │   │   │   ├── ui/            # UI components (Compose screens)
│       │   │   │   │   ├── conversations/  # Chat screens
│       │   │   │   │   ├── screens/      # Feature screens
│       │   │   │   │   └── resources/    # Resource screens
│       │   │   │   └── utils/         # Utility classes
│       │   │   └── res/               # Resources (layouts, drawables, etc.)
│       │   └── build.gradle
│       ├── build.gradle
│       ├── local.properties           # API keys (excluded from Git)
│       └── README.md
├── server/
│   ├── server.py                      # Main Flask server
│   ├── app.py                         # Alternative server implementation
│   ├── direct_ollama.py              # Direct Ollama integration
│   ├── requirements.txt              # Python dependencies
│   └── chroma_db/                     # Vector database storage
├── ollama_rag/
│   ├── app.py                         # RAG Flask app
│   ├── modelrag.py                    # RAG model implementation
│   └── simple_rag.py                 # Simple RAG implementation
├── fine_tuned/                        # Fine-tuned model files
├── .gitignore                         # Git ignore rules
└── README.md                          # This file

Configuration

Environment Variables

The app uses local.properties for sensitive configuration. This file is excluded from version control. Create it with:

# Android SDK location
sdk.dir=/path/to/android/sdk

# API Keys
GEMINI_API_KEY=your_gemini_api_key
TAVILY_API_KEY=your_tavily_api_key

Firebase Configuration

  1. Enable Authentication providers in Firebase Console:

    • Google Sign-In
    • Email/Password
    • Phone Authentication
  2. Set up Firebase Realtime Database rules (see database.rules.json)

  3. Configure OAuth clients for Google Sign-In

Technologies Used

Android

  • Jetpack Compose: Modern declarative UI framework
  • Kotlin Coroutines: Asynchronous programming
  • Dagger Hilt: Dependency injection
  • Retrofit: HTTP client
  • Room: Local database
  • Firebase: Authentication, Realtime Database
  • Google Maps SDK: Location services
  • Material Design 3: UI components

Backend

  • Flask: Python web framework
  • Ollama: Local LLM inference
  • LangChain: RAG framework
  • ChromaDB: Vector database
  • Tiktoken: Tokenization

APIs

  • Google Gemini API: AI-powered reviews
  • Tavily API: Web search
  • Google Maps API: Location services

Security

  • All API keys are stored in local.properties (excluded from Git)
  • Firebase security rules implemented
  • No sensitive data in source code
  • See SECURITY.md for more details

Development Notes

Running the Backend

The backend server must be running for the app to function properly. Default port is 5002.

Testing

  • Unit tests: ./gradlew test
  • Instrumented tests: ./gradlew connectedAndroidTest

Building Release APK

./gradlew assembleRelease

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

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

License

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

Author

Kanishq Gandharv

Acknowledgments

Important Notes

Crisis Support

This app includes mental health resources and crisis helplines for India:

  • Tele-Manas: 14416 (24×7 Government helpline)
  • Kiran: 1800-599-0019 (National Mental Health Rehab Helpline)
  • Aasra: +91-22-27546669 (24×7 Suicide Prevention)

This app is not a replacement for professional mental health care. If you're experiencing a mental health crisis, please contact a licensed mental health professional or emergency services immediately.

API Keys

  • Never commit API keys to version control
  • All sensitive keys are stored in local.properties which is excluded via .gitignore
  • Create your own API keys from respective providers

Support

For issues, questions, or contributions:


Made with ❤️ for mental health awareness and support

About

Help Yourself is an Android mental health app featuring an AI chat assistant with RAG, PHQ-9/GAD-7 assessments, wellness tracking, breathing exercises, and India-specific crisis support, powered by Ollama, LangChain, and Google Gemini.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors