# kcnotes/gdmdashboard architecture

> Architecture diagram of the GitHub repository kcnotes/gdmdashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kcnotes/gdmdashboard
- Repository: https://github.com/kcnotes/gdmdashboard

## Overview

##### Main Components

a) Data Collection Layer:
- IRC Relay (external source)
- Report Handler (src/report_handler.ts)
- Wiki Population Service (src/populate_wikis.ts, src/populate_reports.ts)

b) Storage Layer:
- SQLite3 Database
- Fandom Wiki Pages (for storing processed data)

c) API Layer (src/api/):
- Dashboard API
- Discussions Interface
- DW Dimensions API
- Edit Interface
- Query Interface

d) Frontend Layer:
- Dashboard Interface (fandom_loaded/gdmdashboard.ts)
- Report Table Component (src/report_table.ts)
- Wiki Table Component (src/wiki_table.ts)

**[IRC Relay] → [Report Handler] → [SQLite DB] → [Upload Service] → [Fandom Wiki Pages]**
- ↑
**[Wiki Population Services] -----------------------------------|**

**[External APIs] ←→ [API Interfaces] ←→ [Core Services]**

**[Dashboard Interface] ←→ [Report/Wiki Tables] ←→ [Fandom Wiki Pages]**

##### Important Relationships to Highlight

- Data Flow:
- IRC Relay → Report Handler
- Population Services → Database
- Upload Service → Fandom Wiki Pages
- Dashboard Interface ←→ Wiki Pages

- API Dependencies:
- How api_interface.ts serves as a base interface
- Fake implementations for testing (src/fakes/)

##### Additional Elements

- A cron job scheduler symbol showing the daily upload_data.js execution
- Environment configuration dependencies (ACCESS_TOKEN)
- PM2 process management for long-running services

##### Technical Stack Indicators

- TypeScript as the primary language
- SQLite3 for data storage
- PM2 for process management
- Fandom's Wiki platform as the presentation layer

##### Deployment Context

A separate deployment view showing:
**[PM2 Managed Processes]**
- report_handler.js (continuous)
- populate_reports.js (one-time)
- upload_data.js (daily cron)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef external fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef api fill:#e67e22,stroke:#d35400,color:white
    classDef frontend fill:#9b59b6,stroke:#8e44ad,color:white
    classDef scheduler fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Data Collection Layer
    subgraph DataCollection
        IRC[IRC Relay]:::external
        RH[Report Handler]:::processing
        WPS[Wiki Population Service]:::processing
    end
    click RH "https://github.com/kcnotes/GDMDashboard/blob/master/src/report_handler.ts"
    click WPS "https://github.com/kcnotes/GDMDashboard/blob/master/src/populate_wikis.ts"

    %% Storage Layer
    subgraph Storage
        DB[(SQLite3 DB)]:::storage
        Wiki[Fandom Wiki Pages]:::external
    end

    %% API Layer
    subgraph APILayer
        BaseAPI[API Base Interface]:::api
        DashAPI[Dashboard API]:::api
        DiscAPI[Discussions Interface]:::api
        DWAPI[DW Dimensions API]:::api
        EditAPI[Edit Interface]:::api
        QueryAPI[Query Interface]:::api
    end
    click BaseAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/api_interface.ts"
    click DashAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/dashboard_api.ts"
    click DiscAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/discussions_interface.ts"
    click DWAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/dw_dimensions_api_interface.ts"
    click EditAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/edit_interface.ts"
    click QueryAPI "https://github.com/kcnotes/GDMDashboard/blob/master/src/api/query_interface.ts"

    %% Frontend Layer
    subgraph Frontend
        DashUI[Dashboard Interface]:::frontend
        RepTable[Report Table]:::frontend
        WikiTable[Wiki Table]:::frontend
    end
    click DashUI "https://github.com/kcnotes/GDMDashboard/blob/master/fandom_loaded/gdmdashboard.ts"
    click RepTable "https://github.com/kcnotes/GDMDashboard/blob/master/src/report_table.ts"
    click WikiTable "https://github.com/kcnotes/GDMDashboard/blob/master/src/wiki_table.ts"

    %% Process Management
    subgraph PM2
        Upload[Upload Service]:::scheduler
        Cron[Daily Cron Job]:::scheduler
    end
    click Upload "https://github.com/kcnotes/GDMDashboard/blob/master/src/upload_data.ts"

    %% Testing
    subgraph Testing
        FakeAPI[API Fakes]:::api
    end
    click FakeAPI "https://github.com/kcnotes/GDMDashboard/tree/master/src/fakes"

    %% Relationships
    IRC --> RH
    RH --> DB
    WPS --> DB
    DB --> Upload
    Upload --> Wiki
    BaseAPI --> |Extends| DashAPI
    BaseAPI --> |Extends| DiscAPI
    BaseAPI --> |Extends| DWAPI
    BaseAPI --> |Extends| EditAPI
    BaseAPI --> |Extends| QueryAPI
    DashUI --> RepTable
    DashUI --> WikiTable
    RepTable --> Wiki
    WikiTable --> Wiki
    BaseAPI --> FakeAPI
    Cron --> Upload

    %% Legend
    subgraph Legend
        L1[External Services]:::external
        L2[Processing Components]:::processing
        L3[Storage]:::storage
        L4[API Components]:::api
        L5[Frontend Components]:::frontend
        L6[Scheduler Components]:::scheduler
    end
```
