Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Headache Note 📱

An intelligent iOS application for tracking and managing headache records with AI-powered data extraction and bilingual support.

🌟 Features

🤖 AI-Powered Headache Assistant

  • Smart Data Extraction: Uses a local LLM (Llama 3.2-1B) to automatically extract headache information from natural language descriptions
  • Conversational Interface: Chat with the AI assistant to record headache details naturally
  • Intelligent Parsing: Automatically identifies pain intensity, location, type, duration, and other relevant details
  • Offline Processing: All AI processing happens locally on device for privacy

📊 Comprehensive Headache Tracking

  • Detailed Records: Track start/end times, pain intensity (1-10 scale), locations, and types
  • Ongoing Headaches: Monitor active headaches with real-time status updates
  • Rich Data: Record multiple pain locations and types per episode
  • Notes Support: Add custom notes and observations

🌐 Multilingual Support

  • English & Chinese: Full localization support for both languages
  • Auto-Detection: Automatically detects system language preference
  • Switchable Interface: Easy language switching in settings

🔔 Smart Notifications

  • Reminder System: Customizable notification reminders
  • Ongoing Tracking: Automatic reminders for ongoing headaches
  • Flexible Scheduling: Set multiple reminder times

📱 Modern iOS Design

  • SwiftUI Interface: Modern, responsive user interface
  • SwiftData Integration: Efficient local data storage
  • iOS 17.6+ Support: Built for the latest iOS features
  • Clean Architecture: Well-structured codebase with MVVM pattern

🛠 Technical Architecture

Core Technologies

  • SwiftUI: Modern declarative UI framework
  • SwiftData: Apple's latest data persistence framework
  • MLC-LLM: Machine Learning Compilation for on-device LLM inference
  • Combine: Reactive programming for data flow

AI Integration

  • Local LLM: Llama 3.2-1B model running entirely on device
  • MLCSwift: Swift bindings for MLC-LLM runtime
  • Smart Prompting: Specialized prompts for medical data extraction
  • JSON Parsing: Structured data extraction from conversational input

Data Model

@Model
final class HeadacheLog {
    var startTime: Date
    var endTime: Date?
    var intensity: Int? // 1-10 scale
    var locations: [String] // Multiple pain locations
    var types: [String] // Multiple pain types
    var notes: String?
}

🚀 Getting Started

Prerequisites

  • iOS 17.6 or later
  • Xcode 15.0 or later
  • iPhone (iOS device required for full functionality)

Installation

  1. Clone the repository:
git clone https://github.com/xthomaswang/headache_note.git
cd headache_note
  1. Open the project in Xcode:
open Headache_Note.xcodeproj
  1. Build and run the project on your iOS device or simulator

AI Model Setup

The app will automatically download the required AI model (Llama 3.2-1B) when you first enable the AI assistant feature. The model is approximately 800MB and will be stored locally on your device.

📖 Usage

Basic Headache Logging

  1. Tap "Log New Headache" to create a manual entry
  2. Fill in the details: time, intensity, location, type, and notes
  3. Save the record to your local database

AI-Assisted Logging

  1. Enable the AI Assistant in Settings
  2. Describe your headache in natural language to the chat interface
  3. The AI will extract relevant information and ask clarifying questions
  4. Confirm and save the automatically structured data

Example AI Conversation

User: "I have a throbbing headache on the left side of my head that started 2 hours ago. It's pretty severe, maybe a 7 out of 10."

AI: "I've recorded your headache information. Is it still ongoing now?"

User: "Yes, it's still hurting."

AI: "Okay, I've recorded all the information. Shall I save it for you?"

🔧 Configuration

Settings Options

  • AI Assistant: Enable/disable AI-powered data extraction
  • Language: Switch between English and Chinese
  • Notifications: Configure reminder times and permissions
  • Data Management: View and manage stored headache records

Notification Permissions

The app requests notification permissions to provide helpful reminders for ongoing headaches and scheduled check-ins.

🏗 Project Structure

Headache Note/
├── App/                    # App entry point and configuration
├── Models/                 # Data models (HeadacheLog, ReminderTime)
├── Views/                  # SwiftUI views
├── ViewModels/             # View models for business logic
├── Services/               # Core services
│   ├── LocalLLMService.swift      # AI assistant implementation
│   ├── DisabledAssistantService.swift # Fallback service
│   ├── DataService.swift          # Data management
│   └── NotificationManager.swift  # Notification handling
├── Utilities/              # Helper utilities
├── Assets.xcassets/        # App icons and images
├── en.lproj/              # English localizations
└── zh-Hans.lproj/         # Chinese localizations

🔒 Privacy & Security

  • Local Processing: All AI processing happens on-device
  • No Data Sharing: Your health data never leaves your device
  • Secure Storage: Data stored locally using SwiftData
  • Privacy First: No external API calls for AI functionality

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit your changes: git commit -am 'Add new feature'
  4. Push to the branch: git push origin feature/new-feature
  5. Submit a pull request

📄 License

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

🙏 Acknowledgments

  • MLC-LLM: For enabling on-device LLM inference
  • Llama 3.2: Meta's efficient language model
  • Apple: For SwiftUI and SwiftData frameworks

📞 Support

For support, questions, or feature requests, please open an issue on GitHub.


Note: This app is designed for personal health tracking and should not replace professional medical advice. Always consult with healthcare providers for medical concerns.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages