How uday2kranth/health-care-ml-final-project works
Project Type and Purpose
• Type: Full-stack single-service web application combining ML model development and real-time serving.
• Purpose:
– Expose these models in an interactive Streamlit dashboard for end users.
File Structure
Top level:
• Healthcare_ML_Models_Annotated_and_Visualized.ipynb – EDA + Model development
• healthcare_app.py – Streamlit app (data loading, model training/caching, UI, prediction)
• requirements.txt – Python dependencies
• resources/ – Static assets (images for UI)
• README.md, LICENSE, .gitignore
No separate “frontend”/“backend” folders; the Streamlit script unifies UI, data-prep, model logic, and visualization.
Architectural Patterns
• Single service “app” deployed on Streamlit Cloud (or local): no microservices.
• Caching decorators (@st.cache_data, @st.cache_resource) separate costly operations (data load, model training) from per-request logic.
• MVC-like separation within the Streamlit script:
– Model layer: data-prep & XGBoost training functions
– View layer: Streamlit UI components (sidebar, sliders, charts)
– Controller logic: event-driven handlers that tie UI inputs to model predictions and charts
Main System Components
A. Data Sources
– Breast cancer CSV (from scikit-learn)
– Diabetes CSV (from scikit-learn)
B. Model-Development Pipeline (Notebook)
– EDA: Pandas, Seaborn, Matplotlib, Plotly
– Preprocessing: scaling, feature selection
– Model training: XGBoost Classifier & Regressor
– Model evaluation: metrics, cross-validation
C. Streamlit App (healthcare_app.py)
1. Data Loading & Caching
• load_and_prepare_data()
2. Model Training & Caching
• train_breast_cancer_model()
• train_diabetes_model()
3. UI Components
• Sidebar (model selection, project info)
• Main area tabs (classification, regression, exploration)
4. Prediction Engine
• Accept slider inputs → call cached model → output predictions
5. Visualization Engine
• Render charts (feature importance, ROC, scatter, heatmaps)
6. Resource Loader
• load_image_from_resources() for static UI assets
D. External & Deployment
– Users (browser)
– Streamlit Cloud / Local Python runtime
– Python libraries (Streamlit, XGBoost, Pandas, Plotly, Seaborn, PIL)
Highlighting Architectural Principles
• Single-service, event-driven architecture – Streamlit acts as both server and UI
• Caching to optimize performance and avoid retraining on every request
• Modular functions for data-prep, training, I/O, and visualization
• Clear separation of concerns even within a single script