Demystifying Your Health Data with AI
Apple Health Bot
leverages OpenAI's LLM and langchain RAG over SQL to empower you with insights from your Apple Health data.
- Overview
- Features
- Repository Structure
- Modules
- Getting Started
- Project Roadmap
- Contributing
- License
- Acknowledgments
Apple Health Bot
works on top of your Apple Health export data, leveraging advanced RAG over SQL techniques it helps answer any relevant health query. It simplifies health data management, offering insights into workouts, sleep patterns, and exercise time through intuitive AI-driven interactions.
Here's a quick overview in layman's terms: This diagram illustrates how we turn your questions into a format that our system can understand and use to fetch the exact information you're looking for, all in a way that feels like a casual conversation.
AppleHealthLLMBot/
├── Dockerfile
├── LICENSE
├── README.md
├── dataParser/
│ └── xmldataparser.py
├── entrypoint.sh
├── healthBot/
│ └── appleHealthBot.py
└── setup/
└── requirements.txt
entrypoint.sh
- Initializes script based on user commands.Dockerfile
- Constructs Docker image for the Python application.setup/requirements.txt
- Lists necessary project dependencies.healthBot/appleHealthBot.py
- Analyzes SQL data with OpenAI and Langchain.dataParser/xmldataparser.py
- Converts Apple Health XML data into CSVs for SQL database insertion.
For step-by-step instructions on exporting your data from Apple Health, see the Apple Support guide.
Alternatively, follow these steps:
- Docker (latest version recommended)
From Source
- Clone the repository:
git clone https://github.com/nk3750/apple-health-bot.git
- Navigate to the project directory:
cd apple-health-bot
- Update the
.env
file with your OpenAI API Key:vim .env # Replace YOUR_OPENAI_API_KEY accordingly
- Transfer the
export.xml
file from your Health app:cp /path/to/export.xml .
Docker Image Creation
Build the Docker image:
docker build -t healthbot .
XML Parsing and CSV Conversion
Run the parser:
docker run -v "$(pwd)":/data healthbot parseData /data/export.xml
*Note: This may take some time depending on your export.xml
size. Consider taking a short break!
This is how it should look like once the script is executed successfully.
Start the Bot
docker run -it -v "$(pwd)":/data healthbot healthBot
- Fix inaccuracies with the handling of sleep data
- Enable real time data sync
- Handle complex queries involving sleep and workout
- Add testing details
- Add linting
- Add Dynamic few-shot prompt
- Add chat history
TODO
Contributions are welcome! Here are several ways you can contribute:
- Report Issues: Submit bugs or feature requests.
- Submit Pull Requests: Review open PRs or submit your own.
- Join the Discussions: Share insights or ask questions.