# shaadclt/multiple-disease-prediction-system architecture

> Architecture diagram of the GitHub repository shaadclt/multiple-disease-prediction-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaadclt/multiple-disease-prediction-system
- Repository: https://github.com/shaadclt/multiple-disease-prediction-system

## Overview

##### Project type and purpose
- This is a single-page, Streamlit-based web application written in Python.
- Purpose: allow end users to enter medical parameters in a browser UI and receive predictions for diabetes, heart disease, and Parkinson’s disease via pre-trained machine-learning models.

##### File structure
- Top-level files:
- Three Jupyter notebooks (“Multiple Disease Prediction System – …ipynb”) used for model development and exploration.
- `multiplediseaseprediction.py`: the Streamlit application entry point that ties together UI, model loading, prediction logic, and visualization.
- Three `.csv` files (datasets) and three `.sav` files (persisted, pre-trained scikit-learn models).
- `requirements.txt`: defines Python dependencies (Streamlit, pandas, scikit-learn, etc.).
- No separate “frontend” vs. “backend” directories; the Streamlit script serves both roles.
- No external databases—data assets and models are file-based.

##### README for additional insights
- Confirms tech stack: Python + Streamlit + scikit-learn.
- Workflow: user input → prediction → visualization.
- No distributed services or microservices; everything is co-located in one runtime.

##### Main components and their interactions
a. User / Client (web browser)
b. Streamlit App Server (multiplediseaseprediction.py)
- UI Layer: form inputs, buttons, result panes
- Controller/Orchestration: routes input to preprocessing, model inference, and visualization functions
c. Preprocessing Module: reads form values, sanitizes/normalizes features for each disease model
d. Model Loader & Inference Module: loads `.sav` files for diabetes, heart, Parkinson’s and invokes `.predict_proba()` or `.predict()`
e. Visualization Module: generates charts (e.g., feature-importance bar charts)
f. Data Assets: CSV files (for reference or retraining), Model files (.sav)

Relationships:
- Browser → HTTP request (Streamlit) → App Server
- App Server → Preprocessing → Model Inference → Visualization → App Server → Browser
- App Server ↔ File System (load .sav models and optional CSVs)

##### Architectural patterns and design principles
- Monolithic single-process architecture (UI and business logic co-located)
- Separation of concerns within the script: UI, preprocessing, inference, visualization
- Offline training pipeline (represented by Jupyter notebooks) decoupled from the runtime system

##### Detail without over-fragmenting
- Logical sub-component (UI form, inference engine, file loader, chart generator)
- Avoid needless micro-services; reflect the true monolithic nature
- External dependencies (Python runtime, Streamlit framework)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["User Browser"]:::ui
    end

    %% Server Layer
    subgraph "Server Layer"
        subgraph "Streamlit App Server"
            UI["UI Layer<br/>(Forms & Buttons)"]:::ui
            Preproc["Preprocessing Module"]:::logic
            Inference["Model Inference Module"]:::logic
            Viz["Visualization Module"]:::logic
            FS["File System Access"]:::data
        end
    end

    %% Data/Model Layer
    subgraph "Data/Model Layer"
        csv1["diabetes.csv"]:::data
        csv2["heart.csv"]:::data
        csv3["parkinsons.csv"]:::data
        model1["diabetes_model.sav"]:::data
        model2["heart_disease_model.sav"]:::data
        model3["parkinsons_model.sav"]:::data
    end

    %% Offline Training Subsystem
    subgraph "Offline Training Subsystem"
        NB1["Diabetes Notebook"]:::offline
        NB2["Heart Disease Notebook"]:::offline
        NB3["Parkinson’s Notebook"]:::offline
    end

    %% Project Metadata
    subgraph "Project Metadata"
        README["README.md"]:::data
        REQ["requirements.txt"]:::data
    end

    %% Data Flow
    Browser -->|HTTP Request| UI
    UI -->|input data| Preproc
    Preproc -->|cleaned features| Inference
    Inference -->|predictions| Viz
    Viz -->|render results| Browser

    Preproc -->|load files| FS
    Inference -->|load models| FS
    FS --> csv1
    FS --> csv2
    FS --> csv3
    FS --> model1
    FS --> model2
    FS --> model3

    NB1 -->|offline training| model1
    NB2 -->|offline training| model2
    NB3 -->|offline training| model3

    %% Click Events
    click UI "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/multiplediseaseprediction.py"
    click Preproc "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/multiplediseaseprediction.py"
    click Inference "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/multiplediseaseprediction.py"
    click Viz "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/multiplediseaseprediction.py"
    click FS "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/multiplediseaseprediction.py"
    click NB1 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/Multiple Disease Prediction System - Diabetes.ipynb"
    click NB2 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/Multiple Disease Prediction System - Heart.ipynb"
    click NB3 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/Multiple Disease Prediction System - Parkinsons.ipynb"
    click csv1 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/diabetes.csv"
    click csv2 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/heart.csv"
    click csv3 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/parkinsons.csv"
    click model1 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/diabetes_model.sav"
    click model2 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/heart_disease_model.sav"
    click model3 "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/parkinsons_model.sav"
    click README "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/README.md"
    click REQ "https://github.com/shaadclt/multiple-disease-prediction-system/blob/main/requirements.txt"

    %% Styles
    classDef ui fill:#b8e986,stroke:#333,stroke-width:1px
    classDef logic fill:#a2d2ff,stroke:#333,stroke-width:1px
    classDef data fill:#ffcc80,stroke:#333,stroke-width:1px
    classDef offline fill:#d3d3d3,stroke:#333,stroke-width:1px
```
