# dont-wait/diagnosis-project architecture

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

- Interactive diagram: https://gitdiagram.com/dont-wait/diagnosis-project
- Repository: https://github.com/dont-wait/diagnosis-project

## Overview

##### Project Type and Purpose
- This is a full-stack AI-powered medical diagnosis system.
- The backend is a Python web service (Flask or FastAPI) that exposes a RESTful API.
- The frontend is a simple static UI (HTML/CSS/JS) for patient data entry and result display.
- Machine learning models (Scikit-learn, TensorFlow) live in the “models” folder and perform inference.

##### File Structure Analysis
- Top-level:
- app.py – main Flask/FastAPI app entry point
- client/ – static UI assets
- models/ – pre-trained ML artifacts (.pkl, .pth)
- README & IDE configs (.idea, .vscode)
- client/:
- index.html – UI skeleton
- css/style.css & tailwind-config.js – styling
- js/main.js, diagnosis.js – UI logic & AJAX calls to the API
- No database directory—likely the service is stateless, loading models on demand.

##### Key README Insights
- Purpose: symptom-based disease prediction, visual output for recommendations.
- Tech stack: Python + ML libs for backend; HTML/CSS/JS for frontend.
- RESTful API for integration/testing (e.g., via Postman).

a. Main Components
1. Client Browser UI
2. Web Server (Flask/FastAPI)
3. ML Inference Module
4. Machine Learning Models (stored artifacts)
5. (Optional) Data store or cache for usage logs or future persistence
6. External systems or tools (e.g., Postman for API testing)
b. Relationships & Data Flow
- UI → HTTP Request (JSON payload with symptoms) → Web Server API Endpoint
- Web Server loads or references ML models → invokes Inference Module
- Inference Module runs prediction → returns diagnosis JSON
- Web Server → JSON Response → UI
c. Architectural Patterns & Principles
- Separation of concerns: UI (client) vs. API (server) vs. ML logic
- Model-view-controller flavor: client = view, app.py routes = controller, models = business logic
- Stateless services: each API call loads model(s) and returns result
d. Key Technologies
- Flask or FastAPI (routing, request handling)
- Scikit-learn, TensorFlow, Pandas (data processing & model inference)
- HTML/CSS/Tailwind, vanilla JS (UI rendering & AJAX)

##### Detailed but Focused
- Piece of functionality as its own component.
- Don’t over-complicate—stick to your actual folder structure and runtime flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client (Browser UI)"
        direction TB
        Index["index.html"]:::ui
        StyleCSS["style.css"]:::ui
        MainJS["main.js"]:::ui
        DiagnosisJS["diagnosis.js"]:::ui
        Tailwind["tailwind-config.js"]:::ui
    end

    Postman["Postman\nAPI Client"]:::external

    subgraph "Server"
        direction TB
        APILayer["API Server\n(app.py)"]:::backend
        Inference["Inference Module"]:::backend
    end

    subgraph "Model Storage"
        direction TB
        Model1["model.pkl"]:::artifact
        Model2["modelV2.pkl"]:::artifact
        Model3["modelV2.pth"]:::artifact
    end

    README["README.md"]:::docs

    MainJS -->|"POST /diagnose JSON"| APILayer
    DiagnosisJS -->|"AJAX POST /diagnose"| APILayer
    Postman -->|"POST /diagnose JSON"| APILayer
    APILayer -->|"invoke prediction"| Inference
    Inference -->|"reads model file"| Model1
    Inference -->|"reads model file"| Model2
    Inference -->|"reads model file"| Model3
    Inference -->|"returns diagnosis JSON"| APILayer
    APILayer -->|"200 OK JSON"| MainJS
    APILayer -->|"200 OK JSON"| Postman

    click Index "https://github.com/dont-wait/diagnosis-project/blob/main/client/index.html"
    click StyleCSS "https://github.com/dont-wait/diagnosis-project/blob/main/client/css/style.css"
    click MainJS "https://github.com/dont-wait/diagnosis-project/blob/main/client/js/main.js"
    click DiagnosisJS "https://github.com/dont-wait/diagnosis-project/blob/main/client/js/diagnosis.js"
    click Tailwind "https://github.com/dont-wait/diagnosis-project/blob/main/client/js/tailwind-config.js"
    click APILayer "https://github.com/dont-wait/diagnosis-project/blob/main/app.py"
    click Inference "https://github.com/dont-wait/diagnosis-project/blob/main/app.py"
    click Model1 "https://github.com/dont-wait/diagnosis-project/blob/main/models/model.pkl"
    click Model2 "https://github.com/dont-wait/diagnosis-project/blob/main/models/modelV2.pkl"
    click Model3 "https://github.com/dont-wait/diagnosis-project/blob/main/models/modelV2.pth"
    click README "https://github.com/dont-wait/diagnosis-project/blob/main/README.md"

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef artifact fill:#FFFF99,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef docs fill:#E6E6FA,stroke:#333,stroke-width:1px
```
