logbook/prompt.txt
2025-05-09 14:37:57 -04:00

126 lines
9.2 KiB
Plaintext

You are an experienced software engineer. I am designing an app to track my
workouts. It will be coded 100% in Golang, ideally without any use of CGo. The
workouts consist of Sets of exercises.
A Set records the time, the name of the exercise performed, the number of Reps,
the Weight lifted and a note (string). A Set can either be a planned set or a
completed set, so there needs to be a boolean field "Planned" that is set to
true for a planned set and false for an actual completed set.
One type of Set is called an AMRAP, which stands for "as many reps as
possible." In this case, the value of Reps indicates a target, and a boolean
AMRAP is set to true.
An AMRAP with a target of 1 is an attempted max single.
When a Set is stored in the database, the ID field (they key in the BoltDB
key-value store) is set to a sortable version of the Time field (RFC3339 plus
a unique sortable sequence number).
A Workout is a list of pointers to Sets. A Workout is stored in the database
as a collection of the database IDs for the Sets planned and actually completed
in that workout. A workout should also have a boolean indicating whether the
workout has been completed (if false it means this is a planned future
workout).
When accessing the database, there should be a single function that allows
variadic parameters, allowing the user to retrieve a list of Workouts or Sets
within a given date range that satisfy the other parameters (e.g. date, date
range (if two dates are provided), exercise type, completed or planned or both,
attempted max, etc. The retrieval function should be as flexible as possible.
I will also need a generic data storage function which I will primarily use to
record biometrics over time (e.g. weight, waist circumference, etc.). This can
be a simple key-value store with the Variable being a string and the Value
being a float64. Each entry will be time-stamped with an ID formed as above
(RFC3339 date/time plus a unique sortable sequence number).
BoltDB will be the backend database for this project.
You are to create a detailed project plan including a breakdown of how this app
should be divided into modules, what will be required to create each module
(including what libraries should be used), and what algorithms or other
software engineering approaches or methodologies should be leveraged to
successfully complete this project.
The next step of the project is to create a graphical user interface. I will
use the gioui library. The user needs to be able to enter workout plans,
view plans for a given day during a workout, and log actual exercise
performances achieved on that day. The user will also need to be able to
review future plans and previous exercise results. For example, a user may
want to see all deadlift sessions over the past 7 months. Additional functions
include the ability to predict maximum exercise performance (e.g. one
repetition max) based on the weight lifted and the number of reps achieved
in a set. This is useful in reviewing past performance (including trends over
time as strength on a given lift goes up or down), or for setting a goal for
a particular set (e.g. based on a recent performance, I should be able to
do a certain number of reps on the next exercise). Before writing any code,
provide a detailed analysis of these requirements and an overview of what
user interface screens we should include in the app. Then consider if the
existing library provides enough low-level functionality or if we should
enhance the library before implementing the graphical user interface.
I would like to move as much as possible into the human-readable direction,
with as little extraneous text as possible. Let me know if you think the
following design can work and propose any enhancements you think might be
necessary. The following entry indicates that a workout was done on August
1, 2025. The workout will have a note "pull" indicating the main types of
movements done on that day. The first setgroup is four planned sets of
deadlift with 315 pounds, there are four sets in the setgroup and each one
is for 2 repretitions. The set group has a Type field that says "top sets"
and a Note that says "heavier than last time". The next indented line (if
present) indicates the actual sets completed for this SetGroup, here showing
that three out of the four planned sets were completed, the first two with
two reps, and the last with a single rep. The note field on this setgroup
will say "failed last rep". The next setgroup in the plan is
another deadlift, this time with 275 pounds for two sets of three. The next
indented line shows that the first set was completed with 3 reps as planned,
but the weight was changed to 270 pounds for the second set, which was also
done with three reps. The next line shows that a chinup with 110 pounds added
weight was planned but not completed. The next setgroup is a chinup with 90
pounds performed for two sets of three. The first set of three was completed
but only two reps were done in the second set. The last setgroup shows dips
with 25 pounds to be performed for 5 sets of 8 in an EMOM style (type field
set to EMOM with no note). The user completed four sets of 8 but did not do
the fifth planned set.
2025-08-01 (pull)
deadlift 315 4x2 (top sets) heavier than last time
2-2-1 failed last rep
deadlift 275 2x3 (backoff sets)
3-270x3
chinup 110 1 (top single)
chinup 90 2x3 (backoff sets)
3-2
dip 25 5x8 (EMOM)
8-8-8-8
I have a database that contains information about workouts. My top-level project is accessed from git.wow.st/logbook. The data is stored
in the following structs (this is my intermediate representation defined in the git.wow.st/logbook/parser pakage):
type Workout struct {
Date time.Time
Type string
Note string
SetGroups []SetGroup
}
type SetGroup struct {
Exercise string
Type string
Note string
PlannedSets []Set
ActualSets []Set
}
type Set struct {
Weight float64
Reps int
Note string
Time time.Time
}
type Measurement struct {
Date time.Time
Variable string
Value float64
Note string
}
I need to add functions to review past workout performance. The important data here will be actual sets contained within a setgroup. Only actual sets should be compared. Sets can be compared if they are found in a SetGroup with the same Exercise and Type field (type is used to distinguish between variations of an exercise, e.g. a convention deadlift vs. a sumo deadlift will both have deadlift in the Exercise field but conventional (or blank) and sumo respectively in the Type field). We have WorkoutRepository which has a method FindSetGroups(match func(*parser.SetGroup) bool) ([]*parser.SetGroup, error). Because of the database storage conventions, the list of SetGroups returned by this function will always be sorted by date from oldest to newest. The Set struct has a Time field which can be used to identify the time and date on which a particlar performance was achieved.
Before writing any code, sketch out a high-level design for a flexible package to be imported from git.wow.st/logbook/review that allows the user to easly review past workout performances of the same type. For example, the user might want a list of the most recent performances of a given exercise with a given weight or within a range of weights. The user might want to know how many reps they have been able to obtain at a given weight with a given exercise, either the lifetime personal best or the most recent performance with that weight. In the case where multiple performances were attempted on the same date (e.g. the SetGroup calls for 3 sets of the same exercise at the same weight) the user might want to know that they were able to do 8 reps on the first and second sets, but only 7 on the third. The user will also want to be able to estimate their strength at a given rep range. For example, if they have deadlifted 315 pounds for 10 reps, how many should they expect to be able to do with 330 pounds? In order to calculate that number, it may be useful to first convert the original performance (315 pounds for 10 reps) to an estimated one-repetition max, and then use that to estmiate what the user could perform with a different weight. As requested, please provide an overview of a flexible exercise review program based on these requirements and the available data sources. As you work though this exercise, please consider what additional sources of data would be useful and whether any intermediate APIs would be helpful to create a flexible and extensible system.
You are an expert software engineer. Before writing any code, you carefully consider requirements and use cases and design software architectures based on reusable, maintainable code with highly expressive and flexible interfaces. When coming up with designs, you iterate over them to reduce complexity and increase flexibility and expressiveness. You believe that software interfaces work best when common use cases are easy to read and understand, favoring short function names, using composability and flexible types to help users perform complex tasks as simply as possible with the lowest risk of bugs. This software project is written in the Go programming language.