jakji93 / airon-fitness

AIRON Fitness is an AI-powered fitness companion supporting your personal health journey by delivering customized fitness and meal plans tailored to your goals and preferences.
https://airon-fitness.onrender.com/
MIT License
3 stars 2 forks source link

Update to use real data #72

Closed jakji93 closed 11 months ago

jakji93 commented 11 months ago

Using the existing route for generating both schedules

d-x-s commented 11 months ago

It's working and loading successfully, but workout stats is not equipped to use this data somehow: image

Redux State: { workoutAndMealSchedule: { workoutSchedule: { userInfoID: '64c2d468c659827fa2c5538b', schedule: '{\n "Monday": {\n "exercises": [\n {\n "exercise": "Dumbbell Squats",\n "sets": 3,\n "reps": 12,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 150\n },\n {\n "exercise": "Dumbbell Lunges",\n "sets": 3,\n "reps": 12,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 150\n },\n {\n "exercise": "Treadmill Jogging",\n "sets": 1,\n "reps": 1,\n "rest": 0,\n "duration": 20,\n "intensity": 60,\n "calories": 200\n }\n ],\n "total_calories": 500\n },\n "Tuesday": {\n "exercises": [\n {\n "exercise": "Dumbbell Bench Press",\n "sets": 3,\n "reps": 10,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 180\n },\n {\n "exercise": "Dumbbell Shoulder Press",\n "sets": 3,\n "reps": 10,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 180\n },\n {\n "exercise": "Treadmill Running",\n "sets": 1,\n "reps": 1,\n "rest": 0,\n "duration": 20,\n "intensity": 80,\n "calories": 250\n }\n ],\n "total_calories": 610\n },\n "Wednesday": {\n "exercises": [\n {\n "exercise": "Dumbbell Deadlifts",\n "sets": 3,\n "reps": 12,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 180\n },\n {\n "exercise": "Dumbbell Rows",\n "sets": 3,\n "reps": 12,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 180\n },\n {\n "exercise": "Treadmill Incline Walk",\n "sets": 1,\n "reps": 1,\n "rest": 0,\n "duration": 20,\n "intensity": 60,\n "calories": 200\n }\n ],\n "total_calories": 560\n },\n "Thursday": {\n "exercises": [\n {\n "exercise": "Dumbbell Bicep Curls",\n "sets": 3,\n "reps": 10,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 150\n },\n {\n "exercise": "Dumbbell Tricep Extensions",\n "sets": 3,\n "reps": 10,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 150\n },\n {\n "exercise": "Treadmill Jogging",\n "sets": 1,\n "reps": 1,\n "rest": 0,\n "duration": 20,\n "intensity": 60,\n "calories": 200\n }\n ],\n "total_calories": 500\n },\n "Friday": {\n "exercises": [\n {\n "exercise": "Dumbbell Shoulder Press",\n "sets": 3,\n "reps": 10,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 180\n },\n {\n "exercise": "Dumbbell Lunges",\n "sets": 3,\n "reps": 12,\n "rest": 60,\n "duration": 20,\n "intensity": 70,\n "calories": 150\n },\n {\n "exercise": "Treadmill Running",\n "sets": 1,\n "reps": 1,\n "rest": 0,\n "duration": 20,\n "intensity": 80,\n "calories": 250\n }\n ],\n "total_calories": 610\n }\n}', inputs: [] }, mealSchedule: { userInfoID: '64c2d468c659827fa2c5538b', schedule: '{\n "schedule": {\n "Monday": {\n "breakfast": "Oatmeal with almond milk, berries, and chia seeds",\n "snack1": "Mixed nuts and seeds",\n "lunch": "Quinoa salad with roasted vegetables and tofu",\n "snack2": "Hummus with carrot sticks",\n "dinner": "Grilled tempeh with steamed broccoli and brown rice",\n "nutrition_totals": {\n "calories": 1800,\n "carbohydrates": 200,\n "protein": 120,\n "fat": 60\n }\n },\n "Tuesday": {\n "breakfast": "Scrambled tofu with spinach and whole wheat toast",\n "snack1": "Greek yogurt with sliced almonds",\n "lunch": "Chickpea salad with avocado and quinoa",\n "snack2": "Apple slices with almond butter",\n "dinner": "Vegetable stir-fry with tofu and brown rice",\n "nutrition_totals": {\n "calories": 1900,\n "carbohydrates": 210,\n "protein": 130,\n "fat": 65\n }\n },\n "Wednesday": {\n "breakfast": "Smoothie with almond milk, banana, spinach, and protein powder",\n "snack1": "Roasted chickpeas",\n "lunch": "Sweet potato and black bean burrito",\n "snack2": "Celery sticks with peanut butter",\n "dinner": "Grilled portobello mushrooms with quinoa and roasted vegetables",\n "nutrition_totals": {\n "calories": 1850,\n "carbohydrates": 195,\n "protein": 125,\n "fat": 62\n }\n },\n "Thursday": {\n "breakfast": "Whole grain cereal with soy milk and sliced fruit",\n "snack1": "Protein bar",\n "lunch": "Spinach and lentil salad with balsamic vinaigrette",\n "snack2": "Trail mix with dried fruit and seeds",\n "dinner": "Baked tofu with steamed asparagus and quinoa",\n "nutrition_totals": {\n "calories": 1800,\n "carbohydrates": 200,\n "protein": 120,\n "fat": 60\n }\n },\n "Friday": {\n "breakfast": "Avocado toast with whole grain bread",\n "snack1": "Edamame",\n "lunch": "Vegetable curry with brown rice",\n "snack2": "Rice cakes with almond butter",\n "dinner": "Grilled tempeh with roasted Brussels sprouts and quinoa",\n "nutrition_totals": {\n "calories": 1900,\n "carbohydrates": 210,\n "protein": 130,\n "fat": 65\n }\n },\n "Saturday": {\n "breakfast": "Vegan protein pancakes with berries",\n "snack1": "Mixed nuts and seeds",\n "lunch": "Mediterranean quinoa salad with chickpeas and olives",\n "snack2": "Carrot sticks with hummus",\n "dinner": "Stir-fried tofu with mixed vegetables and brown rice",\n "nutrition_totals": {\n "calories": 1850,\n "carbohydrates": 195,\n "protein": 125,\n "fat": 62\n }\n },\n "Sunday": {\n "breakfast": "Chia seed pudding with almond milk and fruit",\n "snack1": "Roasted chickpeas",\n "lunch": "Black bean and vegetable wrap",\n "snack2": "Apple slices with almond butter",\n "dinner": "Grilled portobello mushrooms with quinoa and roasted vegetables",\n "nutrition_totals": {\n "calories": 1800,\n "carbohydrates": 200,\n "protein": 120,\n "fat": 60\n }\n }\n }\n}', inputs: [] }, isError: false, isSuccess: true, isLoading: false, message: 'Your schedules have been loaded!' }, auth: { user: { id: '64c2d468c659827fa2c5538b', email: 'test@test.com', token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NGMyZDQ2OGM2NTk4MjdmYTJjNTUzOGIiLCJpYXQiOjE2OTA0OTAwNDMsImV4cCI6MTY5MzA4MjA0M30.2S0kipNWNP3yHAxrbQz5WgXtzye4y84xHXI87Hm7s_w' }, isError: false, isSuccess: false, isLoading: false, message: '' }, signup: { user: { gender: 'Male', firstName: 'Davis', lastName: 'Song', birthday: '2001-02-16', weight: 66, height: 178, weightUnit: 'kg', heightUnit: 'cm', experience: 'Intermediate', goals: [ 'Weight Loss', 'Muscle Growth' ], apiKey: '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', healthConditions: [ 'Asthma' ], dietRestrictions: [], allergies: [], weeklyAvailability: '7', bodyFat: 13, muscleMass: 50, duration: 60, preference: [], equipment: [], dietRestriction: [] }, step: 4 }, userProfile: { profile: { _id: '64c2d619c659827fa2c553a6', userInfoID: '64c2d468c659827fa2c5538b', birthday: '1990-12-31T00:00:00.000Z', gender: 'Male', height: 175, heightUnit: 'cm', weight: 70, weightUnit: 'kg', experience: 'Intermediate', bodyFat: 18, muscleMass: 65, allergies: [ 'Peanuts', 'Gluten' ], duration: 60, weeklyAvailability: 5, preference: [ 'Cardio', 'Weightlifting' ], equipment: [ 'Dumbbells', 'Treadmill' ], goals: [ 'Weight Loss', 'Muscle Gain' ], healthConditions: [ 'Asthma', 'Hypertension' ], dietRestriction: [ 'Vegetarian', 'Vegan' ], apiKey: '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', firstName: 'John', lastName: 'Doe', createdAt: '2023-07-27T20:39:53.718Z', updatedAt: '2023-07-27T20:39:53.718Z', __v: 0 }, isError: false, isSuccess: true, isLoading: false, message: '' } }

d-x-s commented 11 months ago

Still some NULL object or value somewhere... The parsing of the GPT output is working, so do we have a valid object now.

image

{ workoutAndMealSchedule: { workoutSchedule: { Monday: { exercises: [ { exercise: 'Dumbbell Squats', sets: 3, reps: 12, rest: 60, duration: 20, intensity: 70, calories: 150 }, { exercise: 'Dumbbell Lunges', sets: 3, reps: 12, rest: 60, duration: 20, intensity: 70, calories: 150 }, { exercise: 'Treadmill Jogging', sets: 1, reps: 1, rest: 0, duration: 20, intensity: 60, calories: 200 } ], total_calories: 500 }, Tuesday: { exercises: [ { exercise: 'Dumbbell Bench Press', sets: 3, reps: 10, rest: 60, duration: 20, intensity: 70, calories: 180 }, { exercise: 'Dumbbell Shoulder Press', sets: 3, reps: 10, rest: 60, duration: 20, intensity: 70, calories: 180 }, { exercise: 'Treadmill Running', sets: 1, reps: 1, rest: 0, duration: 20, intensity: 80, calories: 250 } ], total_calories: 610 }, Wednesday: { exercises: [ { exercise: 'Dumbbell Deadlifts', sets: 3, reps: 12, rest: 60, duration: 20, intensity: 70, calories: 180 }, { exercise: 'Dumbbell Rows', sets: 3, reps: 12, rest: 60, duration: 20, intensity: 70, calories: 180 }, { exercise: 'Treadmill Incline Walk', sets: 1, reps: 1, rest: 0, duration: 20, intensity: 60, calories: 200 } ], total_calories: 560 }, Thursday: { exercises: [ { exercise: 'Dumbbell Bicep Curls', sets: 3, reps: 10, rest: 60, duration: 20, intensity: 70, calories: 150 }, { exercise: 'Dumbbell Tricep Extensions', sets: 3, reps: 10, rest: 60, duration: 20, intensity: 70, calories: 150 }, { exercise: 'Treadmill Jogging', sets: 1, reps: 1, rest: 0, duration: 20, intensity: 60, calories: 200 } ], total_calories: 500 }, Friday: { exercises: [ { exercise: 'Dumbbell Shoulder Press', sets: 3, reps: 10, rest: 60, duration: 20, intensity: 70, calories: 180 }, { exercise: 'Dumbbell Lunges', sets: 3, reps: 12, rest: 60, duration: 20, intensity: 70, calories: 150 }, { exercise: 'Treadmill Running', sets: 1, reps: 1, rest: 0, duration: 20, intensity: 80, calories: 250 } ], total_calories: 610 } }, mealSchedule: { schedule: { Monday: { breakfast: 'Oatmeal with almond milk, berries, and chia seeds', snack1: 'Mixed nuts and seeds', lunch: 'Quinoa salad with roasted vegetables and tofu', snack2: 'Hummus with carrot sticks', dinner: 'Grilled tempeh with steamed broccoli and brown rice', nutrition_totals: { calories: 1800, carbohydrates: 200, protein: 120, fat: 60 } }, Tuesday: { breakfast: 'Scrambled tofu with spinach and whole wheat toast', snack1: 'Greek yogurt with sliced almonds', lunch: 'Chickpea salad with avocado and quinoa', snack2: 'Apple slices with almond butter', dinner: 'Vegetable stir-fry with tofu and brown rice', nutrition_totals: { calories: 1900, carbohydrates: 210, protein: 130, fat: 65 } }, Wednesday: { breakfast: 'Smoothie with almond milk, banana, spinach, and protein powder', snack1: 'Roasted chickpeas', lunch: 'Sweet potato and black bean burrito', snack2: 'Celery sticks with peanut butter', dinner: 'Grilled portobello mushrooms with quinoa and roasted vegetables', nutrition_totals: { calories: 1850, carbohydrates: 195, protein: 125, fat: 62 } }, Thursday: { breakfast: 'Whole grain cereal with soy milk and sliced fruit', snack1: 'Protein bar', lunch: 'Spinach and lentil salad with balsamic vinaigrette', snack2: 'Trail mix with dried fruit and seeds', dinner: 'Baked tofu with stir-fried vegetables and quinoa', nutrition_totals: { calories: 1800, carbohydrates: 200, protein: 120, fat: 60 } }, Friday: { breakfast: 'Avocado toast with whole grain bread', snack1: 'Edamame', lunch: 'Mediterranean quinoa bowl with falafel', snack2: 'Rice cakes with almond butter', dinner: 'Vegetable curry with tofu and brown rice', nutrition_totals: { calories: 1950, carbohydrates: 215, protein: 135, fat: 70 } }, Saturday: { breakfast: 'Vegan protein pancakes with berries', snack1: 'Cucumber slices with hummus', lunch: 'Black bean and vegetable wrap', snack2: 'Mixed fruit salad', dinner: 'Grilled tempeh with quinoa and roasted vegetables', nutrition_totals: { calories: 1900, carbohydrates: 210, protein: 130, fat: 65 } }, Sunday: { breakfast: 'Chia seed pudding with almond milk and fruit', snack1: 'Protein shake with almond milk', lunch: 'Vegetable and lentil soup', snack2: 'Kale chips', dinner: 'Stuffed bell peppers with quinoa and black beans', nutrition_totals: { calories: 1850, carbohydrates: 195, protein: 125, fat: 62 } } } }, isError: false, isSuccess: true, isLoading: false, message: 'Your schedule has been created!', profile: null }, auth: { user: { id: '64c2e60f890209471ffeb554', email: 'davissong01@gmail.com', token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2NGMyZTYwZjg5MDIwOTQ3MWZmZWI1NTQiLCJpYXQiOjE2OTA0OTQ0NzksImV4cCI6MTY5MzA4NjQ3OX0.YYkJEhOVapP-zk6t3ViGdL1CuSGm-Eq3Ec8Dk0GY1FQ' }, isError: false, isSuccess: false, isLoading: false, message: '' }, signup: { user: { gender: 'Male', firstName: 'Davis', lastName: 'Song', birthday: '2001-07-27', weight: 66, height: 180, weightUnit: 'kg', heightUnit: 'cm', experience: 'Intermediate', goals: [ 'Muscle Growth' ], healthConditions: [ 'Asthma' ], dietRestrictions: [], allergies: [], weeklyAvailability: '5', bodyFat: 10, muscleMass: 20, duration: 10, preference: [ 'e.g. Squat' ], equipment: [ 'e.g. Dumbbells' ], dietRestriction: [] }, step: 1 }, userProfile: { profile: { _id: '64c2e8404266b98ea6afa8da', userInfoID: '64c2e60f890209471ffeb554', birthday: '1990-12-31T00:00:00.000Z', gender: 'Male', height: 175, heightUnit: 'cm', weight: 70, weightUnit: 'kg', experience: 'Intermediate', bodyFat: 18, muscleMass: 65, allergies: [ 'Peanuts', 'Gluten' ], duration: 60, weeklyAvailability: 5, preference: [ 'Cardio', 'Weightlifting' ], equipment: [ 'Dumbbells', 'Treadmill' ], goals: [ 'Weight Loss', 'Muscle Gain' ], healthConditions: [ 'Asthma', 'Hypertension' ], dietRestriction: [ 'Vegetarian', 'Vegan' ], firstName: 'DAVIS', lastName: 'SONG', createdAt: '2023-07-27T21:57:20.066Z', updatedAt: '2023-07-27T21:57:20.066Z', __v: 0 }, isError: false, isSuccess: false, isLoading: false, message: '' } }