Org-mode and yas-snippets for workout templates

Goal

I wanted to setup a system for tracking my workouts, and a great way to do that is with templates. Here I am designing a system to track all my workouts in a standard way using org-capture and YASnippets.

The setup

YASnippets are an excellent template expansion tool for Emacs. I have only just started using them but they are easy to use and great for programming. A huge official collection exists, but I have been making my own for programming and now other uses.
YASnippets are great, but I also really like the org-capture date-tree filing, so I combined them like so:

#*** %^{workout day (chest, shoulders, back, kettle)?}
#chest %?
#
#shoulders
#
#back
#
#kettle

(ignore the # signs I had to escape something for proper formatting)
The first line prompts you to enter the type of workout day it is, then the %^ places the cursor next to my YASnippet promts. Here is an example of my "Kettlebell day" template.

# -*- mode: snippet -*-
# name: kettle
# key: kettle
# --
#**** Stats
#:PROPERTIES:
#- actual workout date: ${21:year-month-day}
#:END:

#- Weight: $1
#- Time Start: <${2:00:00} >
#- Time Start:<${3:00:00} >
#- Workout time: <${4:00:00} >
#**** Warmup
#*Tabata*
#- Style: ${5:$$(yas-choose-value '("sprints" "bike"))}
#  - 4 minute workout
#  - 20 seconds all out/ 10 second rest by 8
#**** Workout
#***** Kettlebell Swings
#****** Warmup
#:Restrictions:
reps >=20
wt >=10
:End:
#- ${6:reps} X ${7:weight}
#****** Work
#:Restrictions:
wt >=25
reps: >=15
:End:
#- ${8:reps} X ${9:weight}
#- ${10:reps} X ${11:weight}
# and so on... 
#$0

(ignore the # signs I had to escape something for proper formatting)

If you are familiar with org-mode, you will notice I added some property drawers with basic information and guidance for workouts. anything preceded by a $ sign is a yasnippet prompt.
The syntax for ordered prompt entry is ${N:default value} where N denotes the order of the prompt and :default value signifies the value placed there if you just tab through. For this set of templates, the default value serves mostly as a reminder prompt. $0 is where the prompt ends up at the end.
YASnippets are super powerful as you can embed arbitrary emacs-lisp code in them. I used some elisp code to show an either-or choice for my warmup instead of a regular prompt like so (yas-choose-value '("sprints" "bike")). That was mostly just an exercise to see how it works, but I am sure I will take advantage of more the more I learn.

Workflow

I will write these standard templates in my workout notebook, and after I workout, I will org-capture with C-c c then select w for my workout capture template. Then I will expand the relevant snippet and fill in the form following the prompts.

Future work

I want to learn more about Emacs-lisp so I plan to expand this into a minor-mode for Emacs org-mode. I want to provide these templates, then have a some functions like (org-workout-calculate-stats) or (org-workout-plot-date-range) which will parse the standard file for a set date range and provide the user with stats for their progress and maybe suggestions for future progressions. This is a good start, so I will continue working on this and changing it as I go.
YASnippets and org-capture rock!