# delihiros/uno architecture

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

- Interactive diagram: https://gitdiagram.com/delihiros/uno
- Repository: https://github.com/delihiros/uno

## Overview

##### Main Components
- Data Crawler: The pkg/crawler package indicates a component that retrieves player history data from the Valorant API.
- Database Integration: The pkg/database package shows that uno leverages the shockv portable database to cache and store crawled data.
- Data Entities & Analysis: The pkg/entities directory contains representations of various data objects (matches, player stats, events, etc.), while pkg/analysis (and its subdirectories like maps) suggests modules dedicated to statistical analysis and generating visuals (e.g., heatmaps).
- Visualization & Web Server: The pkg/view and pkg/server packages (with its subdirectories for web and databank) indicate that uno includes functionality to render visualizations and provide a web interface for map images (assets and public directories reinforce this).
- Discord Bot: The pkg/discord folder, containing code like wardell.go, integrates a Discord bot for data visualization triggered from Discord channels.
- Examples/CLI Entrypoints: Multiple examples in the examples folder (e.g., heatmap, killmap, crawler, etc.) illustrate how to run specific features and provide hands-on usage scenarios.

##### Relationships and Interactions
- The API Client interacts directly with Valorant APIs to fetch game data.
- The Data Crawler uses the API Client to collect data, which it then passes to the Database module for caching.
- The Data Entities layer acts as the shared data model throughout the system—linking data input (from the crawler/API client) and output (visualization or analysis).
- The Analysis component processes cached game data, deriving insights (maps, histograms, etc.) that are subsequently used by the Visualization module.
- The Web Server serves the visual assets (with HTML, JS, and images stored under pkg/server/web and public), enabling users to view processed information.
- The Discord Bot leverages the analysis and visualization outputs to provide real-time data views in a chat interface.
- The proxy components (pkg/proxy) suggest there might be network middleware or operations related to routing requests.

##### Architectural Patterns & Principles
- Layered Architecture: The project clearly separates concerns between data retrieval (client/crawler), storage (database), data processing (analysis/entities), and presentation (view/server/discord).
- Modularity: Each module (client, crawler, database, discord, analysis) is self-contained, promoting a microservices-like conceptual separation, even though they are packaged within a single project.
- Extensibility and Testing: The presence of counterpart test files (e.g., in pkg/client) reflects a design geared towards robustness and extendability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    E["Valorant API"]:::external

    %% Data Acquisition Layer
    subgraph "Data Acquisition"
        APIClient["Valorant API Client"]:::acquisition
        DataCrawler["Data Crawler"]:::acquisition
    end

    %% Data Storage & Processing Layer
    subgraph "Data Storage & Processing"
        Database["Shockv Database Integration"]:::storage
        Entities["Data Entities & Models"]:::storage
        AnalysisCore["Data Analysis Core"]:::storage
        MapsAnalysis["Maps Analysis"]:::storage
        Proxy["Proxy Component"]:::storage
    end

    %% Presentation & Interfaces Layer
    subgraph "Presentation & Interfaces"
        Visualization["Visualization Module"]:::presentation
        WebServer["Web Server & Visual Asset Serving"]:::presentation
        DiscordBot["Discord Bot Integration"]:::presentation
    end

    %% Examples / CLI Entrypoints Layer
    subgraph "Examples/CLI Entrypoints"
        Examples["Examples/CLI Entrypoints"]:::example
    end

    %% Connections - Data Flow
    E -->|"APIRequest"| APIClient
    APIClient -->|"fetchData"| DataCrawler
    DataCrawler -->|"crawlsData"| Database
    Database -->|"cachesData"| Entities
    Entities -->|"providesData"| AnalysisCore
    AnalysisCore -->|"processesData"| MapsAnalysis
    MapsAnalysis -->|"routesData"| Proxy
    Proxy -->|"sendsVisualizationData"| Visualization
    Visualization -->|"rendersAssets"| WebServer
    AnalysisCore -->|"notifies"| DiscordBot
    Examples -->|"demoModules"| APIClient
    Examples -->|"demoModules"| Visualization

    %% Click Events
    click APIClient "https://github.com/delihiros/uno/tree/main/pkg/client"
    click DataCrawler "https://github.com/delihiros/uno/tree/main/pkg/crawler"
    click Database "https://github.com/delihiros/uno/tree/main/pkg/database"
    click Entities "https://github.com/delihiros/uno/tree/main/pkg/entities"
    click AnalysisCore "https://github.com/delihiros/uno/tree/main/pkg/analysis"
    click MapsAnalysis "https://github.com/delihiros/uno/tree/main/pkg/analysis/maps"
    click Visualization "https://github.com/delihiros/uno/tree/main/pkg/view"
    click WebServer "https://github.com/delihiros/uno/tree/main/pkg/server"
    click DiscordBot "https://github.com/delihiros/uno/tree/main/pkg/discord"
    click Proxy "https://github.com/delihiros/uno/tree/main/pkg/proxy"
    click Examples "https://github.com/delihiros/uno/tree/main/examples"

    %% Class Definitions for Colors and Styles
    classDef external fill:#ffebcd,stroke:#8b4513,stroke-width:2px;
    classDef acquisition fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef storage fill:#98fb98,stroke:#006400,stroke-width:2px;
    classDef presentation fill:#ffc0cb,stroke:#c71585,stroke-width:2px;
    classDef example fill:#fffacd,stroke:#daa520,stroke-width:2px;
```
