workout generator audit: rules engine, structure rules, split patterns, injury UX, metadata cleanup

- Add rules_engine.py with quantitative rules for all 8 workout types
- Add quality gate retry loop in generate_single_workout()
- Expand calibrate_structure_rules to all 120 combinations (8 types × 5 goals × 3 sections)
- Wire WeeklySplitPattern DB records into _pick_weekly_split()
- Enforce movement patterns from WorkoutStructureRule in exercise selection
- Add straight-set strength support (single main lift, 4-6 rounds)
- Add modality consistency check for duration-dominant workout types
- Add InjuryStep component to onboarding and preferences
- Add sibling exercise exclusion in regenerate and preview_day endpoints
- Display generator warnings on dashboard
- Expand fix_rep_durations, fix_exercise_flags, fix_movement_pattern_typo
- Add audit_exercise_data and check_rules_drift management commands
- Add Next.js frontend with dashboard, onboarding, preferences, history pages
- Add generator app with ML-powered workout generation pipeline
- 96 new tests across 7 test modules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-22 20:07:40 -06:00
parent 2a16b75c4b
commit 1c61b80731
111 changed files with 28108 additions and 30 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.1.4 on 2026-02-20 22:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('superset', '0007_superset_estimated_time'),
]
operations = [
migrations.AddField(
model_name='superset',
name='rest_between_rounds',
field=models.IntegerField(default=45, help_text='Rest between rounds in seconds'),
),
]

View File

@@ -0,0 +1,25 @@
# Generated by Django 5.1.4 on 2026-02-21 05:32
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exercise', '0011_fix_related_names_and_nullable'),
('superset', '0008_superset_rest_between_rounds'),
]
operations = [
migrations.AlterField(
model_name='supersetexercise',
name='exercise',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercise_supersets', to='exercise.exercise'),
),
migrations.AlterField(
model_name='supersetexercise',
name='superset',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='superset_exercises', to='superset.superset'),
),
]

View File

@@ -17,6 +17,7 @@ class Superset(models.Model):
rounds = models.IntegerField(max_length=3, blank=False, null=False)
order = models.IntegerField(max_length=3, blank=False, null=False)
estimated_time = models.FloatField(max_length=255, blank=True, null=True)
rest_between_rounds = models.IntegerField(default=45, help_text='Rest between rounds in seconds')
def __str__(self):
name = " -- " if self.name is None else self.name
@@ -29,13 +30,13 @@ class SupersetExercise(models.Model):
exercise = models.ForeignKey(
Exercise,
on_delete=models.CASCADE,
related_name='superset_exercise_exercise'
related_name='exercise_supersets'
)
superset = models.ForeignKey(
Superset,
on_delete=models.CASCADE,
related_name='superset_exercise_exercise'
related_name='superset_exercises'
)
weight = models.IntegerField(null=True, blank=True, max_length=4)

View File

@@ -26,7 +26,9 @@ class SupersetSerializer(serializers.ModelSerializer):
model = Superset
fields = '__all__'
def get_exercises(self, obj):
def get_exercises(self, obj):
if obj.pk is None:
return []
objs = SupersetExercise.objects.filter(superset=obj).order_by('order')
data = SupersetExerciseSerializer(objs, many=True).data
return data