# shilpakarkeraa/healathon-team-c architecture

> Architecture diagram of the GitHub repository shilpakarkeraa/healathon-team-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shilpakarkeraa/healathon-team-c
- Repository: https://github.com/shilpakarkeraa/healathon-team-c

## Overview

##### Project Type and Purpose
- This is a machine learning project that builds two classification models (a decision tree classifier and a random forest classifier) to detect early stages of Chronic Kidney Disease using clinical data.
- The project includes data cleaning, exploratory data analysis, model training, and exporting trained models using joblib. It also provides a Flask-based demo web application to showcase the predictive capability in a user-friendly interface.

##### Analyzing the File Structure
- At the top level, you have the notebook (CKD_classification.ipynb) which contains the complete data analysis, cleaning, and model training steps.
- The CSV data file (chronic_kidney_disease.csv) serves as the dataset.
- There are two generated joblib model files (dtc_trained_model.joblib and RF_trained_model.joblib) that hold the trained machine learning models.
- The “flask_demo” directory contains a Flask web application that:
- Uses the generated model files to perform predictions.
- Contains an additional CSV file (patient.csv) possibly used for testing or demonstration.
- Contains an “app.py” file which likely orchestrates the web server and prediction endpoints.
- Has a “templates” folder with at least one HTML template (landing.html) for the user interface.
- The presence of configuration files like LICENSE.md and README.md supports the open documentation of the project.

##### Components

a. Data Source Component:
- Raw clinical dataset (chronic_kidney_disease.csv) as the data input.

b. Data Preprocessing and EDA Component:
- A block for data cleaning, handling null values, outlier management, and exploratory data analysis, as encapsulated in the notebook (CKD_classification.ipynb).

c. Model Training Pipeline:
- Two subcomponents for each machine learning model:
- Decision Tree Classifier → dtc_trained_model.joblib
- Random Forest Classifier → RF_trained_model.joblib
- That these processes are executed as part of the overall notebook workflow and produce the respective joblib files.

d. Model Artifacts Storage:
- That the generated joblib files serve as reusable serialized models that can be deployed independently from the training process.

e. Demo Web Application:
- The Flask web app housed in the "flask_demo" folder.
- “app.py” as the primary entry point.
- A connection to the model artifacts inside this component (both dtc_trained_model.joblib and RF_trained_model.joblib are used here).
- “templates” subcomponent (landing.html) that represents the user interface.

##### Relationships and Interactions
- Inside the Flask component, show interactions between the server (app.py) and the front-end templates (landing.html) as well as potential input data from patient.csv for predictions.
- Use directional connectors to indicate the flow: from data input → processing/training → model serialization → serving via Flask web application.

##### Architectural Patterns and Design Principles
- Separation of concerns: Distinguish the offline training process (data preprocessing, model training) from the online serving component (Flask demo).
- Modularity: The trained models are decoupled from the web application, which allows for independent updates or substitutions.
- Portability: Use of joblib ensures that the trained model can be easily deployed in other contexts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Offline Training"
        DS["Data Source: chronic_kidney_disease.csv"]:::datasource
        EDA["Preprocessing/EDA: CKD_classification.ipynb"]:::eda
        DS -->|"data_inputs"| EDA
        subgraph "Model Training Pipeline"
            DTC["Decision Tree Model: dtc_trained_model.joblib"]:::model
            RFC["Random Forest Model: RF_trained_model.joblib"]:::model
            EDA -->|"model_training"| DTC
            EDA -->|"model_training"| RFC
        end
    end

    subgraph "Online Prediction"
        FLASK["Flask Web App"]:::flaskapp
        UI["UI Template: landing.html"]:::ui
        PATIENT["Patient Data: patient.csv"]:::demodata
        DTC -->|"serialized_model"| FLASK
        RFC -->|"serialized_model"| FLASK
        FLASK -->|"renders"| UI
        FLASK -->|"uses"| PATIENT
    end

    click DS "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/chronic_kidney_disease.csv"
    click EDA "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/CKD_classification.ipynb"
    click DTC "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/dtc_trained_model.joblib"
    click RFC "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/RF_trained_model.joblib"
    click FLASK "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/flask_demo/app.py"
    click UI "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/flask_demo/templates/landing.html"
    click PATIENT "https://github.com/shilpakarkeraa/healathon-team-c/blob/main/flask_demo/patient.csv"

    classDef datasource fill:#FAD7A0,stroke:#A04000,stroke-width:2px;
    classDef eda fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef model fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef flaskapp fill:#A9DFBF,stroke:#1E8449,stroke-width:2px;
    classDef ui fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef demodata fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
```
