# petwalsh007/fyp-2025 architecture

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

- Interactive diagram: https://gitdiagram.com/petwalsh007/fyp-2025
- Repository: https://github.com/petwalsh007/fyp-2025

## Overview

##### Project type and purpose
- This is a full-stack, real-time data analytics and visualization platform for industrial systems.
- The README describes bridging diverse industrial data sources (Historian, ERP, LIMS) to end-users with dynamic analysis and advanced visualizations.

##### File structure
- Top level:
- Nginx/ – static index.html and proxy.conf for reverse-proxy configuration
- backend/Back-CT1/ – FastAPI-based API, data-processing scripts (Custom_DTW, Custom_Fuzzy, step_analysis, etc.)
- database_files(DB-CON1)/venv1/ – abstraction layer modules (connections.py, main_abstraction.py), service unit files (gunicorn, uvicorn)
- frontend/ – three separate visualization apps: Bokeh, Dash, Streamlit, each with its own entry point, config and service file
- requirements.txt & packages.sh – dependency management
- Patterns:
- Reverse proxy (NGINX) routes traffic to multiple web servers (Dash, Bokeh, Streamlit, FastAPI).
- Abstraction layer isolates external data-source connectivity.
- Separate processing modules handle analysis algorithms.

##### README for additional insights
- Confirms real-time, distributed computing and dynamic visualizations.

##### Elements
- Clear component labels (e.g., “NGINX Reverse Proxy,” “FastAPI Backend,” “Custom_DTW Module”).
- Blue rectangles: frontend apps
- Green rectangles: backend/API
- Annotations for config files (proxy.conf, gunicorn.service, uvicorn.service).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Users
    Users["Web Browser Users"]

    %% NGINX Layer
    subgraph "NGINX Reverse Proxy"
        direction TB
        ProxyConfig["proxy.conf"] 
        StaticPage["index.html"]
    end

    %% Frontend Layer
    subgraph "Frontend Applications"
        direction TB
        DashApp["Dash App"]:::frontend
        BokehApp["Bokeh Server"]:::frontend
        StreamlitApp["Streamlit App"]:::frontend
    end

    %% Backend/API Layer
    subgraph "Backend/API"
        direction TB
        FastAPI["FastAPI Backend"]:::api
        subgraph "Data Processing" 
            direction TB
            CustomDTW["Custom_DTW.py"] 
            CustomFuzzy["Custom_Fuzzy.py"]
            SimpleAnalysis["simple_analysis.py"]
            StepAnalysis["step_analysis.py"]
            ProcessingScript["processing_script.py"]
            OldDTWTest["Old_DTW_test.py"]
        end
    end

    %% Abstraction Layer
    subgraph "Abstraction Layer" 
        direction TB
        Connections["connections.py"] 
        MainAbstraction["main_abstraction.py"]
    end

    %% Service Units
    subgraph "Service Units"
        direction TB
        UvicornService["Uvnicorn.service.txt"]
        GunicornService["gunicorn.service"]
    end

    %% External Data Sources
    subgraph "External Data Sources"
        direction TB
        Historian["Historian"]:::external
        ERP["ERP"]:::external
        LIMS["LIMS"]:::external
        OtherSystems["Other Systems"]:::external
    end

    %% Connections
    Users -->|"HTTP/WebSocket"| ProxyConfig
    Users -->|"HTTP/WebSocket"| StaticPage

    ProxyConfig -->|"routes /dash"| DashApp
    ProxyConfig -->|"routes /bokeh"| BokehApp
    ProxyConfig -->|"routes /streamlit"| StreamlitApp
    ProxyConfig -->|"routes /api"| FastAPI

    DashApp -->|"API Requests"| FastAPI
    BokehApp -->|"API Requests"| FastAPI
    StreamlitApp -->|"API Requests"| FastAPI

    FastAPI -->|"invoke processing"| CustomDTW
    FastAPI -->|"invoke processing"| CustomFuzzy
    FastAPI -->|"invoke processing"| SimpleAnalysis
    FastAPI -->|"invoke processing"| StepAnalysis
    FastAPI -->|"invoke processing"| ProcessingScript
    FastAPI -->|"invoke processing"| OldDTWTest

    FastAPI -->|"use abstraction"| Connections
    Connections -->|"fetch raw data"| MainAbstraction
    MainAbstraction -->|"access"| Historian
    MainAbstraction -->|"access"| ERP
    MainAbstraction -->|"access"| LIMS
    MainAbstraction -->|"access"| OtherSystems

    ServiceUnits --> FastAPI

    %% Click Events
    click ProxyConfig "https://github.com/petwalsh007/fyp-2025/blob/main/Nginx/proxy.conf"
    click StaticPage "https://github.com/petwalsh007/fyp-2025/blob/main/Nginx/index.html"
    click DashApp "https://github.com/petwalsh007/fyp-2025/blob/main/frontend/Dash-END1/Dash_main.py"
    click BokehApp "https://github.com/petwalsh007/fyp-2025/blob/main/frontend/Bokeh-End1/bokeh_main.py"
    click StreamlitApp "https://github.com/petwalsh007/fyp-2025/blob/main/frontend/Streamlit-End1/streamlit_app.py"
    click FastAPI "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/handling.py"
    click CustomDTW "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/Custom_DTW.py"
    click CustomFuzzy "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/Custom_Fuzzy.py"
    click SimpleAnalysis "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/simple_analysis.py"
    click StepAnalysis "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/step_analysis.py"
    click ProcessingScript "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/processing_script.py"
    click OldDTWTest "https://github.com/petwalsh007/fyp-2025/blob/main/backend/Back-CT1/Old_DTW_test.py"
    click Connections "https://github.com/petwalsh007/fyp-2025/blob/main/database_files(DB-CON1)/venv1/connections.py"
    click MainAbstraction "https://github.com/petwalsh007/fyp-2025/blob/main/database_files(DB-CON1)/venv1/main_abstraction.py"
    click UvicornService "https://github.com/petwalsh007/fyp-2025/blob/main/database_files(DB-CON1)/Uvnicorn.service.txt"
    click GunicornService "https://github.com/petwalsh007/fyp-2025/blob/main/database_files(DB-CON1)/gunicorn.service"

    %% Styles
    classDef frontend fill:#add8e6,stroke:#000
    classDef api fill:#90ee90,stroke:#000
    classDef proxy fill:#d3d3d3,stroke:#000
    classDef processing fill:#f4c430,stroke:#000
    classDef abstraction fill:#eeeeee,stroke:#000,stroke-dasharray: 5 5
    classDef external fill:#ffff99,stroke:#000

    class DashApp,BokehApp,StreamlitApp frontend
    class FastAPI api
    class CustomDTW,CustomFuzzy,SimpleAnalysis,StepAnalysis,ProcessingScript,OldDTWTest processing
    class Connections,MainAbstraction abstraction
    class Historian,ERP,LIMS,OtherSystems external
    class ProxyConfig,StaticPage proxy
```
