Skip to content
darkmaster0345Public

About

Hayat AI is an offline-first, mobile medical assistant designed for high-conflict and crisis zones like Gaza and Kashmir. It provides physician-validated emergency protocols (trauma, surgery, first aid) without requiring an internet connection.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Hayat AI - Offline Medical Assistant

Platform Language UI License

Hayat (Arabic for "Life") is an offline-first AI medical assistant designed for crisis zones, remote areas, and situations where internet connectivity and hospitals are unavailable. Built with privacy and accessibility in mind.

🎯 Mission

Provide life-saving medical guidance in emergency situations when:

  • Internet connectivity is unavailable or unreliable
  • Hospitals/clinics are inaccessible (conflict zones, natural disasters)
  • Professional medical help is not immediately available
  • Language barriers exist (supports English & Arabic)

✨ Features

Core Functionality

  • Offline LLM Inference: Runs locally on device using GGUF quantized models
  • RAG-Powered Responses: Retrieval-Augmented Generation prevents hallucinations by grounding answers in verified medical protocols
  • Vector Search: Semantic search through ICRC/WHO emergency guidelines
  • Bilingual Support: Full English and Arabic interface with RTL layout support
  • Privacy-First: No data leaves your device, no tracking, no analytics

Distribution Features

  • P2P Sharing: Share app and medical assets via Bluetooth/WiFi Direct
  • Printable Cheat Sheets: Generate 1-page PDF emergency protocol summaries
  • APK Export: Bundle app with models for offline distribution
  • Low-End Device Support: Optimized for devices with limited RAM/storage

Safety Features

  • Triple-Check Validation: All responses validated against medical database
  • Clear Disclaimers: Every response includes a medical disclaimer
  • Source Attribution: Shows which protocol each answer comes from
  • Refusal Messages: Gracefully declines queries outside medical scope

πŸ“‹ Requirements

Minimum Specifications

  • Android 8.0 (API 26) or higher
  • 2GB RAM (3GB+ recommended)
  • 1.5GB free storage space
  • ARM64-v8a processor (ARMv7 supported with reduced performance)

Required Model Files

Place these files in /sdcard/Hayat/:

File Size Description Download Source
model.gguf ~600MB-1.1GB Quantized medical LLM HuggingFace
e5-small.onnx ~67MB Embedding model HuggingFace
medical.db ~44KB Emergency protocols DB Bundled with app

Recommended Models:

  • LLM: Medical-Llama-3-8B-GGUF (Q4_K_M quantization) or TinyLlama-1.1B-Chat-v1.0-GGUF for low-end devices
  • Embeddings: multilingual-e5-small (ONNX format) for English/Arabic support

πŸš€ Setup Instructions

Option 1: Manual Setup (Recommended for Testing)

  1. Clone the Repository

    git clone https://github.com/your-org/hayat-ai.git
    cd hayat-ai
  2. Download Model Files

    # Create Hayat directory
    mkdir -p /sdcard/Hayat
    
    # Download medical LLM (choose one based on device specs)
    # For powerful devices (>4GB RAM):
    wget https://huggingface.co/TheBloke/Medical-Llama-3-8B-GGUF/resolve/main/medical-llama-3-8b.Q4_K_M.gguf -O /sdcard/Hayat/model.gguf
    
    # For low-end devices (<3GB RAM):
    wget https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf -O /sdcard/Hayat/model.gguf
    
    # Download embedding model
    wget https://huggingface.co/intfloat/multilingual-e5-small/resolve/main/onnx/model.onnx -O /sdcard/Hayat/e5-small.onnx
  3. Build and Install

    ./gradlew assembleDebug
    adb install app/build/outputs/apk/debug/app-debug.apk
  4. Copy Bundled Assets (if needed) The app will prompt you to copy medical databases from bundled assets on first launch.

Option 2: Android Studio

  1. Open project in Android Studio
  2. Sync Gradle files
  3. Connect Android device or start emulator (min 2GB RAM)
  4. Run app configuration

Option 3: Pre-built APK (For NGOs/Field Workers)

Download pre-built APK with models included (coming soon):

  • Full version (~1.2GB): Includes high-quality medical LLM
  • Lite version (~700MB): Uses TinyLlama for low-end devices

πŸ₯ Medical Content

The app includes emergency protocols from:

English Protocols

  • Bleeding Control (Direct Pressure, Tourniquets, Wound Packing)
  • Burn Treatment (Thermal, Chemical, Electrical)
  • Fracture Stabilization (Splinting, Immobilization)
  • CPR & Basic Life Support
  • Dehydration Management (ORS Preparation)
  • Wound Care & Infection Prevention
  • Emergency Triage (START Protocol)
  • Shock Management

Arabic Protocols (بروΨͺΩˆΩƒΩˆΩ„Ψ§Ψͺ عربية)

  • Ψ§Ω„ΨͺΨ­ΩƒΩ… في Ψ§Ω„Ω†Ψ²ΩŠΩ
  • ΨΉΩ„Ψ§Ψ¬ Ψ§Ω„Ψ­Ψ±ΩˆΩ‚
  • Ψ§Ω„ΨΉΩ†Ψ§ΩŠΨ© Ψ¨Ψ§Ω„ΩƒΨ³ΩˆΨ±
  • Ψ§Ω„Ψ₯Ω†ΨΉΨ§Ψ΄ Ψ§Ω„Ω‚Ω„Ψ¨ΩŠ Ψ§Ω„Ψ±Ψ¦ΩˆΩŠ
  • Ψ₯Ψ―Ψ§Ψ±Ψ© الجفاف
  • Ψ§Ω„ΨΉΩ†Ψ§ΩŠΨ© Ψ¨Ψ§Ω„Ψ¬Ψ±ΩˆΨ­
  • الفرز Ψ§Ω„Ψ·Ψ¨ΩŠ في Ψ­Ψ§Ω„Ψ§Ψͺ Ψ§Ω„Ψ·ΩˆΨ§Ψ±Ψ¦
  • Ψ₯Ψ―Ψ§Ψ±Ψ© Ψ§Ω„Ψ΅Ψ―Ω…Ψ©

All protocols sourced from:

  • International Committee of the Red Cross (ICRC)
  • World Health Organization (WHO) Emergency Guidelines
  • MΓ©decins Sans FrontiΓ¨res (MSF) Field Manuals

πŸ—οΈ Architecture

app/
β”œβ”€β”€ src/main/java/com/hayat/
β”‚   β”œβ”€β”€ MainActivity.kt              # Main entry point
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   └── AssetManager.kt          # Asset copying/validation
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ AppDatabase.kt           # Room database setup
β”‚   β”‚   β”œβ”€β”€ MedicalChunk.kt          # Database entities
β”‚   β”‚   β”œβ”€β”€ VectorSearchEngine.kt    # Semantic search
β”‚   β”‚   └── ChatModels.kt            # Chat data classes
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ ModelInferenceService.kt # Llama.cpp integration
β”‚   β”‚   β”œβ”€β”€ EmbeddingService.kt      # ONNX runtime
β”‚   β”‚   β”œβ”€β”€ PeerSharingService.kt    # Bluetooth/WiFi Direct
β”‚   β”‚   └── WordPieceTokenizer.kt    # Text tokenization
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ screens/
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatScreen.kt        # Main chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ SettingsScreen.kt    # Configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ SharingScreen.kt     # P2P sharing UI
β”‚   β”‚   β”‚   β”œβ”€β”€ CheatSheetScreen.kt  # PDF generation
β”‚   β”‚   β”‚   └── SetupScreen.kt       # First-run setup
β”‚   β”‚   β”œβ”€β”€ theme/
β”‚   β”‚   β”‚   β”œβ”€β”€ Theme.kt             # Material 3 theme
β”‚   β”‚   β”‚   β”œβ”€β”€ Color.kt             # Color palette
β”‚   β”‚   β”‚   └── Type.kt              # Typography
β”‚   β”‚   └── viewmodel/
β”‚   β”‚       └── ChatViewModel.kt     # RAG pipeline logic
β”‚   └── utils/
β”‚       └── CheatSheetGenerator.kt   # PDF generation
β”œβ”€β”€ src/main/assets/
β”‚   β”œβ”€β”€ medical.db                   # English protocols
β”‚   β”œβ”€β”€ medical_arabic.db            # Arabic protocols
β”‚   └── vocab.json                   # Tokenizer vocabulary
└── build.gradle.kts                 # App-level build config

πŸ”§ Development

Building from Source

# Clone repository
git clone https://github.com/your-org/hayat-ai.git
cd hayat-ai

# Build debug APK
./gradlew assembleDebug

# Build release APK (requires signing key)
./gradlew assembleRelease

Running Tests

# Unit tests
./gradlew test

# Instrumentation tests
./gradlew connectedAndroidTest

# Code coverage
./gradlew jacocoTestReport

Adding New Medical Protocols

  1. Add protocol text to app/src/main/assets/protocols_en.txt or protocols_ar.txt
  2. Run embedding generation script:
    python scripts/generate_embeddings.py --language en
  3. Rebuild app to include updated database

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Priority Areas:

  • Additional language translations
  • More medical protocols (pediatric, obstetric, mental health)
  • Performance optimizations for low-end devices
  • Accessibility improvements
  • NGO partnership integrations

⚠️ Medical Disclaimer

IMPORTANT: This application is for educational and informational purposes only. It does NOT:

  • Replace professional medical advice, diagnosis, or treatment
  • Provide guarantees of accuracy or completeness
  • Establish a doctor-patient relationship
  • Handle all possible medical scenarios

Always seek professional medical help when available. In emergencies, contact local emergency services immediately.

The developers and contributors are not liable for any adverse outcomes resulting from use of this application.

πŸ“„ License

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

Important: Medical protocol content may have separate licensing restrictions. Always verify usage rights for ICRC/WHO/MSF content before redistribution.

🀝 Partnerships

We're actively seeking partnerships with:

  • Humanitarian organizations (ICRC, MSF, WHO)
  • Refugee camp administrators
  • Disaster response teams
  • Medical NGOs working in conflict zones

Contact: team@hayat-ai.org (placeholder)

πŸ™ Acknowledgments

  • Llama.cpp team for efficient GGUF inference
  • Hugging Face for open-source medical models
  • ICRC/WHO/MSF for open-access medical guidelines
  • Android Jetpack Compose team for modern UI toolkit
  • All contributors and supporters of this humanitarian project

πŸ“Š Roadmap

v1.0 (Current)

  • βœ… Core RAG chat functionality
  • βœ… English/Arabic bilingual support
  • βœ… Medical protocol database
  • βœ… P2P sharing infrastructure
  • βœ… Printable cheat sheets

v1.1 (Planned)

  • French language support
  • Pediatric-specific protocols
  • Obstetric emergency guidelines
  • Mental health first aid
  • Voice input/output for hands-free use

v1.2 (Planned)

  • Offline map integration for nearest clinics
  • Symptom checker with decision trees
  • Medication dosage calculator
  • Multi-patient triage management
  • SMS-based query fallback

Future Considerations

  • iOS version
  • Wear OS support for smartwatches
  • Integration with portable diagnostic devices
  • Mesh networking for group deployments

Built with ❀️ for humanity
Hayat AI - Saving lives through technology

About

Hayat AI is an offline-first, mobile medical assistant designed for high-conflict and crisis zones like Gaza and Kashmir. It provides physician-validated emergency protocols (trauma, surgery, first aid) without requiring an internet connection.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages