Run Log Integration
Over the years, I’ve had a few different flavors of run log integration; a homebrewed cgi, a simple third party logging site that’s long departed that I can’t remember the name of, and select runs embedded from Garmin Connect.
The easy thing to do is just add an archetype for run log type blog post and then just copy and paste the details from the Fitness app on my phone. Ok, that’s easy enough, lets get Claude to make the first draft:
add a new archetype for running log entries called ‘runlog’. include the following fields in front matter: distance, total time, average heart rate, average speed, calories burned, begin time. these fields will be passed in on command line for hugo new later. show fields in body of the post using attractive formatting.
Looks pretty good. It added an intro section, a markdown table for the stats and another section for notes. It did forget about setting the stats data in the post from the front matter fields. It was able to fix that easily.
Next I wanted to add a Vibe section. Basically just 1-5 rating for the run from terrible to terrific. I got Gemini to sketch out some emojis for the different levels. I wrote up my levels and related descriptions and told Claude to add them to the run log archetype. Cleverly, it defined a shortcode so you could reuse the same code in multiple places easily; though I don’t have another place in mind, it seems like a good idea.
Knowing me, I’ll try quickly tire of copy and pasting in all that front matter after every run. Can I automate that? Some q and a with Gemini says it should be possible. After a few false starts like not being able to get the metrics I wanted through the Apple standard workout APIs (needed a third party app for more Workout related options) and shortcut app version differences, I was able to make a shortcut I can where it grabs the details from the latest run, puts them in simply formatted file on my iCloud drive.
Now some more fun. Lets have Claude make a workflow that finds the data files for the run that came from my phone and uses them to make blog post drafts.
make a workflow that looks for files with txt file extension in the folder {complicated path to the folder in iCloud Drive}/runs. for each file found, read the file and parse out the details. each line in the file is one running statistic. here is the key for the stat types: D: distance, T: total time, A: average heart rate, S: average speed, C: calories burned, B: begin time. make new post using the runlog archetype passing in the data parsed above using environment variables. after processing the file, change the file extension from ’txt’ to ‘done’
It got the basics working in one shot. Color me impressed.
A few more rounds of smaller changes (fixing duration display, rounding values, etc.) Things are looking pretty tight.
For now, the post generated is in draft status. I can tweak the vibe value and add notes before publishing if I want. I suppose with some more work, I could probably skip the editorial step have the publish happen completely automatically.
Start to finish I spent about 2 hours on the project. A little more than an hour fighting with shortcuts on the phone, and the balance getting run log import script tuned on the mac side. Regardless, that’s probably a tiny fraction of me hauling off and tackling it solo.