# filipecalegario/strateegia-interaction-networks architecture

> Architecture diagram of the GitHub repository filipecalegario/strateegia-interaction-networks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/filipecalegario/strateegia-interaction-networks
- Repository: https://github.com/filipecalegario/strateegia-interaction-networks

## Overview

##### Project Type & Purpose
- This project is a client-side web application built with HTML, CSS, and JavaScript. Its main purpose is to implement a simple login mechanism to interact with the “strateegia API.”
- The README emphasizes a straightforward “Simple login” to the API, which means the focus is on authenticating the user and possibly presenting interactive visualizations after login.

##### Analyzing the File Structure
- HTML Files: Files like index.html, beeswarm.html, and main.html indicate different entry points or views (like a dashboard, visualization view, or specialized graph view).
- CSS Folder: Contains both Bootstrap files (for grid, reboot, and core styles) and a custom dashboard.css, suggesting a responsive design with custom styling for the dashboard.
- JavaScript Folder: Organizes functionality into subdirectories:
- core: Contains scripts for authentication (auth.js), configuration (config.js), periodic session checks (periodicCheck.js), and project management (projectManager.js).
- data: Deals with data management – including modules for managing and mocking API data (dataManager.js, graphData.js, mockupGraphData.js) and handling statistics.
- ui: Contains a uiManager.js that likely coordinates user interface actions.
- utils: Provides helper functions such as d3functions.js for visualizations, simulationWorker.js for background tasks, and other utility functions.
- visualization: Contains modules (beeswarm.js, graphRenderer.js) specifically for rendering graphical data.
- Additional files like login.js, main.js, visualData.js, and visualProjects.js further suggest that this project interweaves login functionality with dynamic visual data representation and project management.

##### Key Architectural Components
a. Presentation/UI Layer:
- HTML Files (index.html, beeswarm.html, main.html): Represent different pages/views.
- CSS Stylesheets (both Bootstrap and custom dashboard.css): Signify styling and layout.

b. Business Logic / Controller Layer:
- Core JavaScript Modules (auth.js, config.js, periodicCheck.js, projectManager.js): Manage authentication, configuration, session management, and project-related operations.
- UI Manager (uiManager.js): Handles UI behaviors and interactions.

c. Data Management & Integration Layer:
- Data Handlers (dataManager.js, graphData.js, mockupGraphData.js, statisticsManager.js): Manage data retrieval, manipulation, and potential mocking of API responses.
- Integration with the strateegia API for login validation and data fetching.

d. Visualization:
- Visualization Modules (beeswarm.js, graphRenderer.js): Render visual data outputs (likely D3-based given references to d3functions.js).
- Additional visual-related modules (visualData.js, visualProjects.js): Support other visualization or project-specific displays.

e. Utilities:
- General utility functions (jsonpath-browser-umd.cjs, utils.js, simulationWorker.js): Provide supportive functions that are used across the application.

##### Relationships & Interactions
- The user interacts with the HTML views, which trigger JavaScript events.
- Upon login, the auth.js module (within the core directory) handles the authentication by interacting with the strateegia API.
- Once authenticated, the UI Manager coordinates between the data layer and visualization components.
- Data modules retrieve or simulate data and pass it to the visualization modules which use D3 utilities to render interactive graphs.
- PeriodicCheck (from the core folder) ensures session validity, and projectManager coordinates project-specific actions.

##### Final Guidance for the Principal Software Engineer
- Break each layer into its components as highlighted above. For instance, “Authentication” should connect to both the UI (login screen) and the external strateegia API.
- Detail the interactions: How does the UI trigger core logic? How does data flow from the API (or mock data) to the visualization modules?
- Major JavaScript modules grouped by their folder organization to reflect internal coupling and responsibilities.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    user["User"]:::user

    subgraph "Frontend Views"
        F1["index.html"]:::frontend
        F2["beeswarm.html"]:::frontend
        F3["main.html"]:::frontend
    end

    subgraph "Styling"
        S1["CSS Files"]:::styling
    end

    subgraph "Authentication & Core Logic"
        A1["auth.js"]:::core
        A2["config.js"]:::core
        A3["periodicCheck.js"]:::core
        A4["projectManager.js"]:::core
        A5["login.js"]:::core
        A6["main.js"]:::core
    end

    subgraph "UI Management"
        U1["uiManager.js"]:::ui
    end

    subgraph "Data Management"
        D1["dataManager.js"]:::data
        D2["graphData.js"]:::data
        D3["mockupGraphData.js"]:::data
        D4["statisticsManager.js"]:::data
    end

    subgraph "Visualization Components"
        V1["beeswarm.js"]:::viz
        V2["graphRenderer.js"]:::viz
        V3["visualData.js"]:::viz
        V4["visualProjects.js"]:::viz
    end

    subgraph "Utilities"
        UT1["d3functions.js"]:::utils
        UT2["jsonpath-browser-umd.cjs"]:::utils
        UT3["simulationWorker.js"]:::utils
        UT4["utils.js"]:::utils
    end

    external["strateegia API"]:::external

    %% Connections
    user -->|"interacts"| F1
    user -->|"interacts"| F2
    user -->|"interacts"| F3

    S1 -->|"styles"| F1
    S1 -->|"styles"| F2
    S1 -->|"styles"| F3

    F1 -->|"triggersLogin"| A5
    F1 -->|"initiatesAuth"| A1

    A1 -->|"validates"| external
    external -->|"authResponse"| A1

    A1 -->|"updatesUI"| U1
    A5 -->|"delegatesToAuth"| A1
    A2 --> A1
    A3 --> A1
    A4 --> A1
    A6 --> A1

    U1 -->|"loadsData"| D1

    D1 -->|"suppliesData"| V1
    D1 -->|"suppliesData"| V2
    D2 -->|"providesGraphData"| V3
    D3 -->|"providesMockData"| V4

    %% Utilities usage (dashed arrows)
    A1 ---|"uses"| UT4
    D1 ---|"uses"| UT4
    V1 ---|"D3Functions"| UT1

    %% Styles for layers
    classDef frontend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef styling fill:#d8bfd8,stroke:#000,stroke-width:2px;
    classDef core fill:#ffa500,stroke:#000,stroke-width:2px;
    classDef ui fill:#ffff99,stroke:#000,stroke-width:2px;
    classDef data fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef viz fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef utils fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef external fill:#ffb6c1,stroke:#000,stroke-width:2px;
    classDef user fill:#f0e68c,stroke:#000,stroke-width:2px;

    %% Click Events
    click F1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/index.html"
    click F2 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/beeswarm.html"
    click F3 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/main.html"
    click S1 "https://github.com/filipecalegario/strateegia-interaction-networks/tree/main/css/"
    click A1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/core/auth.js"
    click A2 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/core/config.js"
    click A3 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/core/periodicCheck.js"
    click A4 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/core/projectManager.js"
    click A5 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/login.js"
    click A6 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/main.js"
    click U1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/ui/uiManager.js"
    click D1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/data/dataManager.js"
    click D2 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/data/graphData.js"
    click D3 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/data/mockupGraphData.js"
    click D4 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/data/statisticsManager.js"
    click V1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/visualization/beeswarm.js"
    click V2 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/visualization/graphRenderer.js"
    click V3 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/visualData.js"
    click V4 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/visualProjects.js"
    click UT1 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/utils/d3functions.js"
    click UT2 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/utils/jsonpath-browser-umd.cjs"
    click UT3 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/utils/simulationWorker.js"
    click UT4 "https://github.com/filipecalegario/strateegia-interaction-networks/blob/main/js/utils/utils.js"
```
