__STYLES__

Health data insights of one’s BMI and, if desired, their waist-to-hip ratio

Tools used in this project
Health data insights of one’s BMI and, if desired, their waist-to-hip ratio

About this project

Project goal:

The primary purpose of this Python program was to calculate the user’s BMI and waist-to-hip ratio values and provide assessments of associated health risk categories.

Background information on BMI and waist to hip ratio:

Special mention: Quotes used in this section are referenced in the website sources and inspiration section of this data project.

Before examining this data project, some background information on BMI and waist to hip ratio will be briefly discussed to provide context.

Maintaining an individual's weight is a constant lifelong journey. As such, according to the cdc.gov website, "BMI can be a screening tool, but it does not diagnose the body fatness or health of an individual." As also mentioned on the cdc.gov website, "BMI does not measure body fat directly, but BMI is moderately correlated with more direct measures of body fat." From the cdc.gov website, the following sentences are mentioned, "to determine if BMI is a health risk, a healthcare provider performs further assessments. Such assessments include skinfold thickness measurements, evaluations of diet, physical activity, and family history."

Now that the BMI was briefly discussed, the waist to hip ratio will be explored next. The following sentences are from healthline.com, "the waist-to-hip ratio (WHR) calculation is one way your doctor can see if excess weight is putting your health at risk. It determines how much fat is stored on your waist, hips, and buttocks." Additionally, the healthline.com website mentions that "unlike your body mass index (BMI), which calculates the ratio of your weight to your height, WHR measures the ratio of your waist circumference to your hip circumference." To follow closely on this line of thought, healthline.com also states that "this is important because not all excess weight is the same when it comes to your health risks." Lastly, healthline.com has "one interesting point to mention, one 2021 study showed that people who carry more of their weight around their midsection (an apple-shaped body) may be at a higher risk of heart disease, type 2 diabetes, and premature death than people who carry more of their weight in their hips and thighs (a pear-shaped body)."

Helpful insights from data informed results:

Special mention: The following quotes are from the webmd.com hyperlink found below:

Waist to Hip Ratio: Why it Matters, How to Measure It, and More (webmd.com)

From the WebMD hyperlink found above, I came across the following health information, ”a ratio higher than 1.0 for either sex means a much higher chance of health problems.”

Males and females have varying waist to hip ratio associated values. More specifically, when it comes to men’s waist to hip ratio, as stated on webmd.com, “WHO defines abdominal obesity in men as a waist-to-hip ratio of at least 0.90.” In comparison, according to WebMD.com, for women, “it’s a ratio of 0.85 or more.”

This waist to hip ratio probability of adversely affecting both males and females was a concerning one to me.

As a solution, I came to realize that an individual can promote health awareness for the quality of life in others such as family and friends. By engaging in positive health-promoting behavior and sharing data-informed results with loved ones, an individual can still maintain a level of data privacy while providing valuable insights into health risk assessment categories that could potentially affect those close to the them.

Special mention: I do acknowledge and respect that levels of data sharing vary on an individual basis.

Website sources and inspiration:

To gain a better understanding of BMI and waist to hip ratio, three websites were used to explore the differences between the two measurements and their significance in assessing overall health.

The three websites that were referenced for this data project are:

  1. https://www.cdc.gov/
  2. https://www.healthline.com/
  3. https://www.webmd.com/

The following web page provided information on BMI:

The following four web pages provided information on the waist to hip ratio:

Inspiration for this Python project:

As a source of inspiration, I found a Youtube video developed by Alex Freberg where he walked through his Python guided project that dealt with creating a BMI calculator.

Data tools used:

By utilizing the Anaconda platform, the Jupyter notebook application was selected to compose Python code.

The Anaconda platform can be viewed via this hyperlink:

Special mention: Anaconda states the following on their documentation webpage, "Anaconda® Distribution is a Python/R data science distribution that contains conda, a package and environment manager, which helps users manage a collection of over 7,500+ open source-source packages available to them."

Overview of Python program structure:

The following 8 steps outline the Python program structure.

1.) Greeting the user at the very start of the text-based Python program.

  • Python code example:
print("Hello. Thank you for your willingness to share your BMI, 'Body mass index', information.")
  • Prompted user to enter their name
  • Prompted user to enter their gender:
    • Ex.) Male or Female

2.) Provided the user with an overview on what to expect from three upcoming information input prompts.

  • Informed the user that each information prompt is a key component in determining the BMI score
    • The user would type in integer values for height and weight input prompts.
      • Two information prompts were focused on height in feet and inches:
        • Ex.) 5 (feet)
        • Ex.) 11 (inches)
      • Third prompt requested information on user's weight in lbs:
        • Ex.) 170 (lbs.)

3.) Variable, BMI, was created to reflect that of the cdc.gov based formula for BMI calculation.

  • Body mass index (BMI) formula:
    • BMI = weight (lb) / [height (in)]2 x 703
  • Python code formula:
BMI = user_weight / total_height_inches**2 * 703
  • Utilized Python's Round function to move the user's BMI calculated result to one decimal place.
    BMI = round(BMI, 1)

Ex.) BMI = 23.7

4.) Calculated BMI value was recorded and placed into a BMI weight status category.

  • BMI category range:
    • Underweight
    • Healthy Weight
    • Overweight
    • Above Obesity
  • User was presented with a sentence that contained the calculated BMI value and weight status category.
    • Ex.) User presented with calculated BMI value and weight status category.
      • Hello John, your BMI results have been calculated. Your BMI of 23.7, indicates that you're at a healthy weight.
    • Python code:
Print("Hello " + name + ", your BMI results have been calculated. Your BMI of " + str(BMI) + ", indicates that you're at a healthy weight.")

5.) After calculating the BMI value, the user has the option to calculate their Waist to Hip ratio

  • Python code below informs the user that the waist to hip ratio is more accurate than BMI calculation.
print(name + ", before you go, there is another calculation that you can participate in if you like.")
print("This other calculation is known as a Waist to Hip ratio.")
print("Studies have shown that it is more accurate than a BMI calculation.")
  • The following Python code below gives a disclaimer to the user that a valid response is strongly recommended to proceed with calculating the waist to hip ratio.
print("A little advice, " + name + ", you have 6 attempts to enter a valid choice such as 'yes' or 'no'.")

print("If you do not provide a valid choice within 6 attempts, your Waist to Hip ratio calculation will not occur.")
  • A While loop statement is created to adhere to the disclaimer statement.
    • User is presented with a choice information prompt to calculate Waist to Hip ratio.
    • Variable, ask_user, requires a yes or no response from the user
      • Python input statement with variable:
ask_user = input("Are you interested in calculating your Waist to Hip ratio today? Please type yes or no: ")
  • User has 6 attempts to type in the correct input: yes or no.
    • If statements are utilized within the While Loop for the following scenarios:
      • User selects yes option
        • User progresses to Step 6 in the program structure
      • User selects no option
        • User chose to close the program
      • User enters an invalid response
        • On the 5th attempt, user is presented with advice to correctly enter in a valid response.
        • If user does not enter a valid response within 6 attempts, they will be notified, and the Python program will not advance to Step 6.

6.) User selected yes as a valid option to calculate waist to hip ratio.

Special mention:

In Step 7, waist to hip ratio information is referenced from this WebMD web page.

https://www.webmd.com/fitness-exercise/what-is-waist-to-hip-ratio

7.) User is presented with various basic knowledge topics that focus on waist to hip ratio:

  • Examples of basic knowledge topics include:

    • Waist to hip ratio vs. BMI measurement differences
    • Which is better for you? Waist to Hip ratio or BMI measurement.
    • Your doctor can measure your waist to hip ratio, or you can find it on your own. Here’s how:
      • Establishing the "three simple steps" method:

        1. Start at the top of your hip bone, then bring the tape measure all the way around your body, level with your belly button.
        2. Make sure it's not too tight and that it's straight, even at the back. Don't hold your breath while measuring.
        3. Check the number on the tape measure right after you exhale.
  • In summary, the Python lines of code below inform the user that the waist to hip ratio will be calculated by using the "three simple steps" method. Afterwards, two information input prompts will be presented to the user before any more basic knowledge topics are revealed.

print(name + ", before the waist to hip ratios for men and women are revealed to you, let's first calculate yours.")

print() # displays empty line for easier user readability

print("Follow the three simple steps for measuring your waist to hip ratio.")

print() # displays empty line for easier user readability

print("After you have completed the three simple steps, please follow the two information prompts displayed for you.")

print("The first information prompt will ask you to provide your recorded waist size.")

print("The second information prompt will ask you to provide your recorded hip size.")
  • Gathering user input from two information prompts for waist to hip ratio calculation.
  • User is prompted to enter integer values into two information prompts: Waist size and hip size.
    • Waist size
      • Python code:
        • user_waist_size = int(input("1.) Please provide your waist size (in inches) as a number. For example, 30 "))
          • Ex.) 30
    • Hip size
      • Python code:
        • user_hip_size = int(input("2.) Please provide your hip size (in inches) as a number. For example, 34 "))
          • Ex.) 34
  • Variable, waist_to_hip_ratio, was created for the waist to hip ratio calculation.
  • Python code:
    • waist_to_hip_ratio = user_waist_size / user_hip_size
      • Utilized Python's Round function to adjust the user's waist to hip ratio calculated result to two decimal places.
        • Python code:
          • waist_to_hip_ratio = round(waist_to_hip_ratio, 2)
            • waist_to_hip_ratio = 30 / 34
              • waist_to_hip_ratio = 0.88

8.) Calculated waist to hip value was placed into a waist to hip health risk category range.

  • Waist to hip ratio health risk category range:
    • low
    • moderate
    • high
  • Since waist to hip ratios differ for men and women, if statements were created for each gender.
Example of a calculated waist to hip ratio with a health risk category for a male:

Hello John, your waist to hip ratio results have been calculated based on male gender data.

Your waist to hip ratio of 0.88, indicates that you're at a low risk.

Example of a calculated waist to hip ratio with a health risk category for a female:

Hello Emma, your waist to hip ratio results have been calculated based on female gender data.

Your waist to hip ratio of 0.78, indicates that you're at a low risk.

Github.com - Source code:

Below is a Github hyperlink that contains the Python source code that was used in this project.

Github.com - Python source code for BMI index and Waist to Hip ratio data project

Conclusion and thankfulness for viewing data project:

Please feel free to reach out to me on LinkedIn if you have any comments or questions.

Lastly, thank you very much for viewing this Python data project.

Discussion and feedback(0 comments)
2000 characters remaining
Cookie SettingsWe use cookies to enhance your experience, analyze site traffic and deliver personalized content. Read our Privacy Policy.