When you complete the onboarding quiz, KERN does not randomly assign exercises — it runs a deterministic selection algorithm that maps your chosen routine type to specific muscle groups and movement patterns, then picks exercises that match both dimensions from the gym exercise catalog.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jaimegayo/KERNDOCUMENTATION/llms.txt
Use this file to discover all available pages before exploring further.
Routine types
KERN supports three routine structures. Each is defined in theROUTINE_CONFIGS dictionary inside app.py and maps to a list of {muscle, pattern} targets.
Full Body — 5 exercises
Full Body — 5 exercises
Targets one exercise from each of five fundamental patterns in a single session: horizontal push (chest), vertical pull (back), squat (quads), vertical push (shoulders), and hip hinge (hamstrings). Designed for training 3 days per week.
PPL (Push Pull Leg) — 8 exercises
PPL (Push Pull Leg) — 8 exercises
Splits the week into push, pull, and leg days. The push slot covers chest (flat and incline) and shoulders. The pull slot covers vertical and horizontal back plus biceps isolation. The leg slot covers quad-dominant and hamstring-dominant patterns. Designed for 6-day training frequency.
Torso-Pierna — 6 exercises
Torso-Pierna — 6 exercises
An upper/lower split that alternates torso (chest, upper chest, back, mid-back) and leg (quad squat, hamstring hinge) sessions. Suitable for 4-day training frequency.
How exercise selection works
Thegenerate_routine_exercises function in app.py iterates over each {muscle, pattern} target in the chosen config and selects one exercise per slot.
Load the exercise catalog
At startup, KERN reads
exercises_gym_id.json into memory. Every entry has a primary_muscle and a movement_pattern field.Match by muscle and pattern
For each config slot, the algorithm looks for exercises where both
primary_muscle and movement_pattern match the target (case-insensitive).Fallback to muscle-only
If no exercise matches both criteria, the algorithm widens the search to muscle alone. This ensures every slot is always filled.
Random selection
One exercise is chosen at random from the candidate list using
random.choice(). This introduces variety across users with the same routine type.Triggering generation
Routine generation is triggered automatically when the user completes the quiz. ThePOST /users/complete-quiz endpoint receives the selected routine name, validates it against ROUTINE_CONFIGS, runs generate_routine_exercises, and persists the result as a new Routine with linked RoutineExercise rows.
If the
assigned_routine value does not match any key in ROUTINE_CONFIGS, no exercises are generated. Accepted values are "Full Body", "PPL (Push Pull Leg)", and "Torso-Pierna" — exact string match required.