Creating multiple Python functions that calculates BMI, BMR, and calorie targets in one unified tool
I built a modular calculation engine using Python, that calculates 7 key health metrics from 5 user inputs (weight, height, age, sex, activity level). The functions use the Mifflin-St Jeor equation for BMR calculations and activity multipliers for calorie targets. By designing each metric as an independent function, the code is easier to manage and debug.
Online health calculators are everywhere, but most only compute one metric at a time. Want your BMI? One website. Maintenance calories? Another. Protein intake? A third. This fragmented experience forces users to re-enter the same data repeatedly across multiple tools.
Goal: Can I build a unified calculator that takes a user's information and returns all their key health metrics
The calculator computes seven interconnected health metrics from a single set of inputs:
I chose a modular function-based codebase because it keeps each calculation isolated, testable, and reusable. Rather than one complex function, each metric has its own dedicated function that can be called independently.
The aggregated function requires only weight, height, age, sex, and activity level, and returns BMI, BMR, maintenance calories, three weight loss targets, and protein intake.
The difference between sedentary (1.2×) and super active (1.9×) multipliers can mean 800+ calories/day difference in maintenance needs for the same person.
Each function can be tested independently, making it easy to verify calculations.
What's Next: With the calculation engine built, Part 2 will wrap this logic in a user-friendly Tkinter GUI. Allowing users to input their data through form fields and see results update in real time.
Continue to Part 2: GUI DevelopmentThis project was my first time building back-end logic for an application, using modular functions has kept things easy to follow and easier to debug.
If I was to revisit this project, I would add input validation to my functions. This would stop users inputting negative values. I'd also add the option for metric and imperial (similar to current online tools). I would also like to increase the number of health metrics calculated, such as body fat percentage.