# gillopy/deployment_xgboost_heart_disease_uci architecture

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

- Interactive diagram: https://gitdiagram.com/gillopy/deployment_xgboost_heart_disease_uci
- Repository: https://github.com/gillopy/deployment_xgboost_heart_disease_uci

## Overview

##### Main Components
- Data Layer:
- Input Data Folder: Represented by the "data/" directory. This is the starting point where raw datasets (e.g., heart.csv) are stored.
- Data Modules: Under "src/data/", include:
▪ data_loader.py – Responsible for loading the dataset.
▪ data_processor.py – Handles any preprocessing and transformation tasks.
▪ data_splitter.py – Splits the data into training and testing sets.
- Model Layer:
- Training and Evaluation Components: Under "src/model/", incorporate:
▪ trainer.py – Handles the training of the model using XGBoost.
▪ evaluator.py – Evaluates the model performance (e.g., calculates accuracy).
▪ saver.py – Saves the trained models in the "models/" folder with a timestamp.
- Orchestration:
- Main Pipeline: "src/main.py" coordinates all these processes, linking data ingestion, model training, evaluation, and saving.

##### Relationships and Interactions
- Next, indicate that the processed and split data flows into the Trainer component, which invokes XGBoost training.
- Finally, connect the Evaluator to Saver, reflecting that once the model is evaluated, it is saved in the "models/" directory.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Each module (data handling, training, evaluation) is in its own directory under "src/". This structure demonstrates decoupling and organization.
- Pipeline Architecture: The system works as a sequential training pipeline from data ingestion through model training and saving.
- Extensibility: The modular design makes it easier to update or replace components, such as switching model parameters in trainer.py or updating preprocessing in data_processor.py.

##### Relevant Technologies and Frameworks
- Python: The core language, with version 3.10+.
- Poetry: Used for dependency management (configured via pyproject.toml).
- XGBoost: The key library used for model training.
- Pandas: Utilized in the data loading and processing steps.
- Scikit-learn: Used for data splitting and possibly some evaluation metrics.
- Joblib: For saving and loading trained models.

##### Detailed Elements
- Use clear, descriptive labels for each component (e.g., Data Loader, Data Processor, Trainer, Evaluator, Saver).
- E.g., from Data Loader to Processor, then to Splitter, and subsequently into Training.
- Data-related modules (perhaps in blue/rounded rectangles),
- Model-related modules (maybe in green/rectangles),

##### Final Touches
- Adding any infrastructural components not explicitly shown in the file tree if they might be assumed (e.g., version control using Git, Docker for deployment as seen by the Dockerfile).
- Although the current focus is on model training and deployment, note that the modular design permits scalability, so represent how each component might be extended separately.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Orchestration Layer"
        Orchestrator["Main Pipeline"]
    end
    subgraph "Data Layer"
        DataFolder["Data Folder"]
        HeartData["heart.csv"]
        Loader["Data Loader"]
        Processor["Data Processor"]
        Splitter["Data Splitter"]
    end
    subgraph "Model Layer"
        Trainer["Trainer"]
        Evaluator["Evaluator"]
        Saver["Saver"]
    end

    %% Data Flow Connections
    DataFolder --> Loader
    DataFolder --> HeartData
    Loader --> Processor
    Loader --> Splitter
    Processor --> Trainer
    Splitter --> Trainer
    Trainer --> Evaluator
    Evaluator --> Saver

    %% Orchestration Connections
    Orchestrator --> Loader
    Orchestrator --> Processor
    Orchestrator --> Splitter
    Orchestrator --> Trainer
    Orchestrator --> Evaluator
    Orchestrator --> Saver

    %% Click Events
    click DataFolder "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/tree/main/data/"
    click HeartData "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/data/raw/heart.csv"
    click Loader "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/data/data_loader.py"
    click Processor "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/data/data_processor.py"
    click Splitter "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/data/data_splitter.py"
    click Trainer "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/model/trainer.py"
    click Evaluator "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/model/evaluator.py"
    click Saver "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/model/saver.py"
    click Orchestrator "https://github.com/gillopy/deployment_xgboost_heart_disease_uci/blob/main/src/main.py"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef model fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef orch fill:#FFA500,stroke:#000,stroke-width:2px;

    class DataFolder,HeartData,Loader,Processor,Splitter data;
    class Trainer,Evaluator,Saver model;
    class Orchestrator orch;
```
