I’ve made a few attempts to increase my knowledge of python and while I’m not a complete novice I recognize that I still have a TON to learn. Here I’ll be focusing on configuring an environment for project development. I anticipate I’ll be using a combination of GitHub and Pycharm through the process but we’ll see how it goes.
The first thing I did was setup a GitHub account, create a new repository, downloaded GitHub Desktop, and opened the repository in PyCharm. I learn best through building so the first thing I’m going to try and build is a python script that will automatically review my apple health data and tell me how I am tracking toward my workout goals week over week.
Next thing I did was use the following prompt in ChatGPT to get a baseline script to build off of. “I need help building a python script that will allow me set a weekly workout out goal in terms of number of workouts and then will analyze my apple health data to track whether or not I am meeting my goal. The script or project should track the results week over week and report them as “You have met your workout goals X of Y weeks” where X is the number of weeks where I’ve successfully worked out the frequency defined in my goal and Y is the number of weeks since I set the goal.“
The output from ChatGPT seemed fine and workable but I noticed that it had made some assumptions about the underlying data format that would need to be validated before I used it. This lead me down the path of wanting to explore the data I could get from Apple Health. I quickly learned that there isn’t a health app for Mac OS and that the app is only available on iOS. I was able to export my health data and airdrop it to my computer for analysis.
I wanted to test ChatGPT’s ability to analyze data sets but two things prevented me from doing so; privacy concerns and file size. I decided that there was no way I was the first individual to attempt to parse the data out of apple health which lead me to searching GitHub where I found this repository from Test-Driven Data Analysis (tdda). The heavy lifting was done. Somone had already solved for parsing the massive export.xml file provided by Apple Health. The code analyzes the xml file and produces a series of csv files that summarize the data for you. The summary files include everything from Activity Summary to Walking Speed Summary to Audio Exposure Events. For the purposes of this project I’m most interested in the Workout summary file.
Realizing that my file size was now within ChatGPTs limits, and that I was comfortable with the exposure of my workout data which doesn’t include any PII, I decided to upload the file to ChatGPT. Uploading to ChatGPT resulted in a number of learnings. My biggest takeaway was, we haven’t even scratched the surface in terms of the capabilities of these Large Language Models (LLMs). Over the next decade I suspect we’ll see exponential growth in ALL fields of study. The ability to apply LLMs to solve all kinds of human problems will mean that its application will result in ground breaking discoveries in all areas of study. I plan on eventually dedicating an entire post to LLMs and Generative AI but I couldn’t be more excited about where we’re headed.
Anyway, back to my python project. I was able to successfully go back and forth with ChatGPT to generate a script that accomplishes the following: Allows the user to browse to their workouts.csv file for analysis, asks the user for the desired workout duration in terms of minutes, asks the user the number of desired workouts a week, and then ask the users what date they would like the analysis to start from. The script will then output a breakdown by week of the number of times you hit your objective and provide a summary for the total number of weeks. I don’t want to underemphasize how much I leaned on ChatGPT for this. I learned a lot of basic python functionality along the way and more generically the GitHub ecosystem. I’m starting to get an understanding of how functions and variables are used and called in Python.
My main takeaways:
- ChatGPT has significantly lowered the barrier for learning subjects. The learning process has shifted from watching tutorials and reading guides that tangental align with your objectives but not exactly. With AI you get to ask questions specific to your use case which ultimately gets you to a solution faster.
- ChatGPT is pretty good at building out code. I am curious as to the overall quality and efficiency of the code. I also was hoping to incoporate the parsing and analysis in a single script that prompted the user to provide the export.xml, input the variables, and then perform the calculations but I was ultimately unsuccessful.
- I thought it important to make sure I’m following appropriate GitHub edict and attributing the parsing work to the script’s developers (https://github.com/tdda/applehealthdata).
- As I look to increase my skillset in software development trial and error is going to be key.
You can see the GitHub repository for this project here: https://github.com/mdf5033/Apple-Health-HistoricalWorkout-Goal-Analysis
Sample Input/Output:
GitHub/Apple-Health-Workout-Goal-Tracker/applehealthworkoutgoalanalysis/WorkoutGoalAnalysis.py
What date would you like to start tracking your goal from (YYYY-MM-DD) or type ‘earliest’ to start from the earliest date in your file: 2024-01-01
Enter the minimum duration of each workout in minutes: 30
Enter the number of desired workouts per week: 4
Total workouts parsed: 448
Week starting 2024-01-08 00:00:00-05:00: 5 workouts
Week starting 2024-01-15 00:00:00-05:00: 0 workouts
You met your workout goal 1 of 2 weeks since 2024-01-01.
ChatGPT Logs:
https://chat.openai.com/share/d7f6bce6-6093-49d2-8ffd-eb39d73f79fd
https://chat.openai.com/share/916638a9-b5eb-4306-aa33-b1d02128ee20
https://chat.openai.com/share/84d525cf-ea81-4f5d-8f1b-54db54fd48e4
Leave a Reply
You must be logged in to post a comment.