A comprehensive BMI calculator with health interpretations and unit conversions
Project description
🏥 Yoni BMI Calculator
A comprehensive and easy-to-use BMI (Body Mass Index) calculator package that supports both metric and imperial units, provides health interpretations, and offers additional utilities for weight management.
✨ Features
- 🧮 Accurate BMI Calculation: Calculate BMI using metric (kg/m) or imperial (lbs/inches) units
- 📊 Health Interpretations: Get detailed health category analysis with recommendations
- 🎯 Ideal Weight Range: Calculate ideal weight range for any height
- 🔄 Unit Conversions: Convert between different weight and height units
- 💡 Health Advice: Receive personalized health advice based on BMI results
- 🚀 Easy to Use: Simple, intuitive API for developers
- 📱 Lightweight: No external dependencies, pure Python implementation
🚀 Installation
Install the package using pip:
pip install yoni-bmi-calculator
📖 Quick Start
from yoni_bmi_calculator import calculate_bmi, bmi_with_interpretation
# Basic BMI calculation (metric)
bmi = calculate_bmi(weight=70, height=1.75) # 70 kg, 1.75 m
print(f"Your BMI is: {bmi}") # Output: Your BMI is: 22.86
# Complete analysis with interpretation
result = bmi_with_interpretation(weight=70, height=1.75)
print(f"BMI: {result['bmi']}")
print(f"Category: {result['interpretation']['category']}")
print(f"Advice: {result['interpretation']['advice']}")
📚 Detailed Usage Examples
1. Basic BMI Calculation
from yoni_bmi_calculator import calculate_bmi
# Metric system (kg, meters)
bmi_metric = calculate_bmi(weight=70, height=1.75, unit_system="metric")
print(f"BMI (metric): {bmi_metric}")
# Imperial system (pounds, inches)
bmi_imperial = calculate_bmi(weight=154, height=69, unit_system="imperial")
print(f"BMI (imperial): {bmi_imperial}")
2. BMI Interpretation
from yoni_bmi_calculator import interpret_bmi
bmi = 22.86
interpretation = interpret_bmi(bmi)
print(f"Category: {interpretation['category']}")
print(f"Description: {interpretation['description']}")
print(f"Health Advice: {interpretation['advice']}")
print(f"Risk Level: {interpretation['risk']}")
3. Complete BMI Analysis
from yoni_bmi_calculator import bmi_with_interpretation
# Get complete analysis
analysis = bmi_with_interpretation(weight=70, height=1.75, unit_system="metric")
print(f"📊 BMI Analysis Results:")
print(f"BMI Score: {analysis['bmi']}")
print(f"Category: {analysis['interpretation']['category']}")
print(f"Health Status: {analysis['interpretation']['description']}")
print(f"Recommendation: {analysis['interpretation']['advice']}")
# Ideal weight range
ideal = analysis['ideal_weight_range']
print(f"💡 Ideal Weight Range: {ideal['min_weight']}-{ideal['max_weight']} {ideal['unit']}")
4. Ideal Weight Range Calculator
from yoni_bmi_calculator import get_ideal_weight_range
# For someone who is 1.75m tall
ideal_range = get_ideal_weight_range(height=1.75, unit_system="metric")
print(f"Ideal weight range: {ideal_range['min_weight']}-{ideal_range['max_weight']} {ideal_range['unit']}")
# For someone who is 69 inches tall
ideal_range_imperial = get_ideal_weight_range(height=69, unit_system="imperial")
print(f"Ideal weight range: {ideal_range_imperial['min_weight']}-{ideal_range_imperial['max_weight']} {ideal_range_imperial['unit']}")
5. Unit Conversions
from yoni_bmi_calculator import convert_units
# Weight conversions
kg_to_lbs = convert_units(70, "kg", "lbs")
print(f"70 kg = {kg_to_lbs} lbs")
# Height conversions
m_to_inches = convert_units(1.75, "m", "in")
print(f"1.75 m = {m_to_inches} inches")
cm_to_feet = convert_units(175, "cm", "ft")
print(f"175 cm = {cm_to_feet} feet")
🎯 BMI Categories
The calculator uses the standard WHO BMI categories:
| BMI Range | Category | Health Risk |
|---|---|---|
| < 18.5 | Underweight | May indicate malnutrition |
| 18.5 - 24.9 | Normal weight | Lowest risk |
| 25.0 - 29.9 | Overweight | Increased risk |
| ≥ 30.0 | Obese | High risk |
🔧 API Reference
Core Functions
calculate_bmi(weight, height, unit_system="metric")
Calculate BMI from weight and height.
Parameters:
weight(float): Weight in kg (metric) or pounds (imperial)height(float): Height in meters (metric) or inches (imperial)unit_system(str): "metric" or "imperial" (default: "metric")
Returns: BMI value (float)
interpret_bmi(bmi)
Get health interpretation for a BMI value.
Parameters:
bmi(float): BMI value
Returns: Dictionary with category, description, advice, and risk information
bmi_with_interpretation(weight, height, unit_system="metric")
Calculate BMI and return complete analysis.
Parameters:
weight(float): Weight in kg (metric) or pounds (imperial)height(float): Height in meters (metric) or inches (imperial)unit_system(str): "metric" or "imperial" (default: "metric")
Returns: Complete analysis dictionary
get_ideal_weight_range(height, unit_system="metric")
Calculate ideal weight range for given height.
Parameters:
height(float): Height in meters (metric) or inches (imperial)unit_system(str): "metric" or "imperial" (default: "metric")
Returns: Dictionary with min/max ideal weights
convert_units(value, from_unit, to_unit)
Convert between different units.
Supported conversions:
- Weight: kg ↔ lbs
- Height: m ↔ in ↔ cm ↔ ft
🏥 Health Disclaimer
Important: This BMI calculator is for informational purposes only and should not replace professional medical advice. BMI is a screening tool and may not be accurate for:
- Athletes with high muscle mass
- Pregnant women
- Children and adolescents
- Elderly individuals
- People with certain medical conditions
Always consult with healthcare professionals for personalized health assessments.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Yoni - Initial work
🔗 Links
🆕 Version History
- 1.0.0 - Initial release with core BMI calculation and interpretation features
Made with ❤️ for health and fitness enthusiasts!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yoni_bmi_calculator-1.0.0.tar.gz.
File metadata
- Download URL: yoni_bmi_calculator-1.0.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ab72ff2e10fc62f9d8acec6679d167dbeb7b51ea652c96617cec72b19fcf1f7
|
|
| MD5 |
3cc1cf42860b58cae2e8730ddd4ab1bd
|
|
| BLAKE2b-256 |
d7e1ea0a7b97726e0486c3123ebd42a4f51c60ee21329a291057de3cf8f18845
|
File details
Details for the file yoni_bmi_calculator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: yoni_bmi_calculator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc28ec1ff1c31fc11a4cb9248e8d4c432bf4561179bc6296a32051b2997ffdcb
|
|
| MD5 |
35dfd06891f4a2b84c651a2d73a0ab94
|
|
| BLAKE2b-256 |
53202c808ce166efbb34f4c24de3c6c49691ec03e9c8c6cc709c942bbc370c07
|