If we assume there are 1 million daily active users and assume they input 5 workouts a week, 7 sets of meals (3 courses a meal) a week and set one fitness goal a month with a 10 year lifespan:
user data: 1/forever
username: 10 bytes
email: 50 bytes
password: 20 bytes
height: 2 bytes
weight: 4 bytes
total user data = 10 + 50 + 20 + 2 + 4 = 86 bytes
workout data: 5/week
workout id: 10 bytes
workout name: 10 bytes
workout result (distance, lbs lifted, etc): 4 bytes
wearable id: 10 bytes
date: 8 bytes
total workout data for a year = ((10 +10+4+10)*5) * 52 = 6240
nutrition data: 3/meal and 3/day and 7 days/week
mealType(breakfast,lunch,dinner,snack): 10 bytes
food name: 20 bytes
calories: 5 bytes
weight: 5 bytes
total nutrition data for a year: (((10 + 20 + 5 + 5)*3) * 3 * 7) * 52
= 131040
goal data: 1/month
goal_id: 10 bytes
goal name: 10 bytes
goal current: 4 bytes
goal target : 4 bytes
goal startdate: 8 bytes
goal enddate: 8 bytes
total goal data for a year: (10 + 10+ 10 + 4 + 4 + 8 + 8) * 12 = 330
total data over 10 years: (86 + 6240 + 131040 + 330) * 10 = 1376800 bytes = approx. 1.37mb per user over 10 years
1.37 * 1000000 daily active users= 1.37 terabyte total
createAccount(username,password,email,height,weight,)
createGoal(goal_name,goal_target,start_date,end_date)
inputMeal(meal_type, food_name, calories, food_weight)
inputWorkout(workout_name,result,wearable_id)
createGraph(user_id,workouts)
login(username,password)
logout(username)
shareAchievement(platform, platform_username, platform_password, goal_id)
User {
username string,
user_id: string,
password: string,
weight: float<>,
height: string,
workoutLog: Workout<>,
email: string
}
Workout {
workout_id: string,
workout_name: string,
workout_result: float,
wearable_id: string,
date: datetime
}
Goal {
goal_id: string,
goal_name: string,
current_progress: double,
target_progress: double,
goal_workouts: Workout<>,
startdate: datetime,
enddate: datetime
}
Nutrition {
user_id: string,
meals: Meal<>,
date: datetime,
totalCalories: float
}
MealType{
breakfast: 'breakfast',
lunch: 'lunch',
dinner: 'dinner'
}
Meal {
meal_id: String,
meal_type: MealType<>,
food_name: string,
calories: float,
weight: float
}
Notification{
message: string,
goal_id: string
}
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
A user will input data on workouts which will be stored in the database under their user id, this will be an array of data which will be sent to an analytics software like amazon athena to generate diagrams or graphs which highlight their progress.
I choose to use a relational database like mysql because relational databases tend to work better when capturing analytical data. I choose to utilize an analytics software like amazon athena since it works very well with relational data and can handle generation of complex graphs, cutting down development resources on creating our own. Also oauth is a secure platform for handling login, we can reduce risk on our side by letting them handle secure login
If oauth is down, we will have downtime on our entire application. Also amazon athena will cause problems when generating analytics if it is down.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?