spruhaN / nutrition_pal

1 stars 1 forks source link

Test results (James Irwin) #5

Open irwinj22 opened 1 month ago

irwinj22 commented 1 month ago

Example workflow

Flow 1. Tracking daily calories and inputting workouts

Stephanie has some goals and wants to start tracking her calories and meals.
First she does a POST /user name ,weight height, "Stephanie", 100, 100, gets her id as a return Then she POST /goals/{id} passing “lose weight”, “diet”, and 2000
Next she eats food and does a POST /meal/{id} passing “Mexican” and 800.
She wants to see how many calories she has left GET /daily_calories/{id} returning 1200.
She then eats a pizza, POSTS /meal/{id} passing “Italian” 1200.
Checks calories with GET /daily_calories{id}, returns 0.
Next day GET /meal/{id}/day returning a list of meals with an id, type, calorie, and time stamp

Testing results

1. curl -X 'POST' \ 'https://fast-api-practice.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Stephanie", "weight": 100, "height": 100 }' 2. { "id" : 41 } 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/goals/41' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "goal": "lose weight", "type": "diet", "daily_calories": 2000 }' 2. "OK" 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/meal/41' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Mexican", "calories": 800 }' 2. "OK" 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/daily_calories/41' \ -H 'accept: application/json' 2. { "calories_left": 1200 } 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/meal/41' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Italian", "calories": 1200 }' 2. "OK" 1. curl -X 'GET' \ 'https://fast-api-practice.onrender.com/daily_calories/41’ \ -H 'accept: application/json' \ 2. { "calories_left": 0 } 1. curl -X 'GET' \ 'https://fast-api-practice.onrender.com/meal/41/day' \ -H 'accept: application/json' \ 2. [ { "name": "Mexican", "calories": 800, "time": "2024-05-21T03:15:08.626102+00:00", "type": null }, { "name": "Italian", "calories": 1200, "time": "2024-05-21T03:17:52.809226+00:00", "type": null } ] # Example workflow # Flow 2. Adding and looking up workout Marc wants to build muscle
Marc enters his goals by calling POST /goals passing “get big”, “workout”, 2800.
He then begins adding workouts with with POST /workout passing “deadlift”, 3, 10, 0.
He does this with multiple workouts at varying lengths, set, reps.
His friends asks him what workouts he’s done, so he GET /workouts/days and returns a list of workout with “id”, “name”, “sets”, “reps”, “length”, "type", "group"
His friend asks what to do for back, GET /workout/muscle_group/{type} passing “back” as type and returns a list of workouts "name", "type", and "group" for the back
# Testing results ### Marco enters in his information 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Marco”, "weight": 150, "height": 189 }' 2. { "id" : 42 } ### Marco enters his goals 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/goals/42' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "goal": "get big", "type": "workout", "daily_calories": 2800 }' 2. "OK" ### Marco enters a few workouts 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/42’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "deadlift", "sets": 3, "reps": 10, "length": 2 }' 2. "OK" 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/42’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "pull_up", "sets": 5, "reps": 5, "length": 1 }' 2. "OK" 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/42’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "leg_press", "sets": 1, "reps": 9, "length": 1 }' 2. "OK" ### Marco wants to check how many workouts he's done that day 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workouts/42/day' \ -H 'accept: application/json' 2. [ { "id": 15, "name": "deadlift", "type": "legs", "group": "glutes", "sets": 3, "reps": 10, "length": 2 }, { "id": 9, "name": "pull_up", "type": "back", "group": "lats", "sets": 5, "reps": 5, "length": 1 }, { "id": 22, "name": "leg_press", "type": "legs", "group": "quads", "sets": 1, "reps": 9, "length": 1 } ] ### Marco wants to see what workouts he can do for back 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workouts/muscle_groups/back' \ -H 'accept: application/json' 2. [ { "name": "lat_pulldown", "type": "back", "group": "lats" }, { "name": "cable_row", "type": "back", "group": "traps" }, { "name": "pull_up", "type": "back", "group": "lats" }, { "name": "bent_over_dumbell_row", "type": "back", "group": "lats" } ] # Flow 3. Finding workout muscle_groups Andrew M. is jealous of his roommate’s incredible physique.
Andrew starts with a POST /goals passing “get huge, “workout”, 2800.
He posts a workout POST /workout “squat”, 20, 20, 0.
He wants to see what his workouts hit so he starts with GET/workout/day and gets a list of “id”, “name”, “sets”, “reps”, “length”, "type", and "group"
He wants to see what his squat hits so he does a GET/workout/{id}/muscle_groups passing an id in that was in the prior return.
This returns what muscles he's targeting
### Andrew creates a user account 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Andrew M.", "weight": 90, "height": 189 }' 2. { "id": 43 } ### Andrew inputs his goal 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/goals/43’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "goal": "get huge", "type": "workout", "daily_calories": 5000 }' 2. "OK" ### Andrew puts in his workout 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/43’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "squat", "sets": 20, "reps": 20, "length": 0 }' 2. "OK" ### Andrew forgot what he did and wants to check 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workouts/43/day' \ -H 'accept: application/json' 2. [ { "id": 20, "name": "squat", "type": "legs", "group": "quads", "sets": 20, "reps": 20, "length": 0 } ] ### Andrew is extremely forgetful and wants to see what squat hits 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workout/20/muscle_groups' \ -H 'accept: application/json' 2. [ { "name": "squat", "type": "legs", "group": "quads" } ] # Personal Workflows # Flow 1. Tracking daily calories, meals I, James, want to track my calories to lose weight. I enter my information using POST/user. Then, I enter in my goals by calling POST /goals passing “lose weight”, “diet”, 2800. I begin to add meals. The first is breakfast with POST/meal/{id}, passing “breakfast” and 600. Next, I enter in lunch with POST/meal/{id}, passing “Mediterranean” and 1000. Finally, I add dinner with POST/meal/{id}, passing “Mexican” and 1000.
At the end of the day, I check my total calories with and find that I am 200 under my max! ### James enters in his information 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/user' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": “James”, "weight": 160, "height": 69 }' 2. { "id" : 44 } ### James adds goals 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/goals/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "goal": "lose weight", "type": "diet", "daily_calories": 2800 }' 2. "OK" ### Breakfast 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/meal/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": “breakfast”, "calories": 600 }' 2. "OK" ### Lunch 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/meal/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": “Mediterranean”, "calories": 1000 }' 2. "OK" ### Dinner 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/meal/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": “Mexican”, "calories": 1000 }' 2. "OK" ### Total Calories 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/daily_calories/44’ \ -H 'accept: application/json' 2. { "calories_left": 200 } # Flow 2. Getting ideas for workouts Now, I want to start exercising. First, I enter in a new goal using POST/goals, with the values “gain muscle”, “workout”, and 2800 Then, I decide to hit legs. Best to get some ideas with GET/workout/muscle_group/{type} and the value “legs” Finally, I hit a couple of leg exercises. I enter them in with POST/workout {“bulgarian_split_squat”, 8, 5, 5} and POST/workout {“deadlift”, 5, 3, 8}. ### Entering new goal 1. curl -X 'POST' \ 'https://nutrition-pal.onrender.com/goals/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "goal": “gain “muscle, "type": “workout”, "daily_calories": 2800 }' 2. "OK" ### Getting ideas 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workouts/muscle_groups/legs’ \ -H 'accept: application/json' 2. [ { "name": "deadlift", "type": "legs", "group": "glutes" }, { "name": "squat", "type": "legs", "group": "quads" }, { "name": "bulgarian_split_squat", "type": "legs", "group": "quads" }, { "name": "leg_press", "type": "legs", "group": "quads" }, { "name": "romanian_deadlift", "type": "legs", "group": "hamstrings" }, { "name": "hip_thrust", "type": "legs", "group": "glutes" }, { "name": "hamstring_curl", "type": "legs", "group": "hamstrings" }, { "name": "leg_extension", "type": "legs", "group": "quads" }, { "name": "calf_raise", "type": "legs", "group": "calves" } ] ### Adding exercise 1 1.curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "bulgarian_split_squat", "sets": 8, "reps": 5, "length": 5 }' 2. “OK” ### Adding exercise 2 curl -X 'POST' \ 'https://nutrition-pal.onrender.com/workout/44’ \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "deadlift", "sets": 5, "reps": 3, "length": 8 }' 2. “OK” # Flow 3: Getting a summary of the entire day. Now, I want to get a summary of all that I ate and all that I did. First, I get the food by calling GET/workout/day. Then, I get the exercises with GET/meal/day. ### Getting all that I ate 1. curl -X 'GET' \ 'https://fast-api-practice.onrender.com/meal/44/day' \ -H 'accept: application/json' \ 2. [ { "name": “breakfast”, "calories": 600, "time": "2024-05-21T03:15:08.626102+00:00", "type": null }, { "name": “Mediterranean, "calories": 1000, "time": "2024-05-21T03:17:52.809226+00:00", "type": null }, { "name": “Mexican”, "calories": 1000, "time": "2024-05-21T03:18:41.809226+00:00", "type": null } ] ### Getting all that I did 1. curl -X 'GET' \ 'https://nutrition-pal.onrender.com/workouts/44/day' \ -H 'accept: application/json' 2. [ { "id": 21, "name": "bulgarian_split_squat", "type": "legs", "group": "quads", "sets": 8, "reps": 5, "length": 5 }, { "id": 15, "name": “deadlift, "type": "legs", "group": “glutes”, "sets": 5, "reps": 3, "length": 8 } ]