An intelligent iOS application for tracking and managing headache records with AI-powered data extraction and bilingual support.
- 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
- 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
- English & Chinese: Full localization support for both languages
- Auto-Detection: Automatically detects system language preference
- Switchable Interface: Easy language switching in settings
- Reminder System: Customizable notification reminders
- Ongoing Tracking: Automatic reminders for ongoing headaches
- Flexible Scheduling: Set multiple reminder times
- 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
- 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
- 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
@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?
}- iOS 17.6 or later
- Xcode 15.0 or later
- iPhone (iOS device required for full functionality)
- Clone the repository:
git clone https://github.com/xthomaswang/headache_note.git
cd headache_note- Open the project in Xcode:
open Headache_Note.xcodeproj- Build and run the project on your iOS device or simulator
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.
- Tap "Log New Headache" to create a manual entry
- Fill in the details: time, intensity, location, type, and notes
- Save the record to your local database
- Enable the AI Assistant in Settings
- Describe your headache in natural language to the chat interface
- The AI will extract relevant information and ask clarifying questions
- Confirm and save the automatically structured data
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?"
- 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
The app requests notification permissions to provide helpful reminders for ongoing headaches and scheduled check-ins.
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
- 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
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit your changes:
git commit -am 'Add new feature' - Push to the branch:
git push origin feature/new-feature - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- MLC-LLM: For enabling on-device LLM inference
- Llama 3.2: Meta's efficient language model
- Apple: For SwiftUI and SwiftData frameworks
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.