Last active
March 27, 2024 14:35
-
-
Save aialenti/da213be83f7b59d7b7cb9c575c95068c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAX_WEIGHTS = { | |
'Dumbbell Row': 45.0, | |
'Bench Press': 77.5, | |
'Stretch Lying Abduction': 0, | |
'Squat': 65.0, | |
'Romanian Deadlift': 95.0, | |
'Goblet Squat': 32.0, | |
'Pull-up': 0, | |
'Incline Barbell Bench Press': 65.0, | |
'Weighted Dip': 15.0, | |
'Triceps Press-down': 35.0, | |
'Military Press': 40.0, | |
'Bent-over Lateral Raise': 15.0, | |
'Barbell Row': 70.0, | |
'Lat Pull-down': 70.0, | |
'Barbell Biceps Curl': 20.0, | |
'Front Raise': 17.5 | |
} | |
INITIAL_WEIGHTS = { | |
'Dumbbell Row': 22.5, | |
'Stretch Lying Abduction': 0, | |
'Bench Press': 50, | |
'Squat': 25.0, | |
'Romanian Deadlift': 25.0, | |
'Goblet Squat': 16.0, | |
'Pull-up': 0, | |
'Incline Barbell Bench Press': 57.5, | |
'Weighted Dip': 0, | |
'Triceps Press-down': 30.0, | |
'Military Press': 30.0, | |
'Bent-over Lateral Raise': 15.0, | |
'Barbell Row': 62.5, | |
'Lat Pull-down': 55.0, | |
'Barbell Biceps Curl': 13.5, | |
'Front Raise': 12.5 | |
} | |
ACTIVITY_AGGREGATES = { | |
'Back and Biceps': { | |
'Average Moving Duration': 1978.67802734375, | |
'Moving Duration/Duration Ratio': 0.4498125551450178, | |
'Average HR': 98.6, | |
'Average Calories': 456.4, | |
'Average Total Sets': 19.0, | |
'Average Total Reps': 102.8, | |
'Total Sessions': 5, | |
'Frequency per Week': 1.206896551724138 | |
}, | |
'Chest': { | |
'Average Moving Duration': 1443.7748849051338, | |
'Moving Duration/Duration Ratio': 0.36550393515082114, | |
'Average HR': 99.28571428571429, | |
'Average Calories': 407.14285714285717, | |
'Average Total Sets': 18.571428571428573, | |
'Average Total Reps': 98.85714285714286, | |
'Total Sessions': 7, | |
'Frequency per Week': 1.3243243243243243 | |
}, | |
'Legs': { | |
'Average Moving Duration': 1646.822998046875, | |
'Moving Duration/Duration Ratio': 0.46666611770520994, | |
'Average HR': 109.85714285714286, | |
'Average Calories': 462.85714285714283, | |
'Average Total Sets': 15.285714285714286, | |
'Average Total Reps': 107.0, | |
'Total Sessions': 7, | |
'Frequency per Week': 1.2894736842105263 | |
}, | |
'Shoulders': { | |
'Average Moving Duration': 1176.0319946289062, | |
'Moving Duration/Duration Ratio': 0.35952715359627974, | |
'Average HR': 91.4, | |
'Average Calories': 291.6, | |
'Average Total Sets': 15.6, | |
'Average Total Reps': 86.8, | |
'Total Sessions': 5, | |
'Frequency per Week': 1.25 | |
} | |
} | |
MEDIAN_TOTAL_KCAL = 2687.0 | |
MEDIAN_ACTIVE_KAL = 407.0 | |
MEDIAN_RESTING_HR = 47.0 | |
MEDIAN_SLEEP_SECONDS = 25140.0 | |
# Data structure for median stats | |
median_stats = { | |
'MEDIAN_TOTAL_KCAL': MEDIAN_TOTAL_KCAL, | |
'MEDIAN_ACTIVE_KAL': MEDIAN_ACTIVE_KAL, | |
'MEDIAN_RESTING_HR': MEDIAN_RESTING_HR, | |
'MEDIAN_SLEEP_SECONDS': MEDIAN_SLEEP_SECONDS | |
} | |
def generate_detailed_progress_report(max_weights, initial_weights, activity_aggregates, median_stats): | |
# Calculate delta percentages and overall progress | |
total_initial, total_max = 0, 0 | |
deltas = {} | |
for exercise in max_weights: | |
initial = initial_weights[exercise] | |
max_w = max_weights[exercise] | |
delta = ((max_w - initial) / initial * 100) if initial > 0 else 0 | |
deltas[exercise] = delta | |
total_initial += initial | |
total_max += max_w | |
overall_progress = ((total_max - total_initial) / total_initial * 100) if total_initial > 0 else 0 | |
# WEIGHTS PROGRESS section | |
weights_progress_section = "[WEIGHTS PROGRESS - What's the progress of the customer from when they started the trainign program]\nThe customer had the following progress from the beginning of the training programme\n" | |
for exercise, delta in deltas.items(): | |
weights_progress_section += f" - {exercise} -> {delta:.0f}% delta between the initial weight used and max weight reached during programme.\n" | |
weights_progress_section += f"\nOverall progress in weights lifted: {overall_progress:.0f}%.\n" | |
# TRAINING section | |
training_section = "\n[TRAINING SESSIONS - How the training sessions look like]\nThese are the average stats during training, per type of training session:\n" | |
for activity, stats in activity_aggregates.items(): | |
duration_minutes = stats['Average Moving Duration'] / 60 | |
total_duration_minutes = stats['Average Moving Duration'] / stats['Moving Duration/Duration Ratio'] / 60 | |
training_section += (f" - {activity.upper()}: average active duration is {duration_minutes:.0f} minutes, while the average training session for {activity.upper()} lasts for {total_duration_minutes:.0f} minutes; " | |
f"heart rate of {stats['Average HR']:.0f} BPMs; " | |
f"calories burned on average {stats['Average Calories']:.0f}; " | |
f"average total sets {stats['Average Total Sets']:.0f}; " | |
f"and reps {stats['Average Total Reps']:.0f}.\n") | |
# Median Health Statistics section | |
health_stats_section = "\n[OTHER STATISTICS - General statistics (sleep, kcal, etc.)]\n - Median Total Daily Calories Burned: {:.0f}\n".format(median_stats['MEDIAN_TOTAL_KCAL']) | |
health_stats_section += " - Median Daily Active Calories Burned: {:.0f}\n".format(median_stats['MEDIAN_ACTIVE_KAL']) | |
health_stats_section += " - Median Resting Heart Rate: {:.0f}\n".format(median_stats['MEDIAN_RESTING_HR']) | |
sleep_hours = median_stats['MEDIAN_SLEEP_SECONDS'] / 3600 | |
health_stats_section += " - Median Sleep Duration: {:.0f} hours\n".format(sleep_hours) | |
# Combine all sections | |
full_report = weights_progress_section + training_section + health_stats_section | |
return full_report | |
# Generate and print the detailed report | |
DETAILED_REPORT = generate_detailed_progress_report(MAX_WEIGHTS, INITIAL_WEIGHTS, ACTIVITY_AGGREGATES, median_stats) | |
print(detailed_report) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment