Project: Calculator for Exercise Physiologists, PTs and general health & fitness consumers
I have started my first ever programming project, an easy to use calculator so Exercise Physiologists, PTs, gym trainers and the general public, can work out things like Body Mass Index (BMI) and resting energy expenditure without going online or knowing the formulas.
Quite a while ago I had this idea for the calculator after often being asked questions like "How do I work out my BMI?" or "How much energy do I need to eat if I’m trying to lose weight?". Many online tools exist for these sorts of things, but I see three problems with the existing solutions:
- They are spread all over the place. People have to go to one site for BMI, another for BMR, another for max heart rate or training zones, and so on…
- They aren’t comprehensive enough. It’s hard finding online calculators for more advanced things like body fat percentage from skinfold sums
- The formulas often aren’t available. How do I know if an online calculator is accurate when it’s just a series of buttons and the real guts are hidden behind javascript, while nowhere are the formula or its source listed
I will attempt to tackle all of these in some way or another. Here’s how:
- Having a downloadable, cross-platform program means all (most) of the wanted calculations can be done from the one spot on just about any computer
- Using an Open Source license, so anyone is able to add new calculations easily and make the program more comprehensive for all
- In my view, the most important way is the last. In line with the previous point, having the code, the formulas and their sources freely available will provide transparency and enable collaboration. The program will be valid in its calculations because you can see what the formula is and where it came from
In the long term, it would be good to have two versions, one for consumers and one for practitioners. The available calculations varying between the two. Another two things I still need to work out are which OSS license the code will go under, and what the program will be called. I was hoping for something like BodyCalc and EPCalc, but a quick Google search reveals these might already be taken.
I only started learning programming a few days ago, so there’s a long way to go yet. I have been using the excellent Alan Gauld – Learning to program, but I’m not even half-way through so far. It’s Python oriented, which is good because I wanted to learn Python and do this project using it anyway. The tutorial isn’t just about Python though, so hopefully I learn programming from a broad point of view.
In the meantime, here’s a snippet of the code I have so far, to tide you over until I release it all to the public. It has already changed quite a lot from what you see here:
formula = int(raw_input(menu))
while formula != 6: # Keep returning to menu, or quit
if formula == 1: # BMI formula
weight = float(raw_input("Weight (kg): "))
height = float(raw_input("Height (cm): "))
print "Your Body Mass Index is", weight / (height / 100) ** 2
bmiR = weight / (height / 100) ** 2
if bmiR < 18.5: # Tell user what range their BMI falls into
print "Your BMI indicates you might be underweight"
elif ( bmiR >= 18.5) and (bmiR < =24.9):
print "Your BMI indicates you are in the normal weight range"
elif (bmiR >= 25) and (bmiR < = 29.9):
print "Your BMI indicates you might be overweight"
elif (bmiR >= 30) and (bmiR < = 34.9):
...
Right now it should run OOTB on just about any Linux distro, so long as it has a base Python install.
Email or comment if you would be interested in helping out, especially on the Python side of things :)








Leave a Reply