technicallyfit 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,592 @@
1
+ # Generated by scripts/generate-sdks.mjs from apps/api-node/src/platform/engine/live-rules.reference.ts.
2
+ # Do not edit by hand: run `npm run sdk:generate` at the repository root.
3
+
4
+ """Live trigger rules declared by the engine."""
5
+
6
+ from typing import Any
7
+
8
+ LIVE_RULES_VERSION = 2
9
+ SESSION_ADAPTATION_CAP = 3
10
+ TRIGGER_RULE_JSON_SCHEMA: dict[str, Any] = {
11
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
12
+ "$defs": {
13
+ "RuleCondition": {
14
+ "additionalProperties": False,
15
+ "description": "One condition on derived set-level state.",
16
+ "properties": {
17
+ "metric": {
18
+ "enum": [
19
+ "effort_delta",
20
+ "consecutive_sets_over_target",
21
+ "consecutive_sets_under_target",
22
+ "sets_completed",
23
+ ],
24
+ "title": "Metric",
25
+ "type": "string",
26
+ },
27
+ "op": {
28
+ "enum": [">=", ">", "<=", "<", "=="],
29
+ "title": "Op",
30
+ "type": "string",
31
+ },
32
+ "threshold": {
33
+ "anyOf": [
34
+ {
35
+ "type": "number",
36
+ },
37
+ {
38
+ "type": "integer",
39
+ },
40
+ ],
41
+ "title": "Threshold",
42
+ },
43
+ "all_in_window": {
44
+ "default": False,
45
+ "title": "All In Window",
46
+ "type": "boolean",
47
+ },
48
+ },
49
+ "required": ["metric", "op", "threshold"],
50
+ "title": "RuleCondition",
51
+ "type": "object",
52
+ },
53
+ },
54
+ "additionalProperties": False,
55
+ "description": "One set-level trigger rule declared as data.",
56
+ "properties": {
57
+ "id": {
58
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
59
+ "title": "Id",
60
+ "type": "string",
61
+ },
62
+ "quantities": {
63
+ "items": {
64
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
65
+ "type": "string",
66
+ },
67
+ "minItems": 1,
68
+ "title": "Quantities",
69
+ "type": "array",
70
+ },
71
+ "scope": {
72
+ "const": "set",
73
+ "default": "set",
74
+ "title": "Scope",
75
+ "type": "string",
76
+ },
77
+ "window_sets": {
78
+ "minimum": 1,
79
+ "title": "Window Sets",
80
+ "type": "integer",
81
+ },
82
+ "cooldown_sets": {
83
+ "anyOf": [
84
+ {
85
+ "minimum": 1,
86
+ "type": "integer",
87
+ },
88
+ {
89
+ "const": "session",
90
+ "type": "string",
91
+ },
92
+ ],
93
+ "title": "Cooldown Sets",
94
+ },
95
+ "conditions": {
96
+ "items": {
97
+ "$ref": "#/$defs/RuleCondition",
98
+ },
99
+ "minItems": 1,
100
+ "title": "Conditions",
101
+ "type": "array",
102
+ },
103
+ "direction": {
104
+ "enum": ["easier", "harder"],
105
+ "title": "Direction",
106
+ "type": "string",
107
+ },
108
+ "description": {
109
+ "maxLength": 240,
110
+ "minLength": 1,
111
+ "title": "Description",
112
+ "type": "string",
113
+ },
114
+ },
115
+ "required": [
116
+ "id",
117
+ "quantities",
118
+ "window_sets",
119
+ "cooldown_sets",
120
+ "conditions",
121
+ "direction",
122
+ "description",
123
+ ],
124
+ "title": "TriggerRule",
125
+ "type": "object",
126
+ }
127
+ STREAM_REDUCER_JSON_SCHEMA: dict[str, Any] = {
128
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
129
+ "additionalProperties": False,
130
+ "description": "One declared stream reducer turning high-rate live readings into a summary.",
131
+ "properties": {
132
+ "id": {
133
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
134
+ "title": "Id",
135
+ "type": "string",
136
+ },
137
+ "version": {
138
+ "default": 1,
139
+ "minimum": 1,
140
+ "title": "Version",
141
+ "type": "integer",
142
+ },
143
+ "input_quantity": {
144
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
145
+ "title": "Input Quantity",
146
+ "type": "string",
147
+ },
148
+ "input_measure": {
149
+ "anyOf": [
150
+ {
151
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
152
+ "type": "string",
153
+ },
154
+ {
155
+ "type": "null",
156
+ },
157
+ ],
158
+ "default": None,
159
+ "title": "Input Measure",
160
+ },
161
+ "reduction": {
162
+ "enum": ["mean", "peak", "min", "time_in_zone", "change_from_first"],
163
+ "title": "Reduction",
164
+ "type": "string",
165
+ },
166
+ "scope": {
167
+ "enum": ["rep", "set", "session"],
168
+ "title": "Scope",
169
+ "type": "string",
170
+ },
171
+ "output_quantity": {
172
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
173
+ "title": "Output Quantity",
174
+ "type": "string",
175
+ },
176
+ "output_measure": {
177
+ "anyOf": [
178
+ {
179
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
180
+ "type": "string",
181
+ },
182
+ {
183
+ "type": "null",
184
+ },
185
+ ],
186
+ "default": None,
187
+ "title": "Output Measure",
188
+ },
189
+ "output_unit": {
190
+ "maxLength": 32,
191
+ "minLength": 1,
192
+ "title": "Output Unit",
193
+ "type": "string",
194
+ },
195
+ "zone_min": {
196
+ "anyOf": [
197
+ {
198
+ "type": "number",
199
+ },
200
+ {
201
+ "type": "null",
202
+ },
203
+ ],
204
+ "default": None,
205
+ "title": "Zone Min",
206
+ },
207
+ "zone_max": {
208
+ "anyOf": [
209
+ {
210
+ "type": "number",
211
+ },
212
+ {
213
+ "type": "null",
214
+ },
215
+ ],
216
+ "default": None,
217
+ "title": "Zone Max",
218
+ },
219
+ "description": {
220
+ "maxLength": 240,
221
+ "minLength": 1,
222
+ "title": "Description",
223
+ "type": "string",
224
+ },
225
+ },
226
+ "required": [
227
+ "id",
228
+ "input_quantity",
229
+ "reduction",
230
+ "scope",
231
+ "output_quantity",
232
+ "output_unit",
233
+ "description",
234
+ ],
235
+ "title": "StreamReducer",
236
+ "type": "object",
237
+ }
238
+ LIVE_CUE_RULE_JSON_SCHEMA: dict[str, Any] = {
239
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
240
+ "additionalProperties": False,
241
+ "description": "One declared live cue rule evaluated on a stream reducer's output.",
242
+ "properties": {
243
+ "id": {
244
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
245
+ "title": "Id",
246
+ "type": "string",
247
+ },
248
+ "reducer_id": {
249
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
250
+ "title": "Reducer Id",
251
+ "type": "string",
252
+ },
253
+ "op": {
254
+ "enum": [">=", ">", "<=", "<", "=="],
255
+ "title": "Op",
256
+ "type": "string",
257
+ },
258
+ "threshold": {
259
+ "anyOf": [
260
+ {
261
+ "type": "number",
262
+ },
263
+ {
264
+ "type": "integer",
265
+ },
266
+ ],
267
+ "title": "Threshold",
268
+ },
269
+ "window_sets": {
270
+ "default": 1,
271
+ "minimum": 1,
272
+ "title": "Window Sets",
273
+ "type": "integer",
274
+ },
275
+ "cooldown_sets": {
276
+ "anyOf": [
277
+ {
278
+ "minimum": 1,
279
+ "type": "integer",
280
+ },
281
+ {
282
+ "const": "session",
283
+ "type": "string",
284
+ },
285
+ ],
286
+ "title": "Cooldown Sets",
287
+ },
288
+ "cue_code": {
289
+ "pattern": "^[a-z][a-z0-9_]{0,63}$",
290
+ "title": "Cue Code",
291
+ "type": "string",
292
+ },
293
+ "cue_message": {
294
+ "maxLength": 200,
295
+ "minLength": 1,
296
+ "title": "Cue Message",
297
+ "type": "string",
298
+ },
299
+ },
300
+ "required": ["id", "reducer_id", "op", "threshold", "cooldown_sets", "cue_code", "cue_message"],
301
+ "title": "LiveCueRule",
302
+ "type": "object",
303
+ }
304
+ LIVE_RULE_PRESETS: dict[str, list[dict[str, Any]]] = {
305
+ "general_fitness": [
306
+ {
307
+ "id": "high_effort_streak",
308
+ "quantities": ["set_effort_reported"],
309
+ "scope": "set",
310
+ "window_sets": 2,
311
+ "cooldown_sets": 2,
312
+ "conditions": [
313
+ {
314
+ "metric": "effort_delta",
315
+ "op": ">=",
316
+ "threshold": 1.5,
317
+ "all_in_window": True,
318
+ },
319
+ ],
320
+ "direction": "easier",
321
+ "description": "Reported effort at least 1.5 over target on two sets in a row.",
322
+ },
323
+ {
324
+ "id": "low_effort_streak",
325
+ "quantities": ["set_effort_reported"],
326
+ "scope": "set",
327
+ "window_sets": 2,
328
+ "cooldown_sets": 2,
329
+ "conditions": [
330
+ {
331
+ "metric": "effort_delta",
332
+ "op": "<=",
333
+ "threshold": -2,
334
+ "all_in_window": True,
335
+ },
336
+ ],
337
+ "direction": "harder",
338
+ "description": "Reported effort at least 2.0 under target on two sets in a row.",
339
+ },
340
+ ],
341
+ "hypertrophy": [
342
+ {
343
+ "id": "high_effort_streak",
344
+ "quantities": ["set_effort_reported"],
345
+ "scope": "set",
346
+ "window_sets": 2,
347
+ "cooldown_sets": 2,
348
+ "conditions": [
349
+ {
350
+ "metric": "effort_delta",
351
+ "op": ">=",
352
+ "threshold": 1.5,
353
+ "all_in_window": True,
354
+ },
355
+ ],
356
+ "direction": "easier",
357
+ "description": "Reported effort at least 1.5 over target on two sets in a row.",
358
+ },
359
+ {
360
+ "id": "low_effort_streak",
361
+ "quantities": ["set_effort_reported"],
362
+ "scope": "set",
363
+ "window_sets": 2,
364
+ "cooldown_sets": 2,
365
+ "conditions": [
366
+ {
367
+ "metric": "effort_delta",
368
+ "op": "<=",
369
+ "threshold": -1.5,
370
+ "all_in_window": True,
371
+ },
372
+ ],
373
+ "direction": "harder",
374
+ "description": "Reported effort at least 1.5 under target on two sets in a row.",
375
+ },
376
+ ],
377
+ "strength": [
378
+ {
379
+ "id": "high_effort_streak",
380
+ "quantities": ["set_effort_reported"],
381
+ "scope": "set",
382
+ "window_sets": 2,
383
+ "cooldown_sets": 2,
384
+ "conditions": [
385
+ {
386
+ "metric": "effort_delta",
387
+ "op": ">=",
388
+ "threshold": 1,
389
+ "all_in_window": True,
390
+ },
391
+ ],
392
+ "direction": "easier",
393
+ "description": "Reported effort at least 1.0 over target on two sets in a row.",
394
+ },
395
+ {
396
+ "id": "acute_effort_spike",
397
+ "quantities": ["set_effort_reported"],
398
+ "scope": "set",
399
+ "window_sets": 1,
400
+ "cooldown_sets": "session",
401
+ "conditions": [
402
+ {
403
+ "metric": "effort_delta",
404
+ "op": ">=",
405
+ "threshold": 2,
406
+ "all_in_window": True,
407
+ },
408
+ ],
409
+ "direction": "easier",
410
+ "description": "Reported effort at least 2.0 over target on a single set.",
411
+ },
412
+ {
413
+ "id": "low_effort_streak",
414
+ "quantities": ["set_effort_reported"],
415
+ "scope": "set",
416
+ "window_sets": 2,
417
+ "cooldown_sets": 2,
418
+ "conditions": [
419
+ {
420
+ "metric": "effort_delta",
421
+ "op": "<=",
422
+ "threshold": -1.5,
423
+ "all_in_window": True,
424
+ },
425
+ ],
426
+ "direction": "harder",
427
+ "description": "Reported effort at least 1.5 under target on two sets in a row.",
428
+ },
429
+ ],
430
+ "power": [
431
+ {
432
+ "id": "high_effort_streak",
433
+ "quantities": ["set_effort_reported"],
434
+ "scope": "set",
435
+ "window_sets": 2,
436
+ "cooldown_sets": 2,
437
+ "conditions": [
438
+ {
439
+ "metric": "effort_delta",
440
+ "op": ">=",
441
+ "threshold": 1,
442
+ "all_in_window": True,
443
+ },
444
+ ],
445
+ "direction": "easier",
446
+ "description": "Reported effort at least 1.0 over target on two sets in a row.",
447
+ },
448
+ {
449
+ "id": "acute_effort_spike",
450
+ "quantities": ["set_effort_reported"],
451
+ "scope": "set",
452
+ "window_sets": 1,
453
+ "cooldown_sets": "session",
454
+ "conditions": [
455
+ {
456
+ "metric": "effort_delta",
457
+ "op": ">=",
458
+ "threshold": 1.5,
459
+ "all_in_window": True,
460
+ },
461
+ ],
462
+ "direction": "easier",
463
+ "description": "Reported effort at least 1.5 over target on a single set.",
464
+ },
465
+ ],
466
+ }
467
+ STREAM_REDUCERS: list[dict[str, Any]] = [
468
+ {
469
+ "id": "rep_peak_bar_velocity",
470
+ "version": 1,
471
+ "input_quantity": "bar_velocity",
472
+ "input_measure": "peak",
473
+ "reduction": "peak",
474
+ "scope": "rep",
475
+ "output_quantity": "bar_velocity",
476
+ "output_measure": "peak",
477
+ "output_unit": "m/s",
478
+ "zone_min": None,
479
+ "zone_max": None,
480
+ "description": "Peak bar velocity recorded within a single repetition.",
481
+ },
482
+ {
483
+ "id": "set_velocity_loss",
484
+ "version": 1,
485
+ "input_quantity": "bar_velocity",
486
+ "input_measure": "mean",
487
+ "reduction": "change_from_first",
488
+ "scope": "set",
489
+ "output_quantity": "velocity_loss",
490
+ "output_measure": None,
491
+ "output_unit": "percent",
492
+ "zone_min": None,
493
+ "zone_max": None,
494
+ "description": "Percentage drop in bar velocity from the first repetition to the last in a set.",
495
+ },
496
+ {
497
+ "id": "set_heart_rate_mean",
498
+ "version": 1,
499
+ "input_quantity": "heart_rate",
500
+ "input_measure": "mean",
501
+ "reduction": "mean",
502
+ "scope": "set",
503
+ "output_quantity": "heart_rate",
504
+ "output_measure": "mean",
505
+ "output_unit": "bpm",
506
+ "zone_min": None,
507
+ "zone_max": None,
508
+ "description": "Mean heart rate across a set.",
509
+ },
510
+ {
511
+ "id": "set_heart_rate_peak",
512
+ "version": 1,
513
+ "input_quantity": "heart_rate",
514
+ "input_measure": "peak",
515
+ "reduction": "peak",
516
+ "scope": "set",
517
+ "output_quantity": "heart_rate",
518
+ "output_measure": "peak",
519
+ "output_unit": "bpm",
520
+ "zone_min": None,
521
+ "zone_max": None,
522
+ "description": "Peak heart rate recorded during a set.",
523
+ },
524
+ {
525
+ "id": "set_power_mean",
526
+ "version": 1,
527
+ "input_quantity": "power",
528
+ "input_measure": "mean",
529
+ "reduction": "mean",
530
+ "scope": "set",
531
+ "output_quantity": "power",
532
+ "output_measure": "mean",
533
+ "output_unit": "W",
534
+ "zone_min": None,
535
+ "zone_max": None,
536
+ "description": "Mean mechanical power across a set.",
537
+ },
538
+ {
539
+ "id": "set_power_peak",
540
+ "version": 1,
541
+ "input_quantity": "power",
542
+ "input_measure": "peak",
543
+ "reduction": "peak",
544
+ "scope": "set",
545
+ "output_quantity": "power",
546
+ "output_measure": "peak",
547
+ "output_unit": "W",
548
+ "zone_min": None,
549
+ "zone_max": None,
550
+ "description": "Peak mechanical power recorded during a set.",
551
+ },
552
+ {
553
+ "id": "set_speed_mean",
554
+ "version": 1,
555
+ "input_quantity": "speed",
556
+ "input_measure": "mean",
557
+ "reduction": "mean",
558
+ "scope": "set",
559
+ "output_quantity": "speed",
560
+ "output_measure": "mean",
561
+ "output_unit": "m/s",
562
+ "zone_min": None,
563
+ "zone_max": None,
564
+ "description": "Mean movement speed across a set.",
565
+ },
566
+ {
567
+ "id": "set_cadence_mean",
568
+ "version": 1,
569
+ "input_quantity": "cadence",
570
+ "input_measure": None,
571
+ "reduction": "mean",
572
+ "scope": "set",
573
+ "output_quantity": "cadence",
574
+ "output_measure": None,
575
+ "output_unit": "steps/min",
576
+ "zone_min": None,
577
+ "zone_max": None,
578
+ "description": "Mean step or stride cadence across a set.",
579
+ },
580
+ ]
581
+ LIVE_CUE_RULES: list[dict[str, Any]] = [
582
+ {
583
+ "id": "velocity_loss_end_set",
584
+ "reducer_id": "set_velocity_loss",
585
+ "op": ">=",
586
+ "threshold": 20,
587
+ "window_sets": 1,
588
+ "cooldown_sets": 1,
589
+ "cue_code": "end_set_velocity_loss",
590
+ "cue_message": "Rack the bar and finish this set.",
591
+ },
592
+ ]