A Python tool that transforms Apple Health export data into insightful visualizations and analytics, with AI-powered analysis. Easily track your fitness journey with detailed analysis of steps, workouts, heart rate, sleep, and more. Features specialized support for WHOOP workout data and ChatGPT integration for personalized insights.
- π Interactive data visualizations for all metrics
- π€ AI-powered analysis using ChatGPT
- πͺ Workout duration tracking and analysis
- β€οΈ Heart rate patterns and trends
- πββοΈ Daily activity metrics (steps, distance)
- βοΈ Weight tracking over time
- π΄ Sleep pattern analysis
- π WHOOP workout integration
- π§ Local LLM Support (New!) - Analyze data privately using Ollama models like Deepseek-R1
Here are the most surprising insights from your health data:
Marathon-Level Days: You've had several "super active" days exceeding 40,000 steps, with your record being 46,996 steps on March 24, 2018 - equivalent to walking about 23 miles! Interestingly, these extremely active days often don't coincide with recorded workouts.
Reversed Weekend Pattern: Unlike most people who are more active on weekends, your data shows consistently lower step counts on weekends, suggesting your physical activity is more tied to workdays than leisure time.
Workout Evolution: Your exercise patterns have notably changed over the years - you've shifted from frequent, shorter workouts to less frequent but more intense sessions. Recent workouts show higher average heart rates despite being less frequent.
Seasonal Anomalies: While there's a general trend of higher activity in spring/summer, some of your most active periods occurred during winter months, particularly in December and January of recent years.
Heart Rate Cycles: Your data shows interesting 3-4 week cycles where resting heart rate gradually increases then drops, possibly indicating training load and recovery patterns.
COVID Impact: There's a clear signature of the pandemic in your data, with more erratic step patterns and changed workout routines during 2020-2021, followed by a distinct recovery pattern in late 2021.
Morning Consistency: Your most successful workout periods consistently occur in morning hours, with these sessions showing better heart rate performance compared to other times.
- Python 3.6+
- pandas
- matplotlib
- openai
- python-dotenv
- xml.etree.ElementTree (included in Python standard library)
-
Clone this repository:
git clone https://github.com/krumjahn/applehealth.git
-
Install dependencies:
pip install -r requirements.txt
-
Set up OpenAI API key:
-
Get your API key from OpenAI Platform
-
Create a
.env
file in the project directory -
Add your API key:
OPENAI_API_KEY=your-api-key-here
-
-
Set up Ollama for local AI analysis:
-
Install Ollama: https://ollama.ai/download
-
Start Ollama service (keep running in background):
ollama serve
-
Download Deepseek-R1 model:
ollama pull deepseek-r1
-
-
On your iPhone:
- Open the Health app
- Tap your profile picture
- Select "Export All Health Data"
- Save and extract the zip file
- Locate
export.xml
-
Place
export.xml
in the same directory as the script
Run the script:
python applehealth.py
-
Build the Docker image:
docker build -t applehealth .
-
Run the Docker container:
docker run --network="host" -v $(pwd)/export.xml:/app/export.xml -it applehealth
Choose from the menu:
- Steps Analysis
- Distance Tracking
- Heart Rate Analysis
- Weight Tracking
- Sleep Analysis
- Workout Analysis
- Analyze All Data with ChatGPT
- Analyze with Local LLM (Ollama)
- Advanced AI Settings
- Exit
The new AI analysis feature (Option 7) will:
- Analyze all your exported health data
- Provide personalized insights using ChatGPT
- Identify patterns and trends
- Suggest potential improvements
- Highlight unusual findings
Note: You must run at least one other analysis option first to generate the data files for AI analysis.
The new local analysis feature (Option 8) will:
- Process data entirely on your machine
- Use Ollama with Deepseek-R1 by default
- Provide technical analysis of health patterns
- No data leaves your computer
To use different models:
-
Edit
applehealth.py
and find theanalyze_with_ollama()
function -
Change the model name in this line:
model='deepseek-r1' # Change to 'llama2', 'mistral', etc.
-
Pull your desired model first:
ollama pull <model-name>
Workout Summary:
Total days with workouts: 145
Average daily workout time: 1.25 hours
Total time recorded: 181.5 hours
Average heart rate: 132.7 BPM
AI Analysis:
[ChatGPT provides personalized insights based on your data]
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a new branch (
git checkout -b feature/improvement
) - Make your changes
- Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/improvement
) - Create a Pull Request
This tool processes your health data locally on your machine. When using the AI analysis feature:
- Only aggregated statistics are sent to OpenAI
- No personal identifiers are shared
- Data is processed according to OpenAI's privacy policy
- Currently only supports Apple Health export XML format
- WHOOP integration limited to workout data
- Sleep analysis assumes data is in standard Apple Health format
- AI analysis requires OpenAI API key and internet connection
- Local LLM analysis requires minimum 8GB RAM for decent performance
- Model quality depends on local hardware capabilities
- Add support for more data types
- Enhanced visualization options
- More detailed AI analysis
- Export capabilities
- Configuration options
- Add model selection UI
- Support multiple local LLM providers
This project is licensed under the MIT License - see the LICENSE file for details.
- Apple Health for providing comprehensive health data export
- WHOOP for workout tracking capabilities
- OpenAI for ChatGPT API
- Contributors and users of this tool
If you find this tool useful, please consider giving it a star βοΈ