Skip to content

Ghala-s/Khushu

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Khushu - Islamic Prayer Focus Enhancement System

WINNER OF MSAHACKS 2025 - SECOND PLACE PRIZE πŸ₯ˆ!

Overview

Khushu is an innovative application designed to help Muslims enhance their focus and mindfulness during prayer (salah), but is particularly useful for people with ADHD, autism, anxiety, OCD, and sensory processing sensitivity. Using advanced EEG monitoring through the Muse headband, real-time analysis, and AI-powered guidance, the system provides actionable insights and personalized recommendations to improve prayer quality and spiritual connection.

Features

  • Real-time EEG Monitoring: Tracks brain activity during prayer using Muse headband
  • Khushu Index: Proprietary algorithm measuring prayer focus using multiple brainwave bands:
    • Alpha (8-13 Hz): Relaxed focus
    • Theta (4-8 Hz): Deep meditation
    • Beta (13-30 Hz): Active thinking
    • Delta (0.5-4 Hz): Deep focus
    • Gamma (30-70 Hz): Higher cognitive processes
  • Live Visualization: Dynamic display of brainwave patterns and focus metrics
  • AI Assistant: GPT-4 powered guidance system with Islamic prayer expertise
  • Historical Analysis: Detailed tracking of prayer sessions and progress
  • Condition-Specific Support: Specialized guidance for users with ADHD, autism, anxiety, OCD, and sensory processing sensitivity

Technology Stack

Frontend

  • HTML5/CSS3 with responsive design
  • Vanilla JavaScript
  • Chart.js for real-time data visualization
  • Custom animations and transitions

Backend

  • Python 3.x
  • Flask (REST API)
  • OpenAI GPT-4 API
  • Pylsl for EEG data streaming
  • NumPy/Pandas for data processing
  • Matplotlib for data visualization

Prerequisites

  1. Hardware Requirements:

    • Muse EEG Headband (2016 model or newer)
    • Computer with Bluetooth capability
  2. Software Requirements:

    • Python 3.x
    • BlueMuse (Windows) or MuseLSL (macOS/Linux)
    • Modern web browser (Chrome/Firefox recommended)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/khushu.git
    cd khushu
  2. Install Python dependencies:

pip install -r requirements.txt
  1. Configure OpenAI API:
    • Update the API key in backend/api/chatbot.py
    • Or set as environment variable:
export OPENAI_API_KEY=your_api_key_here

Running the Application

  1. Start the Flask backend server:
cd backend
python server.py

The server will start on http://localhost:5001

  1. Start the Khushu monitoring service:
python khushu_index.py
  1. For motion detection via sensor logger on apple watch to detect which movements in prayer are done (as each movement has different focus levels i.e. bowing, standing, prostrating, etc.) (optional):
python handmotion.py
  1. Access the frontend:
  • Open frontend/index.html in your web browser
  • Navigate through the available features:
    • Overall Results (khushu-level.html)
    • Ask AI (ai-page.html)
    • Live Demo (live.html)

Project Structure

khushu/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── chatbot.py          # AI assistant implementation
β”‚   β”œβ”€β”€ server.py               # Main Flask server
β”‚   β”œβ”€β”€ khushu_index.py         # EEG processing & analysis
β”‚   β”œβ”€β”€ handmotion.py           # Prayer position detection
β”‚   β”œβ”€β”€ khushu_results.csv      # Historical session data
β”‚   └── detailed_session.csv    # Real-time session data
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ main-styles.css
β”‚   β”‚   β”œβ”€β”€ khushu-level.css
β”‚   β”‚   β”œβ”€β”€ ai-styles.css
β”‚   β”‚   └── live-styles.css
β”‚   β”œβ”€β”€ index.html             # Landing page
β”‚   β”œβ”€β”€ khushu-level.html      # Results dashboard
β”‚   β”œβ”€β”€ ai-page.html           # AI assistant interface
β”‚   └── live.html              # Real-time monitoring
└── requirements.txt

Features in Detail

Live Monitoring

  • Real-time brainwave visualization with 5 frequency bands
  • Dynamic Khushu Index calculation using weighted algorithm
  • Instant feedback with focus level indicators
  • Prayer position detection (optional)

AI Assistant

  • Personalized recommendations based on:
    • Current Khushu Index
    • Historical prayer data
    • Selected conditions/challenges
    • Islamic principles and teachings
  • Support for multiple neurological conditions
  • Context-aware spiritual guidance

Analytics Dashboard

  • Historical prayer session data
  • Progress tracking with detailed metrics
  • Focus level trends and patterns
  • Exportable session data

https://www.youtube.com/watch?v=eJsyAqBAd58

Acknowledgments

  • Muse by InteraXon for EEG hardware
  • OpenAI for GPT-4 integration
  • Chart.js team for visualization library
  • The Muslim developer community for feedback and support

Note

This project is intended as a supplementary tool for prayer enhancement and should not be considered a replacement for traditional Islamic teachings or guidance from qualified religious scholars.

About

WINNER OF MSAHACKS 2025 - SECOND PLACE PRIZE πŸ₯ˆ!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 90.1%
  • JavaScript 7.3%
  • Cython 1.9%
  • C 0.5%
  • C++ 0.2%
  • HTML 0.0%