# fares1583/graduationproject architecture

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

- Interactive diagram: https://gitdiagram.com/fares1583/graduationproject
- Repository: https://github.com/fares1583/graduationproject

## Overview

##### Project type and purpose
- This is a front-end only, single-page React application bootstrapped with Vite.
- Purpose: provide a data-exploration UI (file upload, chart display, statistical tests, regression, etc.) entirely in the browser, with no dedicated backend.

##### File structure
- Top-level config files:
- package.json, vite.config.js – define dependencies, build & dev server settings
- eslint.config.js – linting rules
- public/ – static assets (favicon, index.html template)
- src/ – React source:
- main.jsx – entry point, mounts App into DOM
- App.jsx + App.css – core application container
- components/ – reusable UI modules (ChartDisplay, FileUpload, HypothesisTest, Regression, etc.)
- assets/ – images/fonts, if any
- constants.js – shared constants
- No backend or API folder, so all data processing (e.g. CSV parsing, stats) happens in-browser.

##### README insights
- Uses Vite’s dev server with HMR for rapid iteration
- Builds a production bundle of static JS/CSS files for deployment to a static host (e.g. Netlify, GitHub Pages)

##### Diagramming the architecture
a. Main components to represent:
1. User’s Browser (entry point)
2. Dev/Prod Server (Vite dev server or static file host/CDN)
3. index.html (HTML template)
4. Vite Build Pipeline (transpile, bundle, HMR plugin)
5. React Runtime (ReactDOM, root App component)
6. UI Components (FileUpload, ChartDisplay, StatsPanel, etc.)
7. In-browser Data Processing Module (CSV parser, hypothesis test logic, regression engine)
8. Static Assets (images, CSS, constants)
b. Relationships & interactions:
- Browser → HTTP GET → Dev/Prod Server → serves index.html + main.js + CSS
- index.html loads main.js; Vite HMR websocket for dev only
- React mounts App → renders child components based on user events
- FileUpload component uses JS File API → hands file stream to data-processing module
- Data module returns processed data → passes to ChartDisplay, StatsPanel, HypothesisTest, Regression
c. Architectural patterns & design principles:
- Single-Page Application (SPA)
- Component-based UI (React)
- Unidirectional data flow: App state → props → child components → event callbacks → App state
- Build pipeline abstraction: Vite plugins handle Babel/SWC compilation, asset resolution, live reload
d. Key technologies & libraries:
- Vite (dev server, build)
- React + ReactDOM
- ESLint (lint rules)
- Possible charting library (if used in ChartDisplay)
- JavaScript modules (ESM)

##### Be as detailed as possible

Example layout (textual):

[User’s Browser]
↕ (HTTP: GET /)
[Dev Server / Static Host]
└─ hosts index.html, main.js, style.css
└─ built via [Vite Build Pipeline]

In-Browser:
[ReactDOM.render(App)]
├─ App
│    ├─ FileUpload → Data Processor →
│    │                      ├─ HypothesisTest
│    │                      ├─ Regression
│    │                      └─ StatsPanel → StatCard
│    └─ ChartDisplay
└─ ColumnSelector, TestSelector, DataPreview

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Infrastructure
    subgraph "Build Infrastructure"
        viteConfig["Vite Build Pipeline"]:::buildInfra
        eslintr["ESLint Configuration"]:::buildInfra
        pkg["Package & Dependency Management"]:::buildInfra
    end

    %% Hosting Layer
    subgraph "Hosting Layer"
        server["Dev/Prod Server\n(Vite Dev Server / CDN)"]:::buildInfra
        staticHTML["Static HTML Template\n(index.html)"]:::assets
        publicAssets["Public Static Assets"]:::assets
    end

    %% Runtime Browser
    browser["User's Browser"]:::runtime

    %% React Application Runtime
    subgraph "Runtime: React App"
        entry["Application Entry Point\n(src/main.jsx)"]:::runtime
        appNode["Core App Container\n(src/App.jsx)"]:::runtime
        dataProc["In-Browser Data Processing Module\n(src/reg.jsx)"]:::dataLogic

        fileUpload["File Upload Component\n(src/components/FileUpload.jsx)"]:::runtime
        chartDisplay["Chart Display Component\n(src/components/ChartDisplay.jsx)"]:::runtime
        hypothesisTest["Hypothesis Testing Component\n(src/components/HypothesisTest.jsx)"]:::runtime
        regressionComp["Regression Component\n(src/components/Regression.jsx)"]:::runtime
        statsPanel["Statistics Panel Component\n(src/components/StatsPanel.jsx)"]:::runtime
        statCard["Statistical Card Sub-Component\n(src/components/StatCard.jsx)"]:::runtime
        columnSelector["Column Selector Component\n(src/components/ColumnSelector.jsx)"]:::runtime
        testSelector["Test Selector Component\n(src/components/TestSelector.jsx)"]:::runtime
        dataPreview["Data Preview Component\n(src/components/DataPreview.jsx)"]:::runtime
    end

    %% Assets and Config Files
    constants["Shared Constants\n(src/constants.js)"]:::assets
    globalStyles["Global Styles\n(src/index.css)"]:::assets
    appCSS["Core App Styles\n(src/App.css)"]:::assets
    assetsDir["Asset Directory\n(src/assets)"]:::assets
    readme["Project README\n(README.md)"]:::assets
    packageFile["package.json"]:::buildInfra
    eslintFile["eslint.config.js"]:::buildInfra
    viteConfigFile["vite.config.js"]:::buildInfra
    indexHTMLFile["index.html"]:::assets
    publicDir["public/"]:::assets

    %% Connections: Build to Hosting
    pkg -->|"defines deps"| viteConfig
    eslintr -->|"lint rules"| viteConfig
    viteConfig -->|"builds bundle"| server

    packageFile --> pkg
    eslintFile --> eslintr
    viteConfigFile --> viteConfig

    server --> staticHTML
    server --> publicAssets

    staticHTML --> indexHTMLFile
    publicAssets --> publicDir

    %% Browser <-> Server
    browser -->|"GET /"| server
    server -->|"200 index.html, main.js, CSS"| browser

    %% Browser to React App
    browser -->|"load main.js & CSS"| entry
    entry -->|"mounts App"| appNode

    %% App to Components and Data Flow
    appNode -->|"renders"| fileUpload
    appNode -->|"renders"| chartDisplay
    appNode -->|"renders"| columnSelector
    appNode -->|"renders"| testSelector
    appNode -->|"renders"| dataPreview
    appNode --> appCSS
    appNode --> constants
    appNode --> globalStyles

    fileUpload -->|"File → parseCSV()"| dataProc
    dataProc -->|"processed data"| chartDisplay
    dataProc -->|"processed data"| hypothesisTest
    dataProc -->|"processed data"| regressionComp
    dataProc -->|"processed data"| statsPanel

    statsPanel -->|"renders"| statCard
    chartDisplay --> assetsDir

    %% Config and Assets Dependencies
    constants --> readme

    %% Click Events
    click viteConfig "https://github.com/fares1583/graduationproject/blob/main/vite.config.js"
    click eslintr "https://github.com/fares1583/graduationproject/blob/main/eslint.config.js"
    click pkg "https://github.com/fares1583/graduationproject/blob/main/package.json"
    click staticHTML "https://github.com/fares1583/graduationproject/blob/main/index.html"
    click publicAssets "https://github.com/fares1583/graduationproject/tree/main/public/"
    click entry "https://github.com/fares1583/graduationproject/blob/main/src/main.jsx"
    click appNode "https://github.com/fares1583/graduationproject/blob/main/src/App.jsx"
    click appCSS "https://github.com/fares1583/graduationproject/blob/main/src/App.css"
    click globalStyles "https://github.com/fares1583/graduationproject/blob/main/src/index.css"
    click constants "https://github.com/fares1583/graduationproject/blob/main/src/constants.js"
    click dataProc "https://github.com/fares1583/graduationproject/blob/main/src/reg.jsx"
    click fileUpload "https://github.com/fares1583/graduationproject/blob/main/src/components/FileUpload.jsx"
    click chartDisplay "https://github.com/fares1583/graduationproject/blob/main/src/components/ChartDisplay.jsx"
    click hypothesisTest "https://github.com/fares1583/graduationproject/blob/main/src/components/HypothesisTest.jsx"
    click regressionComp "https://github.com/fares1583/graduationproject/blob/main/src/components/Regression.jsx"
    click statsPanel "https://github.com/fares1583/graduationproject/blob/main/src/components/StatsPanel.jsx"
    click statCard "https://github.com/fares1583/graduationproject/blob/main/src/components/StatCard.jsx"
    click columnSelector "https://github.com/fares1583/graduationproject/blob/main/src/components/ColumnSelector.jsx"
    click testSelector "https://github.com/fares1583/graduationproject/blob/main/src/components/TestSelector.jsx"
    click dataPreview "https://github.com/fares1583/graduationproject/blob/main/src/components/DataPreview.jsx"
    click assetsDir "https://github.com/fares1583/graduationproject/tree/main/src/assets"
    click readme "https://github.com/fares1583/graduationproject/blob/main/README.md"

    %% Styles
    classDef buildInfra fill:#f9f,stroke:#333,stroke-width:2px
    classDef runtime fill:#bbf,stroke:#333,stroke-width:2px
    classDef dataLogic fill:#fbf,stroke:#333,stroke-width:2px
    classDef assets fill:#bfb,stroke:#333,stroke-width:2px
```
