# mehdirt/breast-cancer-diagnosis architecture

> Architecture diagram of the GitHub repository mehdirt/breast-cancer-diagnosis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehdirt/breast-cancer-diagnosis
- Repository: https://github.com/mehdirt/breast-cancer-diagnosis

## Overview

##### Main Components

a) User Interface Layer
- Streamlit web application (from app/main.py)
- Interactive components (sliders, visualization elements)

b) Application Layer
- Main application logic
- Data processing pipeline
- Visualization generation (Plotly)

c) Model Layer
- Trained Logistic Regression model (model/model.pkl)
- Data scaling component (model/scalar.pkl)

d) Data Layer
- Input data handling (data/data.csv)
- Data preprocessing utilities

##### Component Relationships

- User → UI Layer: Show user input flow through the Streamlit interface
- UI Layer → Application Layer: Demonstrate how user inputs are processed
- Application Layer → Model Layer: Show prediction request flow
- Model Layer → UI Layer: Illustrate prediction result return path
- Utils → All Layers: Show utility functions supporting various components

##### Specific Design Elements

Use these visual elements:

- Rectangles: For main components (UI, Application, Model, Data)
- Blue: UI components
- Green: Processing components
- Yellow: Model components
- Gray: Data storage
- Purple: Utility functions

##### Detailed Component Breakdown

Frontend (Streamlit):
**┌─ Web Interface ─────────┐**
- Feature Input Sliders │
- Prediction Display    │
- Plotly Visualizations │
- ┘

Backend Processing:
**┌─ Application Logic ─────┐**
- Data Preprocessing    │
- Model Inference      │
- Result Formation     │
- ┘

Model Components:
**┌─ ML Pipeline ──────────┐**
- Feature Scaling      │
- Logistic Regression  │
- Prediction Logic     │
- ┘

##### Data Flow Patterns

Key flows:

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        UI[UI Component]:::ui
        APP[Application Component]:::app
        MOD[Model Component]:::model
        DATA[(Data Storage)]:::data
        UTIL[[Utility Component]]:::util
    end

    subgraph "User Interface Layer"
        WEB["Web Interface"]:::ui
        VIS["Visualizations"]:::ui
        INP["Feature Input"]:::ui
        PRED_DISP["Prediction Display"]:::ui
    end

    subgraph "Application Layer"
        APP_LOGIC["Application Logic"]:::app
        PROC["Data Processing"]:::app
        VIS_GEN["Visualization Generator"]:::app
    end

    subgraph "Model Layer"
        ML_PIPE["ML Pipeline"]:::model
        SCALE["Feature Scaling"]:::model
        LOG_REG["Logistic Regression"]:::model
        PRED["Prediction Logic"]:::model
    end

    subgraph "Data Layer"
        DATA_STORE[(Input Data)]:::data
        MODEL_STORE[(Trained Model)]:::data
        SCALAR_STORE[(Data Scaler)]:::data
    end

    subgraph "Utility Layer"
        DATA_UTIL[[Data Utils]]:::util
        MODEL_UTIL[[Model Utils]]:::util
    end

    %% Connections
    USER(("User")) --> WEB
    WEB --> INP
    INP --> APP_LOGIC
    APP_LOGIC --> PROC
    PROC --> ML_PIPE
    ML_PIPE --> SCALE
    SCALE --> LOG_REG
    LOG_REG --> PRED
    PRED --> PRED_DISP
    APP_LOGIC --> VIS_GEN
    VIS_GEN --> VIS
    DATA_UTIL --> PROC
    MODEL_UTIL --> ML_PIPE
    DATA_STORE --> PROC
    MODEL_STORE --> LOG_REG
    SCALAR_STORE --> SCALE

    %% Click Events
    click WEB "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/app/main.py"
    click APP_LOGIC "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/app/main.py"
    click DATA_UTIL "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/utils/data_utils.py"
    click MODEL_UTIL "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/utils/model_utils.py"
    click MODEL_STORE "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/model/model.pkl"
    click SCALAR_STORE "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/model/scalar.pkl"
    click ML_PIPE "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/model/main.py"
    click DATA_STORE "https://github.com/mehdirt/Breast-Cancer-Diagnosis/blob/main/data/data.csv"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef app fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#f1c40f,stroke:#f39c12,color:black
    classDef data fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef util fill:#9b59b6,stroke:#8e44ad,color:white
```
