A Personalized Fitness Progress Tracker using Object-Oriented Design (OOD) principles involves designing a system where fitness activities are tracked, and progress is personalized to the user. Below is the OOD design of such a system, structured with key components: classes, attributes, methods, and relationships between them.
Key Entities in the System
-
User
-
FitnessGoal
-
Workout
-
Exercise
-
Progress
-
Notification
Classes and Their Attributes
-
User
-
Attributes:
-
user_id: int -
name: string -
age: int -
height: float -
weight: float -
fitness_goals: List[FitnessGoal] -
workouts: List[Workout] -
progress: Progress
-
-
Methods:
-
set_personal_information(): Updates user profile (age, height, weight). -
add_goal(fitness_goal: FitnessGoal): Adds a new fitness goal. -
view_progress(): Views current progress based on goals and workouts. -
schedule_workout(workout: Workout): Schedules a workout for the user.
-
-
-
FitnessGoal
-
Attributes:
-
goal_id: int -
goal_type: string(e.g., “weight loss”, “muscle gain”, “stamina improvement”) -
target_value: float(e.g., target weight, body fat percentage, max bench press weight) -
current_value: float -
target_date: datetime -
is_achieved: bool
-
-
Methods:
-
update_current_value(value: float): Updates the current progress towards the goal. -
check_goal_status(): Checks if the goal has been achieved (current_value >= target_value).
-
-
-
Workout
-
Attributes:
-
workout_id: int -
workout_name: string(e.g., “Morning Run”, “Upper Body Strength”) -
exercises: List[Exercise] -
duration: int(in minutes) -
intensity: string(e.g., “low”, “medium”, “high”) -
date_scheduled: datetime
-
-
Methods:
-
add_exercise(exercise: Exercise): Adds an exercise to the workout. -
remove_exercise(exercise: Exercise): Removes an exercise from the workout. -
start_workout(): Starts the workout and tracks progress in real-time. -
end_workout(): Ends the workout and logs results.
-
-
-
Exercise
-
Attributes:
-
exercise_id: int -
name: string(e.g., “Squat”, “Push-up”, “Deadlift”) -
sets: int -
reps_per_set: int -
weight: float(if applicable) -
duration: int(for exercises like running, cycling, etc.) -
calories_burned: float
-
-
Methods:
-
track_set_progress(): Tracks the user’s progress for each set. -
log_results(): Logs the exercise details for tracking progress (e.g., reps completed, calories burned).
-
-
-
Progress
-
Attributes:
-
total_calories_burned: float -
total_workouts_completed: int -
average_workout_duration: float -
total_distance_travelled: float(if applicable) -
body_measurements: dict(e.g., weight, body fat percentage, muscle mass)
-
-
Methods:
-
calculate_overall_progress(): Calculates the overall progress by analyzing completed workouts and goals. -
generate_report(): Generates a fitness progress report that summarizes key statistics (calories burned, distance travelled, etc.).
-
-
-
Notification
-
Attributes:
-
notification_id: int -
message: string -
date_sent: datetime -
is_read: bool
-
-
Methods:
-
send_notification(user: User, message: string): Sends a fitness-related notification (e.g., goal achievement, reminder). -
mark_as_read(): Marks the notification as read.
-
-
Class Relationships
-
User ↔ FitnessGoal: A user can have multiple fitness goals.
-
User ↔ Workout: A user can have multiple workouts.
-
Workout ↔ Exercise: A workout consists of multiple exercises.
-
User ↔ Progress: A user’s progress is updated after each workout.
-
User ↔ Notification: Users receive notifications for goal achievements, reminders, etc.
Example Workflow
-
User Setup:
-
A user creates an account with personal details such as name, age, height, and weight.
-
-
Setting Fitness Goals:
-
The user sets a fitness goal, such as losing 10 lbs in 3 months or increasing bench press weight by 20 kg.
-
-
Scheduling Workouts:
-
The user schedules a workout, which includes exercises like running, squats, and push-ups.
-
-
Tracking Workouts:
-
During each workout, the system tracks data like calories burned, time spent, sets completed, and weight lifted.
-
-
Updating Progress:
-
The system updates progress after each workout, checking if the user is on track to meet their goals.
-
-
Goal Monitoring:
-
Once the user achieves a milestone or completes a goal, the system sends a notification congratulating the user on reaching the target.
-
-
Feedback:
-
Based on progress, the system may suggest new goals or recommend workout adjustments to keep improving fitness levels.
-
Code Snippet Example
System Features
-
Real-time tracking: Track the user’s activities, including calories burned, exercises completed, and progress towards goals.
-
Personalized progress reports: Offer insights and feedback based on individual user data.
-
Goal setting and reminders: