[Pharo] Personal fitness tracker web app.
Documentation and SQL schema.
Changed files
architecture.org
@@ -0,0 +1,145 @@
1
Added:
#+TITLE: My Fitness Tracker Architecture
2
Added:
#+SUBTITLE: Notes on MFT's implementation
3
Added:
#+AUTHOR: Marius Peter
4
Added:
#+DATE: <2024-05-07 Tue>
5
Added:
6
Added:
7
Added:
* Use cases
8
Added:
9
Added:
#+begin_src plantuml :file use-cases.png
10
Added:
@startuml
11
Added:
skinparam defaultFontName Inter
12
Added:
13
Added:
title MFT Use Cases
14
Added:
left to right direction
15
Added:
16
Added:
actor Athlete
17
Added:
actor Coach
18
Added:
19
Added:
usecase "Log workout" as log_workout
20
Added:
usecase "Log weight" as log_weight
21
Added:
usecase "Review past performance" as review_performance
22
Added:
usecase "Suggest workout" as suggest_weight
23
Added:
24
Added:
Athlete --> log_workout
25
Added:
Athlete --> log_weight
26
Added:
Athlete --> review_performance
27
Added:
28
Added:
Coach --> log_workout
29
Added:
Coach --> log_weight
30
Added:
Coach --> suggest_weight
31
Added:
Coach --> review_performance
32
Added:
33
Added:
@enduml
34
Added:
#+end_src
35
Added:
36
Added:
#+RESULTS:
37
Added:
[[file:use-cases.png]]
38
Added:
39
Added:
40
Added:
* Classes
41
Added:
42
Added:
#+begin_src plantuml :file model.png
43
Added:
@startuml
44
Added:
' !theme cerulean-outline
45
Added:
skinparam defaultFontName Inter
46
Added:
47
Added:
title MFT Classes
48
Added:
49
Added:
' Define classes
50
Added:
class MFTUser {
51
Added:
+ Integer id
52
Added:
+ String username
53
Added:
+ Blob passwordHash
54
Added:
+ Date dateOfBirth
55
Added:
+ String realFirstName
56
Added:
+ String realLastName
57
Added:
+ Bool isLoggedIn
58
Added:
+ Date lastLoginDateAndTime
59
Added:
}
60
Added:
61
Added:
class MFTWorkout {
62
Added:
+ Integer id
63
Added:
+ Date date
64
Added:
+ String description
65
Added:
}
66
Added:
67
Added:
class MFTExercise {
68
Added:
+ Integer id
69
Added:
+ Integer workout_id
70
Added:
+ String name
71
Added:
+ Integer sets
72
Added:
+ Integer reps
73
Added:
}
74
Added:
class MFTSet {
75
Added:
+ Integer id
76
Added:
+ Integer sets
77
Added:
+ Integer reps
78
Added:
+ Integer rpe
79
Added:
}
80
Added:
81
Added:
' Define relationships
82
Added:
MFTUser "1" --* MFTWorkout : has >
83
Added:
MFTWorkout "1" --* MFTExercise : contains >
84
Added:
MFTExercise "1" --* MFTSet : contains >
85
Added:
MFTUser "1" --* MFTWeights : tracks >
86
Added:
87
Added:
@enduml
88
Added:
#+end_src
89
Added:
90
Added:
#+RESULTS:
91
Added:
[[file:model.png]]
92
Added:
93
Added:
94
Added:
* Database model
95
Added:
96
Added:
#+begin_src plantuml :file model.jpg
97
Added:
@startuml
98
Added:
skinparam defaultFontName Inter
99
Added:
100
Added:
title Database model
101
Added:
102
Added:
entity "users" {
103
Added:
,* id: int <<PK>>
104
Added:
,* username: varchar
105
Added:
,* email: varchar
106
Added:
,* password_hash: varchar
107
Added:
}
108
Added:
109
Added:
entity "prospects" {
110
Added:
,* id: int <<PK>>
111
Added:
,* email: varchar
112
Added:
,* contact_date: date
113
Added:
}
114
Added:
115
Added:
entity "workouts" {
116
Added:
,* id: int <<PK>>
117
Added:
,* user_id: int <<FK>>
118
Added:
,* date: date
119
Added:
,* duration: int
120
Added:
}
121
Added:
122
Added:
entity "exercises" {
123
Added:
,* id: int <<PK>>
124
Added:
,* name: varchar
125
Added:
,* primaryMuscle: varchar
126
Added:
}
127
Added:
128
Added:
entity "sets" {
129
Added:
,* id: int <<PK>>
130
Added:
,* workout_id: int <<FK>>
131
Added:
,* exercise_id: int <<FK>>
132
Added:
,* reps: int
133
Added:
,* weight: float
134
Added:
}
135
Added:
136
Added:
workouts }|--|{ users
137
Added:
sets }|--|{ workouts
138
Added:
sets }|--|{ exercises
139
Added:
140
Added:
@enduml
141
Added:
142
Added:
#+end_src
143
Added:
144
Added:
#+RESULTS:
145
Added:
[[file:model.jpg]]
create-mft-db.sql
@@ -0,0 +1,224 @@
1
Added:
-- -*- mode: sql; -*-
2
Added:
3
Added:
CREATE TABLE "Exercises" (
4
Added:
"id" INTEGER NOT NULL UNIQUE,
5
Added:
"english_name" INTEGER,
6
Added:
"description" TEXT,
7
Added:
"primary_muscle_id" INTEGER NOT NULL,
8
Added:
PRIMARY KEY("id" AUTOINCREMENT)
9
Added:
);
10
Added:
11
Added:
CREATE TABLE "Prospects" (
12
Added:
"id" INTEGER UNIQUE,
13
Added:
"email" TEXT NOT NULL,
14
Added:
"date_time" TEXT NOT NULL,
15
Added:
PRIMARY KEY("id" AUTOINCREMENT)
16
Added:
);
17
Added:
18
Added:
CREATE TABLE "Users" (
19
Added:
"id" INTEGER UNIQUE,
20
Added:
"username" TEXT NOT NULL,
21
Added:
"password_hash" BLOB NOT NULL,
22
Added:
"real_first_name" TEXT,
23
Added:
"real_last_name" TEXT,
24
Added:
"date_of_birth" TEXT,
25
Added:
"last_login_date_time" TEXT,
26
Added:
"account_register_date_time" TEXT,
27
Added:
PRIMARY KEY("id" AUTOINCREMENT)
28
Added:
);
29
Added:
30
Added:
CREATE TABLE "Weights" (
31
Added:
"id" INTEGER UNIQUE,
32
Added:
"user_id" INTEGER NOT NULL,
33
Added:
"date" TEXT NOT NULL,
34
Added:
"value" NUMERIC NOT NULL,
35
Added:
PRIMARY KEY("id" AUTOINCREMENT)
36
Added:
);
37
Added:
38
Added:
CREATE TABLE "Workouts" (
39
Added:
"id" INTEGER UNIQUE,
40
Added:
"user_id" INTEGER NOT NULL,
41
Added:
"date" TEXT NOT NULL,
42
Added:
"primary_muscle" TEXT,
43
Added:
"secondary_muscles" TEXT,
44
Added:
PRIMARY KEY("id" AUTOINCREMENT)
45
Added:
);
46
Added:
47
Added:
CREATE TABLE "Muscle_Groups" (
48
Added:
"id" INTEGER NOT NULL UNIQUE,
49
Added:
"english_name" INTEGER NOT NULL UNIQUE,
50
Added:
"description" TEXT,
51
Added:
PRIMARY KEY("id" AUTOINCREMENT)
52
Added:
);
53
Added:
54
Added:
INSERT INTO Muscle_Groups ("id", "english_name", "description") VALUES
55
Added:
-- Upper body
56
Added:
('1', 'neck', ''),
57
Added:
('2', 'back', ''),
58
Added:
('3', 'shoulder', ''),
59
Added:
('4', 'chest', ''),
60
Added:
('5', 'triceps', ''),
61
Added:
('6', 'biceps', ''),
62
Added:
('7', 'forearm', ''),
63
Added:
-- Core
64
Added:
('8', 'abdominals', ''),
65
Added:
('9', 'hip', ''),
66
Added:
('10', 'glutes', ''),
67
Added:
-- Lower body
68
Added:
('11', 'quad', ''),
69
Added:
('12', 'hamstring', ''),
70
Added:
('13', 'calf', '');
71
Added:
72
Added:
CREATE TABLE "Muscles" (
73
Added:
"id" INTEGER NOT NULL UNIQUE,
74
Added:
"latin_name" TEXT NOT NULL UNIQUE,
75
Added:
"muscle_group_id" INTEGER,
76
Added:
"english_name" TEXT,
77
Added:
"description" TEXT,
78
Added:
FOREIGN KEY("muscle_group_id") REFERENCES Muscle_Groups("id"),
79
Added:
PRIMARY KEY("id" AUTOINCREMENT)
80
Added:
);
81
Added:
82
Added:
INSERT INTO Muscles ("latin_name", "english_name", "description") VALUES
83
Added:
-- Upper body
84
Added:
('deltoideus',
85
Added:
'3',
86
Added:
'delts',
87
Added:
''
88
Added:
),
89
Added:
('pectorali minor',
90
Added:
'4',
91
Added:
'pectoral',
92
Added:
'Located beneath the pectoralis major, it plays a role in stabilizing the shoulder blade and assisting in deep breathing.'
93
Added:
),
94
Added:
('extensor carpi radialias brevis',
95
Added:
'',
96
Added:
'',
97
Added:
'Located in the forearm, it is responsible for extending the wrist and abducting the hand.'
98
Added:
),
99
Added:
('brachio radialis',
100
Added:
'',
101
Added:
'',
102
Added:
'Located in the forearm, it is responsible for flexing the forearm at the elbow joint.'
103
Added:
),
104
Added:
('flexor carpi radialis',
105
Added:
'',
106
Added:
'',
107
Added:
'Located in the forearm, it is responsible for flexing the wrist and abducting the hand.'
108
Added:
),
109
Added:
('extensor carpi ulnaris',
110
Added:
'',
111
Added:
'',
112
Added:
'Located in the forearm, it is responsible for extending the wrist and adducting the hand.'
113
Added:
),
114
Added:
('flexor carpi ulnaris',
115
Added:
'',
116
Added:
'',
117
Added:
'Located in the forearm, it is responsible for flexing the wrist and adducting the hand.'
118
Added:
),
119
Added:
('biceps brachii',
120
Added:
'',
121
Added:
'biceps',
122
Added:
''
123
Added:
),
124
Added:
('latissimus dorsi',
125
Added:
'',
126
Added:
'lats',
127
Added:
'Also known as the "lats," these muscles are located in the upper back and are responsible for shoulder adduction and extension.'
128
Added:
),
129
Added:
('triceps brachii',
130
Added:
'',
131
Added:
'triceps',
132
Added:
''
133
Added:
),
134
Added:
('trapezius',
135
Added:
'',
136
Added:
'trap',
137
Added:
'The trapezius muscles are located in the upper back and neck. They play a role in moving and stabilizing the shoulder blades.'
138
Added:
),
139
Added:
('extensor carpi radialis longus',
140
Added:
'',
141
Added:
'Extensor Carpi Radialis Longus',
142
Added:
'Located in the forearm, it is responsible for extending the wrist and abducting the hand.'
143
Added:
),
144
Added:
('pectoralis major',
145
Added:
'',
146
Added:
'',
147
Added:
'Commonly known as the "pecs," these muscles are in the chest and are responsible for shoulder flexion and adduction.'),
148
Added:
-- Core
149
Added:
('abdominalis',
150
Added:
'',
151
Added:
'abs',
152
Added:
'Deepest abdominal muscle. Wraps around the spine for protection and stability.'
153
Added:
),
154
Added:
('obliquus externus abdominis',
155
Added:
'',
156
Added:
'external oblique',
157
Added:
'Located on the front and side of the abdomen.'
158
Added:
),
159
Added:
('rectus abdominis',
160
Added:
'',
161
Added:
'six-pack',
162
Added:
'Located along the front of the abdomen. Colloquially known as the "six-pack"'
163
Added:
),
164
Added:
('erector spinae',
165
Added:
'',
166
Added:
'erectors',
167
Added:
'This group of muscles runs along the spine and is responsible for extending the vertebral column and maintaining an upright posture.'
168
Added:
),
169
Added:
('gluteus minimus',
170
Added:
'',
171
Added:
'glutes',
172
Added:
'Located in the buttocks, it assists in hip abduction and medial rotation, working with the gluteus medius.'
173
Added:
),
174
Added:
('gluteus medius',
175
Added:
'',
176
Added:
'glutes',
177
Added:
'Located in the buttocks, it plays a role in hip abduction and medial rotation.'
178
Added:
),
179
Added:
('gluteus maximus',
180
Added:
'',
181
Added:
'glutes',
182
Added:
'The largest muscle in the buttocks, responsible for hip extension, outward rotation, and abduction.'
183
Added:
),
184
Added:
('obliquus internus abdominis',
185
Added:
'',
186
Added:
'internal oblique',
187
Added:
'Located on the front and side of the abdomen.'
188
Added:
),
189
Added:
-- Lower body
190
Added:
('soleus',
191
Added:
'',
192
Added:
'calf',
193
Added:
'Located in the calf, it assists the gastrocnemius in plantar flexion and helps maintain posture.'
194
Added:
),
195
Added:
('quadriceps femoris',
196
Added:
'',
197
Added:
'quad',
198
Added:
'A group of four muscles on the front of the thigh, responsible for knee extension.'
199
Added:
),
200
Added:
('hamstringus',
201
Added:
'',
202
Added:
'hamstrings',
203
Added:
'This group of muscles includes the biceps femoris, semitendinosus, and semimembranosus. They are located in the back of the thigh and are responsible for knee flexion and hip extension.'
204
Added:
),
205
Added:
('gastrocnemius',
206
Added:
'',
207
Added:
'calf',
208
Added:
'Located in the calf, it is responsible for plantar flexion of the foot (pointing toes).'
209
Added:
);
210
Added:
211
Added:
CREATE TABLE "Reps" (
212
Added:
"id" INTEGER NOT NULL UNIQUE,
213
Added:
"set_group" INTEGER NOT NULL,
214
Added:
"set" INTEGER NOT NULL,
215
Added:
"amount" INTEGER NOT NULL,
216
Added:
"load" INTEGER,
217
Added:
"rpe" INTEGER,
218
Added:
"rest_after_s" NUMERIC,
219
Added:
PRIMARY KEY("id" AUTOINCREMENT)
220
Added:
);
221
Added:
222
Added:
-- Local Variables:
223
Added:
-- sql-product: sqlite
224
Added:
-- End: