# ian-shepherd/reus architecture

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

- Interactive diagram: https://gitdiagram.com/ian-shepherd/reus
- Repository: https://github.com/ian-shepherd/reus

## Overview

##### Main Components

a. Data Sources Layer:
- FBref API Integration
- FotMob API Integration
- Transfermarkt API Integration

b. Core Library Components:
- Data Scraping Modules
- Data Processing Modules
- Utility Functions

c. Client Interface Layer:
- Public API Methods
- Documentation System

##### Architectural Pattern

**[Client Applications]**
- ↑
**[Reus Public API]**
- ↑
**┌─────────────────────────────────────┐**
- Core Modules              │
- ┬─────────┬────────────────┤
- FBref   │ FotMob  │ Transfermarkt  │
- Module  │ Module  │ Module         │
- ┴─────────┴────────────────┘
- ↑
**[Data Source APIs]**

##### Component Details

a. For each data source module (FBref, FotMob, Transfermarkt):
- Separate submodules for different data types (matches, players, teams)
- Data transformation utilities
- Rate limiting and request handling

b. Utility Layer:
- Common functions
- Data processing helpers
- Error handling

##### Important Elements to Highlight

- Rate limiting mechanism (3-second delay between requests)
- Data transformation pipelines
- Error handling and retry logic
- Documentation system integration

##### Specific Module Relationships

- How the fbref module interacts with its submodules (fb_match_data, fb_team_data, etc.)
- How the fotmob module handles different data types (leagues, matches, stats)
- How the transfermarkt module manages player and team data

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        CA[Client Applications]
        API[Reus Public API]:::api
    end

    subgraph Core["Core Library Layer"]
        direction TB
        Utils["Utility Layer"]:::utils
        DocSystem["Documentation System"]:::docs
        
        subgraph DataModules["Data Source Modules"]
            direction TB
            
            subgraph FBref["FBref Module"]
                direction TB
                FBM["Match Data"]:::fbref
                FBT["Team Data"]:::fbref
                FBP["Player Data"]:::fbref
                FBU["FBref Utils"]:::utils
            end

            subgraph FotMob["FotMob Module"]
                direction TB
                FML["League Data"]:::fotmob
                FMM["Match Data"]:::fotmob
                FMS["Statistics"]:::fotmob
            end

            subgraph TMarkt["Transfermarkt Module"]
                direction TB
                TMP["Player Data"]:::transfermarkt
                TMT["Team Data"]:::transfermarkt
                TMTr["Transfer Data"]:::transfermarkt
                TMU["TMarkt Utils"]:::utils
            end
        end
    end

    subgraph External["External Data Sources"]
        direction TB
        FBAPI["FBref API"]:::external
        FMAPI["FotMob API"]:::external
        TMAPI["Transfermarkt API"]:::external
    end

    %% Connections
    CA --> API
    API --> DataModules
    DataModules --> Utils
    DataModules --> DocSystem
    
    FBref --> FBAPI
    FotMob --> FMAPI
    TMarkt --> TMAPI

    %% Click Events
    click Utils "https://github.com/ian-shepherd/reus/blob/main/reus/util.py"
    click DocSystem "https://github.com/ian-shepherd/reus/tree/main/docs/"
    click FBref "https://github.com/ian-shepherd/reus/tree/main/reus/fbref/"
    click FBM "https://github.com/ian-shepherd/reus/blob/main/reus/fbref/fb_match_data.py"
    click FBT "https://github.com/ian-shepherd/reus/blob/main/reus/fbref/fb_team_data.py"
    click FBP "https://github.com/ian-shepherd/reus/blob/main/reus/fbref/fb_player_match_logs_data.py"
    click FBU "https://github.com/ian-shepherd/reus/blob/main/reus/fbref/util.py"
    click FotMob "https://github.com/ian-shepherd/reus/tree/main/reus/fotmob/"
    click FML "https://github.com/ian-shepherd/reus/blob/main/reus/fotmob/fm_leagues.py"
    click FMM "https://github.com/ian-shepherd/reus/blob/main/reus/fotmob/fm_match_data.py"
    click FMS "https://github.com/ian-shepherd/reus/blob/main/reus/fotmob/fm_season_stats.py"
    click TMarkt "https://github.com/ian-shepherd/reus/tree/main/reus/transfermarkt/"
    click TMP "https://github.com/ian-shepherd/reus/blob/main/reus/transfermarkt/tm_player_data.py"
    click TMT "https://github.com/ian-shepherd/reus/blob/main/reus/transfermarkt/tm_team_player_data.py"
    click TMTr "https://github.com/ian-shepherd/reus/blob/main/reus/transfermarkt/tm_team_transfers.py"
    click TMU "https://github.com/ian-shepherd/reus/blob/main/reus/transfermarkt/util.py"
    click API "https://github.com/ian-shepherd/reus/blob/main/reus/__init__.py"

    %% Styles
    classDef api fill:#gray
    classDef utils fill:#yellow
    classDef docs fill:#lightblue
    classDef fbref fill:#blue
    classDef fotmob fill:#blue
    classDef transfermarkt fill:#blue
    classDef external fill:#green

    %% Legend
    subgraph Legend
        direction TB
        L1[API Layer]:::api
        L2[Utilities]:::utils
        L3[Documentation]:::docs
        L4[Data Modules]:::fbref
        L5[External Sources]:::external
    end
```
