# shreyask5/stroke-risk-prediction architecture

> Architecture diagram of the GitHub repository shreyask5/stroke-risk-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreyask5/stroke-risk-prediction
- Repository: https://github.com/shreyask5/stroke-risk-prediction

## Overview

##### Project type and purpose
- This is a full-stack web application called “Stroke-Risk-Prediction.”
- The frontend is a single-page application (SPA) built with Vite + React + TypeScript and a custom UI component library.
- The backend is a Python service (Flask or similar) running under Gunicorn, which loads a pre-trained ML model (joblib) to predict stroke risk based on user inputs.

##### File structure
- Top-level:
- docker-compose.yml orchestrates two services: frontend and backend.
- backend/ contains the prediction service, ML assets, and training code.
- frontend/ contains all client-side code, configs, and UI components.
- backend/:
- app.py – the API server entrypoint.
- gunicorn.conf.py – Gunicorn settings.
- requirements.txt – Python dependencies.
- stroke_prediction_model.joblib – serialized ML model.
- stroke-data.csv & training.py – data and training pipeline.
- frontend/:
- src/main.tsx, src/App.tsx – SPA bootstrap and root component.
- src/components/StrokePredictionForm.tsx – the form for user input.
- src/components/ui/… – reusable UI primitives (buttons, dialogs, inputs, etc.).
- package.json & bun.lockb – JS/TS dependencies.
- vite.config.ts, tsconfig*.json – build & TS configuration.

##### README
- Minimal README. The project name indicates its function: “Stroke-Risk-Prediction.”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and Client
    UserDevice["User Device"]:::user
    Browser["Web Browser"]:::user
    UserDevice --> Browser

    %% Services orchestrated by Docker-Compose
    subgraph "Containerized Services" 
        direction TB
        Compose["docker-compose.yml"]:::orchestration

        subgraph "Frontend Service (Container)" 
            direction TB
            Main["src/main.tsx"]:::frontend
            App["src/App.tsx"]:::frontend
            Form["StrokePredictionForm.tsx"]:::frontend
            UI["UI Component Library"]:::frontend
            subgraph "Configs & Build"
                direction TB
                Vite["vite.config.ts"]:::frontend
                Tailwind["tailwind.config.ts"]:::frontend
                TS1["tsconfig.json"]:::frontend
                TS2["tsconfig.app.json"]:::frontend
                TS3["tsconfig.node.json"]:::frontend
                Package["package.json"]:::frontend
                Bun["bun.lockb"]:::frontend
                PackLock["package-lock.json"]:::frontend
            end
            DockerFrontend["Dockerfile"]:::orchestration
        end

        subgraph "Backend API Service (Container)" 
            direction TB
            AppPy["app.py"]:::backend
            Gunicorn["gunicorn.conf.py"]:::backend
            Req["requirements.txt"]:::backend
            Model["stroke_prediction_model.joblib"]:::ml
            CSV["stroke-data.csv"]:::ml
            Training["training.py"]:::ml
            DockerBackend["Dockerfile"]:::orchestration
        end
    end

    %% Data Flows
    Browser -->|"GET static assets (port 80)"| Main
    Main -->|"Bootstrap SPA"| App
    App -->|"Render Form UI"| Form
    Form -->|"POST /predict (JSON)"| AppPy
    AppPy -->|"Load & Infer"| Model
    Model -->|"Prediction JSON"| AppPy
    AppPy -->|"Return JSON (risk score)"| Form
    Form -->|"Display Result"| Browser

    %% Offline Training Pipeline
    Training -.->|"reads CSV"| CSV
    Training -.->|"writes model"| Model

    %% Styling
    classDef frontend fill:#D0E8FF,stroke:#0066CC,color:#003366
    classDef backend fill:#DFF2D8,stroke:#3C763D,color:#2B542C
    classDef ml fill:#FFE8CC,stroke:#CC6600,color:#663300
    classDef orchestration fill:#F0F0F0,stroke:#999999,color:#333333
    classDef user fill:#E8E8E8,stroke:#666666,color:#333333

    %% Click Events
    click Main "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/src/main.tsx"
    click App "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/src/App.tsx"
    click Form "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/src/components/StrokePredictionForm.tsx"
    click UI "https://github.com/shreyask5/stroke-risk-prediction/tree/main/frontend/src/components/ui/"
    click Vite "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/vite.config.ts"
    click Tailwind "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/tailwind.config.ts"
    click TS1 "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/tsconfig.json"
    click TS2 "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/tsconfig.app.json"
    click TS3 "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/tsconfig.node.json"
    click Package "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/package.json"
    click Bun "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/bun.lockb"
    click PackLock "https://github.com/shreyask5/stroke-risk-prediction/blob/main/frontend/package-lock.json"
    click DockerFrontend "https://github.com/shreyask5/stroke-risk-prediction/tree/main/frontend/Dockerfile"
    click AppPy "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/app.py"
    click Gunicorn "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/gunicorn.conf.py"
    click Req "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/requirements.txt"
    click Model "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/stroke_prediction_model.joblib"
    click CSV "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/stroke-data.csv"
    click Training "https://github.com/shreyask5/stroke-risk-prediction/blob/main/backend/training.py"
    click DockerBackend "https://github.com/shreyask5/stroke-risk-prediction/tree/main/backend/Dockerfile"
    click Compose "https://github.com/shreyask5/stroke-risk-prediction/blob/main/docker-compose.yml"
```
