Spaces:
Running
Running
Commit
·
ba4003c
1
Parent(s):
8744159
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def calculate_bmi(weight, height):
|
| 4 |
+
return weight / ((height / 100) ** 2)
|
| 5 |
+
|
| 6 |
+
def determine_weight_status(bmi):
|
| 7 |
+
if bmi < 18.5:
|
| 8 |
+
return 'Underweight'
|
| 9 |
+
elif 18.5 <= bmi < 25:
|
| 10 |
+
return 'Normal'
|
| 11 |
+
elif 25 <= bmi < 30:
|
| 12 |
+
return 'Overweight'
|
| 13 |
+
else:
|
| 14 |
+
return 'Obese'
|
| 15 |
+
|
| 16 |
+
def determine_height_status(height, age_months):
|
| 17 |
+
# You'd typically use growth charts or specific data for this calculation
|
| 18 |
+
# Here's a placeholder example
|
| 19 |
+
if age_months < 60:
|
| 20 |
+
if height < 110:
|
| 21 |
+
return 'Stunted (Low Height-for-Age)'
|
| 22 |
+
elif 110 <= height <= 150:
|
| 23 |
+
return 'Normal Height'
|
| 24 |
+
else:
|
| 25 |
+
return 'Tall for Age'
|
| 26 |
+
else:
|
| 27 |
+
return 'Height Status Not Applicable'
|
| 28 |
+
|
| 29 |
+
def poshan_tracker_calculator(gender, age_months, weight, height):
|
| 30 |
+
bmi = calculate_bmi(weight, height)
|
| 31 |
+
weight_status = determine_weight_status(bmi)
|
| 32 |
+
height_status = determine_height_status(height, age_months)
|
| 33 |
+
|
| 34 |
+
st.write(f"Child Gender: {gender.capitalize()}")
|
| 35 |
+
st.write(f"Child Age: {age_months} Months")
|
| 36 |
+
st.write(f"Child Weight: {weight:.2f} kg")
|
| 37 |
+
st.write(f"Child Height: {height:.2f} cm")
|
| 38 |
+
st.write(f"Child BMI: {bmi:.2f}")
|
| 39 |
+
st.write(f"Weight Status: {weight_status}")
|
| 40 |
+
st.write(f"Height Status: {height_status}")
|
| 41 |
+
st.write("Recommended Height Range: 110 - 150 cm") # Placeholder range
|
| 42 |
+
st.write("Growth Status: Abnormal Growth") # Placeholder status
|
| 43 |
+
st.write("Disclaimer: Don't Rely on the calculator, Consult With Medical Professional")
|
| 44 |
+
|
| 45 |
+
# Streamlit UI
|
| 46 |
+
st.title('Poshan Tracker Calculator')
|
| 47 |
+
|
| 48 |
+
gender = st.radio('Select Child Gender:', ('Male', 'Female'))
|
| 49 |
+
age_months = st.number_input('Enter Child Age in Months:', min_value=0, max_value=300, value=24)
|
| 50 |
+
weight = st.number_input('Enter Child Weight in kg:', min_value=0.1, max_value=200.0, value=10.0)
|
| 51 |
+
height = st.number_input('Enter Child Height in cm:', min_value=30, max_value=200, value=100)
|
| 52 |
+
|
| 53 |
+
if st.button('Calculate'):
|
| 54 |
+
poshan_tracker_calculator(gender, age_months, weight, height)
|