File size: 6,466 Bytes
477d5dc 550379c 477d5dc 550379c 477d5dc 09ba3a2 477d5dc 99af054 477d5dc 550379c 477d5dc 550379c 477d5dc 550379c 477d5dc 99af054 477d5dc 550379c 477d5dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from PIL import Image
st.set_page_config(
page_title = 'Homepage'
)
def run():
#membuat judul
st.title('Maternal Health')
#tambahkan gambar
image_homepage = Image.open('image.jpg')
st.image(image_homepage, caption = 'Pregnant Woman')
#bikin garis pemisah
st.markdown('---')
st.write("Maternal health is a crucial aspect of public health as it directly affects the wellbeing of both mother and child. Despite advances in medical science, maternal mortality remains a significant problem in many countries, particularly in developing nations.")
st.write("Identifying high-risk pregnancies is a critical step in ensuring maternal and fetal health, but it can be a challenging task due to the complexity and variability of the factors involved. Maternal health risk during pregnancy refers to the likelihood of a woman experiencing adverse health outcomes during pregnancy or childbirth")
st.write("The maternal health risk dataset utilized in this study was acquired from kaggle (https://www.kaggle.com/datasets/csafrit2/maternal-health-risk-data). The data was originally collected from different hospitals, community clinics and maternal health care centers from the rural areas of Bangladesh. The dataset contained six predictive variables in pregnancy; Age (in years), Systolic Blood Pressure (in mmHg), Diastolic Blood Pressure (in mmHg), Blood Sugar (in mmol/L), Body Temperature (in degrees Fahrenheit) and Heart Rate (in beats per minute). All of which were numerical variables. A categorical target variable, Risk Level, was present in three possible classes; high risk, mid risk and low risk. These consequently totaled 7 variables in the whole dataset. There were 1,014 instances in the dataset and 406 samples")
st.markdown('---')
df = pd.read_csv('data.csv')
column_name = {'Age': 'Age',
'SystolicBP': 'Systolic Blood Preasure',
'DiastolicBP': 'Diastolic Blood Preasure',
'BS': 'Blood Sugar',
'BodyTemp': 'Body Temprature',
'HeartRate' : 'Heart Rate'}
st.write('## Health Factors')
option = st.selectbox('Select Column: ', list(column_name.values()))
selected_column = [key for key, value in column_name.items() if value == option][0]
value_counts = df[selected_column].value_counts()
fig = plt.figure(figsize=(15,5))
sns.barplot(x=value_counts.index, y=value_counts.values)
plt.xlabel(option)
plt.ylabel('Frequency')
st.pyplot(fig)
st.markdown('---')
st.write('## Visualization of Health Factors on the Level of Pregnancy Risk')
st.write('### Age Factors on the Level of Pregnancy Risk')
plot_age = Image.open('age.jpg')
st.image(plot_age)
st.write("Probability of pregnancy risk based on age:")
st.markdown("- The probability of women having a low and medium risk of pregnancy is when they are 20 years old with a higher probability of experiencing a low risk of pregnancy at that age.")
st.markdown("- The probability that women have a high risk of pregnancy is when they are over 37 years old.")
st.text(" ")
st.text(" ")
st.write('### Systolic pressure Factors on the Level of Pregnancy Risk')
plot_sys = Image.open('sys.jpg')
st.image(plot_sys)
st.write("Probability of pregnancy risk based on Systolic pressure:")
st.markdown("- The probability that a woman has a low and medium risk of pregnancy is when the systolic pressure is 120.")
st.markdown("- The probability that a woman has a high risk of pregnancy is when the systolic pressure is more than 135 with the highest probability at a systolic pressure of 142.")
st.text(" ")
st.text(" ")
st.write('### Diastolic pressure Factors on the Level of Pregnancy Risk')
plot_dys = Image.open('dys.jpg')
st.image(plot_dys)
st.write("Probability of pregnancy risk based on Diastolic pressure:")
st.markdown("- The probability that a woman has a low and medium risk of pregnancy is when the diastolic pressure is 80.")
st.markdown("- The probability that a woman has a high risk of pregnancy is when the diastolic pressure is 88 with the highest probability at a diastolic pressure of 100.")
st.text(" ")
st.write('### Blood Sugar Factors on the Level of Pregnancy Risk')
plot_bs = Image.open('bs.jpg')
st.image(plot_bs)
st.write("Probability of pregnancy risk based on blood sugar levels:")
st.markdown("- The probability that a woman has a low and medium risk of pregnancy is when the blood sugar level is 7.")
st.markdown("- The probability that a woman has a high risk of pregnancy is when the blood sugar level is more than 9.")
st.text(" ")
st.text(" ")
st.write('### Heart Rate Factors on the Level of Pregnancy Risk')
plot_heartrate = Image.open('heartrate.jpg')
st.image(plot_heartrate)
st.write("Probability of pregnancy risk based on heart rate:")
st.markdown("- The probability that a woman has a low and medium risk of pregnancy is when her heart rate is 70-80.")
st.markdown("- The probability that a woman has a high risk of pregnancy is when the blood sugar level is more than 81 with the highest probability at 90.")
st.text(" ")
st.text(" ")
st.write('### Body temperature Factors on the Level of Pregnancy Risk')
plot_temp = Image.open('temp.jpg')
st.image(plot_temp)
st.write("Body temperature does not have a significant effect on the risk of pregnancy")
st.text(" ")
st.markdown('---')
st.write('## Conclusions and Recommendations')
st.write('Age, systolic and diastolic blood pressure, blood glucose levels, and heart rate are factors that significantly influence the risk during pregnancy. The higher these factors, the greater the probability that women are at a high risk during pregnancy. Meanwhile, body temperature does not affect the risk of pregnancy.')
st.write("Before planning to have a child, it is advisable to align with the mother's age. The optimal reproductive age is between 20-35 years. Regular health examinations and monitoring before pregnancy are also crucial for detecting potential issues. Maintaining a balanced diet and monitoring blood glucose, blood pressure, and heart rate are mandatory during pregnancy.")
if __name__ == '__main__':
run() |