The aim of this assignment is to turn patient blood-pressure data into clear, personalized health messages that feel friendly, supportive, and easy to understand. By categorizing hypertension and checking the severity, advice can be tailored to each patient. They each would receive guidance that truly speaks to their needs and encourages them to take the right steps for better health.
Pre-eclampsia is a pregnancy condition after 20 weeks where blood pressure is too high and protein leaks into urine. It can harm the kidneys, liver, brain and affect the baby’s growth. It becomes a medical emergency if BP >= 140/90 with protein in urine.
The exact cause of pre-eclampsia is unknown. Some researchers believe it may be due to a problem with blood supply to the placenta. Stress isn’t the cause, but managing it helps.
Go and see your doctor. Regular checkups can save your life.
The data frame used here was provided by Dr. Olusola of BTICL
bp <- tibble::tribble(
~Name, ~Age, ~Systolic, ~Diastolic, ~Protein_in_urine,
"Alice", 25, 126, 76, "NO",
"Selina", 30, 167, 110, "YES",
"Rose", 35, 170, 120, "YES",
"Hibiscus", 45, 230, 91, "YES",
"Sunflower", 19, 102, 76, "NO",
"Tolu", 22, 134, 69, "NO",
"Mary", 45, 155, 102, "YES",
"Lola", 34, 254, 189, "YES",
"Sandra", 23, 112, 64, "NO",
"Margaret", 26, 130, 78, "NO",
"Celine", 33, 144, 89, "YES",
"Colen", 32, 150, 103, "YES"
)
This block categorizes Hypertension into stages
bp$Hypertension_Stage <- ifelse(bp$Systolic < 120 & bp$Diastolic < 80, "Normal",
ifelse(bp$Systolic >= 120 & bp$Systolic <= 129 & bp$Diastolic < 80, "Elevated",
ifelse(bp$Systolic >= 130 & bp$Systolic <= 139 | (bp$Diastolic <= 89),
"Stage 1 Hypertension", "Stage 2 Hypertension")))
print(bp[, c("Name", "Systolic", "Diastolic", "Hypertension_Stage")])
## # A tibble: 12 × 4
## Name Systolic Diastolic Hypertension_Stage
## <chr> <dbl> <dbl> <chr>
## 1 Alice 126 76 Elevated
## 2 Selina 167 110 Stage 2 Hypertension
## 3 Rose 170 120 Stage 2 Hypertension
## 4 Hibiscus 230 91 Stage 2 Hypertension
## 5 Sunflower 102 76 Normal
## 6 Tolu 134 69 Stage 1 Hypertension
## 7 Mary 155 102 Stage 2 Hypertension
## 8 Lola 254 189 Stage 2 Hypertension
## 9 Sandra 112 64 Normal
## 10 Margaret 130 78 Stage 1 Hypertension
## 11 Celine 144 89 Stage 1 Hypertension
## 12 Colen 150 103 Stage 2 Hypertension
bp$Hypertensive_Crisis <- ifelse( bp$Systolic >= 180| bp$Diastolic >= 120, "YES", "NO")
print(bp[, c("Name", "Systolic", "Diastolic", "Hypertensive_Crisis")])
## # A tibble: 12 × 4
## Name Systolic Diastolic Hypertensive_Crisis
## <chr> <dbl> <dbl> <chr>
## 1 Alice 126 76 NO
## 2 Selina 167 110 NO
## 3 Rose 170 120 YES
## 4 Hibiscus 230 91 YES
## 5 Sunflower 102 76 NO
## 6 Tolu 134 69 NO
## 7 Mary 155 102 NO
## 8 Lola 254 189 YES
## 9 Sandra 112 64 NO
## 10 Margaret 130 78 NO
## 11 Celine 144 89 NO
## 12 Colen 150 103 NO
for (i in 1:nrow(bp)) {
if (bp$Systolic[i] >= 140 | bp$Diastolic[i] >= 90) {
print(paste(bp$Name[i],
"has high blood pressure. Please consult a doctor!"))
} else if (bp$Systolic[i] >= 120) {
print(paste(bp$Name[i],
"has elevated blood pressure. Monitor closely and adopt a healthy lifestyle."))
} else {
print(paste(bp$Name[i],
"has normal blood pressure. Keep up the good habits!"))
}
}
## [1] "Alice has elevated blood pressure. Monitor closely and adopt a healthy lifestyle."
## [1] "Selina has high blood pressure. Please consult a doctor!"
## [1] "Rose has high blood pressure. Please consult a doctor!"
## [1] "Hibiscus has high blood pressure. Please consult a doctor!"
## [1] "Sunflower has normal blood pressure. Keep up the good habits!"
## [1] "Tolu has elevated blood pressure. Monitor closely and adopt a healthy lifestyle."
## [1] "Mary has high blood pressure. Please consult a doctor!"
## [1] "Lola has high blood pressure. Please consult a doctor!"
## [1] "Sandra has normal blood pressure. Keep up the good habits!"
## [1] "Margaret has elevated blood pressure. Monitor closely and adopt a healthy lifestyle."
## [1] "Celine has high blood pressure. Please consult a doctor!"
## [1] "Colen has high blood pressure. Please consult a doctor!"
This project demonstrates the power of R Markdown in generating personalized healthcare messages that are both clear and actionable. By tailoring feedback to each patient’s blood pressure status, the report highlights how data-driven insights can support healthier lifestyles, encourage timely medical consultations, and reinforce positive habits. Beyond enhancing readability and professionalism, this approach shows how simple automation can improve communication in healthcare, making information more accessible and impactful.