Skip to content

Commit

Permalink
Update README.md inclucde unit converter and bmr
Browse files Browse the repository at this point in the history
  • Loading branch information
halaarar authored Jan 11, 2025
1 parent 9799543 commit 32be89e
Showing 1 changed file with 62 additions and 6 deletions.
68 changes: 62 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ get_bmi

Inputs: Weight and height.

get_bmr
bmr

Description: Computes Basal Metabolic Rate (BMR) using the Harris-Benedict equation.

Inputs: Weight, height, age, and sex.

convert_units
unit_convert

Description: convert between various health-related units such as weight (kg to lbs), temperature (Celsius to Fahrenheit), and length (cm to inches). This function simplifies converting clinical data for international research or patient records.
Inputs: numeric value to be converted, unit of input value, the desired unit


## Python Ecosystem Fit

The healthsciencecalculator.py package fits well within the broader Python ecosystem, complementing existing data science and health analysis libraries. There are several Python packages with similar functionalities, such as:

[`health-indicator](https://pypi.org/project/health-indicator/)
This package collects health indices like BMI and health indicators like birth rate
[health-indicator](https://pypi.org/project/health-indicator/)

This package collects health indices like BMI and health indicators like birth rate

[`health-records 0.0.7`]https://pypi.org/project/health-records/)
This package maintains personal health records in a text file that can be privately stored in your computer.
[health-records 0.0.7](https://pypi.org/project/health-records/)

This package maintains personal health records in a text file that can be privately stored in your computer.

The healthsciencecalculator.py package is unique in that it performs health-related calculations with high accuracy and precision, tailored specifically for healthcare professionals and data analysts.

Expand Down Expand Up @@ -85,6 +88,59 @@ tdee = get_tdee(bmr, activity_level)
# Display TDEE
print(f"TDEE: {tdee:.2f} kcal/day")
```
The **unit_convert** function converts a value from one unit to another. It supports various units for weight, length, temperature, concentration, and volume.

```
from healthsciencecalculator.healthsciencecalculator import unit_convert
# Example usage
# Convert 1 meter to centimeters
value_in_meters = 1.0
converted_value = unit_convert(value_in_meters, "m", "cm")
print(f"1 meter is {converted_value} centimeters.")
# Convert 70 kilograms to pounds
value_in_kg = 70.0
converted_value = unit_convert(value_in_kg, "kg", "lb")
print(f"70 kilograms is {converted_value:.2f} pounds.")
# Convert 100 degrees Celsius to Fahrenheit
value_in_celsius = 100.0
converted_value = unit_convert(value_in_celsius, "C", "F")
print(f"100 degrees Celsius is {converted_value:.2f} degrees Fahrenheit.")
# Convert 5 liters to milliliters
value_in_liters = 5.0
converted_value = unit_convert(value_in_liters, "L", "mL")
print(f"5 liters is {converted_value:.0f} milliliters.")
```

The **bmr** function calculates the Basal Metabolic Rate (BMR) using the Harris-Benedict equation. BMR represents the number of calories required for basic life-sustaining functions.

```
from healthsciencecalculator.healthsciencecalculator import bmr
# Example usage
# Calculate BMR for a male
weight_male = 70.0 # Weight in kilograms
height_male = 175.0 # Height in centimeters
age_male = 25 # Age in years
sex_male = "male"
bmr_value_male = bmr(weight_male, height_male, age_male, sex_male)
print(f"BMR for a 25-year-old male (70 kg, 175 cm): {bmr_value_male:.2f} calories/day")
# Calculate BMR for a female
weight_female = 60.0 # Weight in kilograms
height_female = 165.0 # Height in centimeters
age_female = 30 # Age in years
sex_female = "female"
bmr_value_female = bmr(weight_female, height_female, age_female, sex_female)
print(f"BMR for a 30-year-old female (60 kg, 165 cm): {bmr_value_female:.2f} calories/day")
```

## Contributing
Expand Down

0 comments on commit 32be89e

Please sign in to comment.