Empowering Rural Communities Through Culturally Competent Health Tech

Assignment Background

For my Implementing Health Informatics Initiatives for Emerging Leaders course in the Gillings School of Global Public Health at UNC–Chapel Hill, I developed an informatics-based concept proposal for the NSF America’s Seed Fund. My proposal focuses on a mobile application designed to support multiple chronic diseases in rural communities, where health literacy tends to be lower. Below is a subsection of that proposal.

HealthBridge Rural: A Culturally Competent Health Literacy App for Chronic Disease Prevention and Management 

Introduction 

Rural communities face persistent health inequities driven by limited healthcare access, transportation barriers, low health literacy, and high prevalence of preventable chronic diseases such as diabetes, hypertension, COPD, and cardiovascular disease. According to CDC data, adults in rural areas are more likely to die prematurely from five leading causes1 and report lower rates of preventive care and health literacy2. Traditional health apps often fail to reach these communities because they assume consistent access to broadband internet, cultural familiarity with digital tools, and standardized health literacy levels. 

In these areas, cultural norms, economic hardship, and health mistrust create additional barriers. For example, a patient may understand their diagnosis but not how to modify their lifestyle affordably or safely. Information about exercise, nutrition, and stress reduction is often disconnected from local contexts; recipes may not utilize affordable, readily available foods, and exercise recommendations rarely account for environmental or safety constraints. 

HealthBridge Rural aims to close this gap by providing culturally competent, low-cost, and locally contextualized health information to empower residents to take small, achievable steps toward improved health. It combines behavioral science, public health data, and user-centered design to build trust, comprehension, and sustainable engagement across several chronic conditions. 

Application Overview: 

HealthBridge Rural is a mobile and web-based application designed using Dr. Mica Endsley’s Situation Awareness-Oriented Design (SAOD) principles—Perception, Comprehension, and Projection—to support informed, context-driven decision-making3. The app offers a personalized dashboard that integrates educational tools, behavioral nudges, and local resource directories to help users navigate their health more effectively. 

1. Perception  

 The app aggregates publicly available and user-reported data to present relevant, localized health insights: 

  • Maps of affordable grocery stores, farmers’ markets that accept EBT, community gardens, and food giveaway programs. 
  •  Maps of parks, community recreation centers, and walking trails. 
  • Listings of free or low-cost health programs, community clinics, and smoking cessation groups. 
  • Daily check-ins for sleep, stress, diet, and activity. 

2. Comprehension  

 AI translates medical information into culturally relevant, accessible language. 

 Examples: 

  • “Instead of sugary tea, try this $2 pitcher of flavored water using ingredients from Dollar General.” 
  • “Here’s how to manage stress when working long shifts—three exercises that take less than 5 minutes.” 
  • Audio and visual literacy options for users with limited reading skills. 

The AI integrates local cultural insights, such as traditional foods or family-centered values to ensure content resonates with the user’s lived experiences. 

3. Projection – Supporting Informed Action 

 Based on users’ inputs, HealthBridge Rural generates personalized recommendations and reminders: 

  • Predictive prompts (“You’ve been logging low activity—try this free walking club nearby.”) 
  • Behavior simulation (“If you switch one meal per day to a home-cooked option, here’s the 3-month health impact and savings.”) 
  • Smart notifications tailored to disease risk factors (e.g., hypertension management reminders). 

Logic Model (Adaptation of Endsley’s Situational Awareness Model): 

Level Description HealthBridge Rural Application 
Perception Awareness of environment and current state Local maps, cost-aware recipes, nearby resources 
Comprehension Understanding significance of data AI-curated education, culturally adapted health tips 
Projection Anticipating outcomes and next steps Personalized goals, predictive alerts, self-monitoring tools 

1 https://www.cdc.gov/health-equity-chronic-disease/health-equity-rural-communities/index.html 

2  https://www.ruralhealthinfo.org/toolkits/health-literacy/1/barriers 

3 Endsley, M. R., & Jones, D. G. (2024). Situation Awareness Oriented Design: Review and Future Directions. International Journal of Human–Computer Interaction, 40(7), 1487–1504. https://doi.org/10.1080/10447318.2024.2318884 

IT Strategization for Streamlining Lung Cancer Registry Processes In NC

Problem Statement

Lung cancer is one of the most significant chronic disease burdens in North Carolina, both in terms of incidence and mortality. According to CDC data from 2023, the state experienced 34.9 deaths per 100,000 residents from lung cancer and 58.4 new cases per 100,000 residents, both higher than the national averages.(1)These elevated rates place lung cancer among the most pressing cancer-related public health challenges in North Carolina.

Disparities are evident among racial and ethnic minorities across timeliness of diagnosis, treatment access, and five-year survival rates. (2) Risk factors also contribute to North Carolina’s elevated burden; adult smoking prevalence alongside of youth e-cigarette use are both higher than the national average.(3)

These statistics underscore the urgency of strengthening surveillance systems to provide timely, representative data that can inform prevention, screening, and equitable treatment strategies for lung cancer in North Carolina.

Current State of Surveillance

The North Carolina Central Cancer Registry (NCCCR) is the state’s legally mandated system for tracking cancer incidence, treatment, and outcomes. As part of the CDC’s National Program of Cancer Registries (NPCR) and the North American Association of Central Cancer Registries (NAACCR), it provides a comprehensive record of cancer cases across hospitals, clinics, and laboratories. NCCCR data are essential for understanding cancer trends, guiding public health policy, and supporting national cancer control efforts.

Despite its strengths, the NCCCR faces several limitations that reduce its effectiveness in addressing urgent public health concerns, such as lung cancer. Timeliness, integration, and equity monitoring are the main challenges. The registry data is often delayed up to 2 years behind real-world diagnoses, NCCCR is often not linked to behavioral data, and equity-based variables may be incomplete.

For a condition such as lung cancer, these limitations hinder North Carolina’s ability to respond quickly and equitably. Modernizing NCCCR to improve timeliness and representativeness is therefore critical to reducing the state’s disproportionate lung cancer burden.

Modernization Strategy

To address these gaps, North Carolina should modernize its cancer surveillance system by aligning the NCCCR with CSTE Objective 2.1: “Improve traditional surveillance systems to provide timely and representative chronic disease insights.” (4) The goal is to reduce reporting lag, strengthen representativeness, and create actionable insights for prevention and treatment of lung cancer.

A unique opportunity exists through the Cancer Identification and Precision Oncology Center (CIPOC) at UNC-Chapel Hill, which was recently awarded ARPA-H funding to aggregate and analyze cancer data from diverse sources—including electronic health records, pathology and radiology images, claims, and geographic information utilizing large language models.(5) CIPOC is designed to support real-time cancer case identification and equitable care delivery. Integrating NCCCR modernization with CIPOC’s infrastructure would allow the registry to improve timeliness, enhance data linkage, and support equity-focused initiatives

By grounding modernization in CSTE’s national strategy while leveraging CIPOC’s cutting-edge infrastructure, North Carolina can create a best-practice model for other states. This integrated approach would demonstrate how traditional registries and advanced AI-enabled systems can work together to provide high-quality data while leveraging the improved efficiency that AI brings.

Summary

North Carolina faces an urgent burden from lung cancer, with incidence and mortality rates above the national average and significant disparities across racial and geographic groups.

Modernizing the NCCCR to improve timeliness, completeness, and representativeness is critical to addressing this challenge. By aligning with CSTE Objective 2.1 and leveraging the AI-enabled infrastructure of CIPOC, the state can reduce delays in reporting, link surveillance data to risk factors and screening uptake, and generate equity-focused insights for targeted interventions.

This integrated approach demonstrates how traditional registries can evolve into rapid, representative systems and provides a best-practice model that other states and chronic conditions can adopt.

The model has clear implications beyond lung cancer. The same framework can be applied to other cancers, as well as non-cancer conditions like COPD or cardiovascular disease. Importantly, the CIPOC project’s use of retrieval-augmented generation and advanced prompting strategies to extract and synthesize multi-modal data provides an adaptable toolkit for modern surveillance. By applying the most effective AI methods refined within CIPOC, North Carolina can not only strengthen its lung cancer registry but also inform future AI applications in healthcare surveillance more broadly. This positions the state as a leader in operationalizing CSTE’s strategic plan while demonstrating how cutting-edge AI methods can scale across diseases and conditions.

Race, Place, and Quality

A Look at Hypertension Management Among Black Women in North Carolina

This semester, in my Social Epidemiology course, we had to propose a study related to our course content. I chose to explore how race, place, and healthcare quality intersect to shape outcomes for Black women living with hypertension.


Why This Study?

Black women in the U.S. face unique and layered health challenges due to the intersecting effects of racism and sexism. The weathering hypothesis, developed by Geronimus et al., suggests that chronic exposure to social, economic, and racial stressors accelerates health deterioration—particularly among Black women.1,2

Despite advances in treatment, disparities in chronic disease outcomes persist. Black women, especially in rural areas, remain more likely to experience uncontrolled hypertension. This raises critical questions about how structural barriers, such as geographic isolation and limited access to high-quality care, interact with in-clinic factors, such as provider bias.

Layered forms of marginalization interact to shape Black women’s health experiences

My Research Question

Among Black women receiving care at Federally Qualified Health Centers (FQHCs) in North Carolina, how does the impact of geographic proximity on hypertension management differ between urban and rural communities?

My hypothesis: Geographic proximity will have a smaller impact on hypertension management among Black women in rural communities compared to those in urban areas due to compounded marginalization and systemic barriers.


Background Context

  • Rural communities tend to have a higher chronic disease burden.3
  • High-burden ZIP Code Tabulation Areas (ZCTAs) had nearly double the proportion of Black residents compared to low-burden ZCTAs.3
  • On average, people in high-burden areas live 8.7 miles from the nearest FQHC, compared to 4.6 miles in low-burden areas.3
  • Clinical quality gaps persist: Non-Hispanic Black individuals are 12% less likely to have adequately controlled blood pressure, even after adjusting for socioeconomic and healthcare access factors.11,12

A map showing FQHC distribution across North Carolina and a gradient scale representing rurality by RUCA score.


Proposed Study Design

  • Design: Cross-sectional observational study
  • Population: Black women aged 18+ with a diagnosis of hypertension and at least two FQHC visits between Jan 2023 – Dec 2024
  • Data Source: EHR data from FQHCs across North Carolina
  • Exposure: Proximity to FQHC, measured by distance from home ZIP to clinic
  • Comparison Groups: Urban vs. rural residence (based on RUCA score)
  • Outcome: Blood pressure control (e.g., SBP <140 mmHg)
  • Covariates: Socioeconomic status, insurance, comorbidities, clinic characteristics

A directed acyclic graph illustrating the conceptual model of how structural and clinical factors interact to influence hypertension management.


Final Thoughts

Developing this proposal deepened my understanding of how place, identity, and systemic inequity play a role in measurable health outcomes. Mapping these disparities is only the beginning. As researchers, we must also imagine ways to redesign care systems that serve Black women and their intersectional identities more equitably.

References

  1. Geronimus AT, Hicken M, Keene D, Bound J. “Weathering” and age patterns of allostatic load scores among blacks and whites in the United States. Am J Public Health. 2006;96(5):826-833. doi:10.2105/AJPH.2004.060749
  2. Chinn JJ, Martin IK, Redmond N. Health Equity Among Black Women in the United States. J Womens Health (Larchmt). 2021;30(2):212-219. doi:10.1089/jwh.2020.8868
  3. Benavidez GA, Zahnd WE, Hung P, Eberth JM. Chronic Disease Prevalence in the US: Sociodemographic and Geographic Variations by Zip Code Tabulation Area. Prev Chronic Dis 2024;21:230267. DOI: http://dx.doi.org/10.5888/pcd21.230267.
  4. Ndugga N, Hill L, Artiga S. Key data on health and health care by race and ethnicity. KFF. Published June 11, 2024. Accessed November 14, 2024. https://www.kff.org/key-data-on-health-and-health-care-by-race-and-ethnicity/?entry=health-status-and-outcomes-chronic-disease-and-cancer
  5. Agency for Healthcare Research and Quality. 2023 National Healthcare Quality and Disparities Report Appendixes. AHRQ Pub. No. 23(24)-0091-EF. December 2023.
  6. Ochieng N, Biniek JF, Cubanski J, Neuman T. Disparities in health measures by race and ethnicity among beneficiaries in Medicare Advantage: A review of the literature. KFF. Published December 13, 2023. Accessed October 15, 2024. https://www.kff.org/medicare/report/disparities-in-health-measures-by-race-and-ethnicity-among-beneficiaries-in-medicare-advantage-a-review-of-the-literature/
  7. Jha AK, Zaslavsky AM, Orav EJ, Epstein AM, Ayanian JZ. Quality of ambulatory care for privately insured and Medicare Advantage enrollees in the United States. Health Aff (Millwood).
  8. Tong M, Hill L, Artiga S. Racial disparities in cancer outcomes, screening, and treatment. KFF. Published February 3, 2022. Accessed November 14, 2024. https://www.kff.org/racial-equity-and-health-policy/issue-brief/racial-disparities-in-cancer-outcomes-screening-and-treatment/
  9. Alsheik N, Blount L, Qiong Q, et al. Outcomes by race in breast cancer screening with digital breast tomosynthesis versus digital mammography. J Am Coll Radiol. 2021;18(7):906-918. doi:10.1016/j.jacr.2020.12.033
  10. Miller-Kleinhenz JM, Collin LJ, Seidel R, Oyesanmi O. Racial disparities in diagnostic delay among women with breast cancer. J Am Coll Radiol. 2021;18(10):1384-1393. doi:10.1016/j.jacr.2021.06.019
  11. Abrahamowicz AA, Ebinger J, Whelton SP, Commodore-Mensah Y, Yang E. Racial and Ethnic Disparities in Hypertension: Barriers and Opportunities to Improve Blood Pressure Control. Curr Cardiol Rep. 2023;25(1):17-27. doi:10.1007/s11886-022-01826-x
  12. Crim MT, Yoon SS, Ortiz E, et al. National surveillance definitions for hypertension prevalence and control among adults. Circ Cardiovasc Qual Outcomes. 2012;5(3):343-351. doi:10.1161/CIRCOUTCOMES.111.963439

Using Machine Learning to Understand Treatment Delays in Breast Cancer Care

Introduction

Cancer treatment delays and modifications can significantly impact patient survival and quality of life. Research has consistently shown that marginalized populations, including Black, Hispanic, Asian, and American Indian/Alaska Native (AIAN) patients, experience higher rates of late-stage cancer diagnoses and lower rates of timely treatment.

For my project, I used machine learning models to examine how race, socioeconomic status, tumor characteristics, cancer stage, grade, subtype, age, clinical trial participation, and time to treatment initiation predict treatment interruptions in breast cancer patients.

This project highlights both the potential and limitations of using machine learning for predicting healthcare disparities in cancer treatment.


Dataset:

This project utilized Simulacrum v2.1.0, a synthetic dataset derived from the National Disease Registration Service (NDRS) Cancer Analysis System at NHS England. While this dataset mimics real-world cancer data, it ensures patient anonymity.

After data cleaning and removing incomplete observations, the dataset contained 69,367 patients, all diagnosed with breast cancer.

Demographics Overview

  • Gender Distribution:
    • Women: 98.7%
    • Men: 1.3% (Male breast cancer cases were retained for analysis.)
  • Age Distribution:
    • Mean Age: 61.06 years
    • Median Age: 61 years
  • Racial Distribution:
    • White: 85.9%
    • Asian: 3.7%
    • Black: 1.9%
    • Other: 1.7%
    • Mixed Race: 0.6%
    • Unknown: 6.1% (Reweighting was applied to mitigate algorithmic bias.)

  • Neighborhood Deprivation (Socioeconomic Status):
    • Scored from 1 (most deprived) to 5 (least deprived).
    • The dataset was fairly balanced across deprivation levels.

Average Time to Treatment Initiation (by Race)

  • Overall: 61 days
  • Other Racial Groups: 71 days
  • Black Patients: 63 days
  • White Patients: 62 days
  • Asian Patients: 54 days
  • Mixed Race Patients: 45 days
  • Unknown Race: 57 days

Clinical Trial Participation

  • 84.4% of patients were enrolled in a clinical trial.

Data Processing & Feature Engineering

1. Cleaning & Standardizing Data

  • Removed inconsistent staging classifications.
  • Imputed missing values for key variables such as comorbidity scores and time to treatment initiation.

2. Encoding Variables

  • One-Hot Encoding:
    • Race, tumor subtype, estrogen receptor (ER), progesterone receptor (PR), and HER2 status.
  • Ordinal Encoding:
    • Tumor stage, node stage, metastasis stage, overall stage, grade, and deprivation index.

3. Feature Engineering

  • Created a new feature,ANY_REGIMEN_MOD
    • Combined dose reduction, time delay, and early termination variables into one binary target variable.
  • Grouped tumor biomarkers into cancer subtypes:
    • Luminal A: ER+, PR+, HER2- (Least aggressive)
    • Luminal B: ER+, PR+, HER2+ (Slightly more aggressive)
    • HER2-Enriched: ER-, PR-, HER2+
    • Triple Negative (Basal-like): ER-, PR-, HER2- (Most aggressive)

Bias Mitigation Strategies

1. Gender Bias

  • While 98% of patients were female, male breast cancer cases were retained for rare case analysis.
  • Applied weighting techniques to balance gender representation during model training.

2. Racial Bias

  • Since 85% of patients in the dataset were White, inverse weighting was applied to ensure fair contributions across racial groups.

Machine Learning Models & Performance

I trained Random Forest and XGBoost models to predict treatment modifications.

1. Initial Model Performance (Random Forest & XGBoost)

Results were poor. The models performed only slightly better than random guessing.

2. Hyperparameter Tuning & Feature Selection

  • Used GridSearchCV to optimize parameters.
  • Dropped the least important features and retrained the models.
  • Results did not improve, and performance worsened in some cases.

3. Model Performance Issues

  • Models failed to generalize to testing data.
  • ROC AUC scores hovered around 0.5, meaning models were barely better than random guessing.
  • Models overfitted the ‘no treatment modification’ group, inaccurately predicting treatment delays.

4. Alternative Models Attempted

To address these issues, I tested additional models:

  • Support Vector Machines (SVM)
  • Neural Networks
  • Logistic Regression
  • K-Nearest Neighbors (KNN)
  • Naïve Bayes

Findings from Alternative Models:

  • SVM and Logistic Regression performed best (Accuracy: 0.65), but logistic regression completely failed at predicting treatment modifications.
  • Neural Networks, KNN, and Naïve Bayes were slightly better balanced but still had low accuracy (~0.60–0.62).

5. Last Attempt – Oversampling with SMOTE

  • Used Synthetic Minority Oversampling (SMOTE) to balance the dataset.
  • SVM improved slightly, but performance gains were minimal.

Uncovering Insights Through Clustering

Since predictive modeling was unsuccessful, I conducted clustering analysis to find patterns in the data.

Three Distinct Patient Clusters Emerged:

Cluster 0: Moderate-Stage Cancer (35.4% Treatment Modifications)

  • Average Age: 60.8
  • Tumor Stage: T2, N0.7, M0.03 (Localized)
  • Time to Treatment: 32.6 days

Cluster 1: Early-Stage Cancer with Delayed Treatment (36.7% Treatment Modifications)

  • Average Age: 61.0
  • Tumor Stage: T1, N0.03, M0.0 (Localized, very early-stage)
  • Time to Treatment: 46.8 days (longest)

Cluster 2: Older Patients with Shortest Time to Treatment (36.8% Treatment Modifications)

  • Average Age: 69.4 years
  • Higher Comorbidities (Charlson Score = 0.63)
  • Time to Treatment: 14.8 days (shortest)

Key Takeaways from Clustering:

  • Cluster 1 had the longest time to treatment despite being early-stage. Further investigation needed.
  • Older patients (Cluster 2) received faster treatment but had more comorbidities.

Conclusion & Next Steps

Machine learning models failed to predict treatment modifications accurately.
Clustering analysis revealed patterns in treatment delays and patient subgroups.

Future Steps:

  1. Explore more sophisticated models (Deep Learning, Bayesian Networks).
  2. Use real-world data instead of synthetic datasets.
  3. Investigate non-quantifiable factors, like patient-provider interactions and healthcare policies.

Final Thoughts

This project highlighted the complexity of predicting cancer treatment interruptions and the importance of interdisciplinary approaches in health equity research.

If you’re interested in machine learning for healthcare, data-driven health equity research, or predictive modeling, let’s connect!

Addressing Healthcare Disparities in North Carolina

Through my Healthcare Data Visualization course I, alongside two other classmates, were tasked with creating a dashboard using a data set and platform of our choice. Using data from the 2018 Health Professional Shortage Area (HPSA) dataset provided by the U.S. Department of Health & Human Services, our analysis reveals critical insights into the challenges and opportunities for improving healthcare access statewide.

Key Findings from the Analysis

  1. Healthcare Shortages Are Severe in Underserved Areas
    The average provider-to-population ratio in HPSA-designated areas is 2.11 clinicians per 10,000 residents, significantly below the recommended 6.67 clinicians. This stark disparity highlights the strain on underserved communities, especially in rural regions.
  2. Poverty Rates Compound Access Issues
    North Carolina’s poverty rate—measured as residents below 200% of the federal poverty line—is 27%, slightly above the national average of 26.9%. This economic disadvantage exacerbates barriers to healthcare, disproportionately affecting rural counties.
  3. Medically Underserved Areas (MUAs) Require Immediate Attention
    MUA scores, which account for clinician ratios, infant mortality, poverty levels, and the percentage of elderly populations, show an alarming average of 51.76 across NC—well below the national threshold of 62. Henderson and Transylvania counties, with MUA scores of 0, represent the most critically underserved areas in the state.
  4. Rural Hospitals Closures and Policy Impacts
    Historical trends show peaks in shortages in 2002 and 2015-2018, correlating with changes in HPSA methodology and rural hospital closures. These events further stress the importance of sustained policy interventions.
  5. Prioritization of Resources by HPSA Scores
    The HPSA scoring system, used by the National Health Service Corps (NHSC), prioritizes counties for clinician assignments. Mecklenburg County has the highest HPSA score due to its large population, indicating where current resources are concentrated. However, smaller rural counties with lower scores risk being overlooked despite their critical needs.

Access to quality healthcare is a fundamental need, yet many counties across North Carolina face significant shortages in healthcare providers, particularly in rural and economically disadvantaged areas. Our findings underscore the urgent need for targeted interventions. Allocating resources to counties with the highest ratios of underserved populations, addressing the economic and geographic barriers to care, and replicating successful policies in declining shortage areas can help mitigate these disparities. For policymakers, healthcare providers, and community leaders, this analysis serves as a roadmap for reducing inequities and ensuring better access to healthcare for all North Carolinians.

Sources:

https://data.hrsa.gov/tools/shortage-area/hpsa-find

https://www.bls.gov/opub/reports/working-poor/2020/#:~:text=In%202020%2C%2037.2%20million%20people%2C%20or%2011.4,notes%20section%20for%20examples%20of%20poverty%20levels.)

https://healthycommunitiesnc.org/

ciceroinstitute.org/research/north-carolina-physician-shortage-facts/

Health Insights: A Python Project for Patient Data Analysis

Over the past week, I’ve been working on a healthcare-related programming project to challenge myself. It’s been a departure from my usual work with data sets, but it has pushed me to think more abstractly. I’m proud of the outcome! Below, you’ll find the video walkthrough and the code for reference.

Video Walkthrough
Visualization Output
Here is the reference code
def calculate_avg(patients):
total_age = sum(patient[1] for patient in patients)
total_patients = len(patients)
return total_age / total_patients if total_patients > 0 else 0

def categorize_bp(patient):
systolic, diastolic = patient[3], patient[4]
if systolic >= 130 or 80 <= diastolic >= 89:
return "High Blood Pressure", 1
elif 120 <= systolic < 130 and diastolic < 80:
return "Elevated Blood Pressure", 0.5
elif systolic < 120 and diastolic < 80:
return "Healthy Blood Pressure", 0
return "Uncategorized BP", 0

def categorize_hr(patient):
hr = patient[2]
if hr > 100:
return "High HR", 1
elif hr < 60:
return "Low HR", 0.5
else:
return "Normal HR", 0

def obesity_cat(patient):
return "Is Obese" if patient[6] else "Is Not Obese"

def diabetes_cat(patient):
return "Has Diabetes" if patient[5] else "Does Not Have Diabetes"

def calculate_health_points(patient):
bp_category, bp_points = categorize_bp(patient)
hr_category, hr_points = categorize_hr(patient)
obesity_points = 1 if patient[6] else 0
diabetes_points = 1 if patient[5] else 0
total_points = bp_points + hr_points + obesity_points + diabetes_points
return total_points

def categorize_risk(patient):
total_points = calculate_health_points(patient)
if total_points < 1:
return "Healthy"
elif 1 <= total_points < 1.5:
return "Mild Risk"
elif 1.5 <= total_points < 3:
return "Medium Risk"
else:
return "High Risk"

def risk_visualization(patients):
risk_categories = [categorize_risk(patient) for patient in patients]
return risk_categories

def count_risk(patients, risk_level="High Risk"):
return sum(1 for patient in patients if categorize_risk(patient) == risk_level)

def main(patient_data):
while True:
print('\nMenu')
print('1: Calculate Patients Average Age')
print('2: Print Summary of All Patients')
print('3: Print the Number of Obese Patients')
print('4: Print the Number of Diabetic Patients')
print('5: Print the Number of High Risk Patients')
print('6: Visualize the Distribution of Patient Risk')
print('7: Exit')

choice = int(input("Select an option: "))

if choice == 1:
print(f'The average age of patients in the system is {calculate_avg(patient_data)}')

elif choice == 2:
for patient in patient_data:
bp_category, _ = categorize_bp(patient)
hr_category, _ = categorize_hr(patient)
obesity_category = obesity_cat(patient)
diabetes_category = diabetes_cat(patient)
risk_category = categorize_risk(patient)
print(f"\nPatient: {patient[0]}")
print(f"Age: {patient[1]}")
print(f"Blood Pressure: {bp_category}")
print(f"Heart Rate: {hr_category}")
print(f"Obesity: {obesity_category}")
print(f"Diabetes: {diabetes_category}")
print(f"Overall Risk: {risk_category}")

elif choice == 3:
print(f'There are {sum(1 for patient in patient_data if patient[6])} obese patients')
elif choice == 4:
print(f'There are {sum(1 for patient in patient_data if patient[5])} diabetic patients')
elif choice == 5:
print(f'There are {count_risk(patient_data)} high risk patients')
elif choice == 6:
import matplotlib.pyplot as plt
from collections import Counter

counts = Counter(risk_visualization(patient_data))

health_categories = list(counts.keys())
values = list(counts.values())

plt.bar(health_categories, values, color='blue', alpha=0.7)
plt.xlabel('Categories')
plt.ylabel('Counts')
plt.title('Health Risk Distribution')
plt.show()
elif choice == 7:
print('Thank you!')
break
else:
print("Invalid option please try again")

if __name__ == "__main__":
patient_data = []
num_patients = int(input('How many patients do you have today? '))
for i in range(num_patients):
print(f"Patient Number: {1 + i}")
patient_name = input("Patient Name: ")
patient_age = int(input('Patient Age: '))
patient_hr = int(input("Heart Rate (bpm): "))
patient_systolic = int(input("Systolic BP (mmhg): "))
patient_diastolic = int(input("Diastolic BP (mmhg): "))
patient_diabetes = bool(int(input("Diabetes Status (0= No, 1= Yes): ")))
patient_obese = bool(int(input('Obesity Status (0= No, 1= Yes): ')))
patient_data.append([patient_name, patient_age, patient_hr, patient_systolic, patient_diastolic, patient_diabetes, patient_obese])
main(patient_data)