# cedricdada/tactic architecture

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

- Interactive diagram: https://gitdiagram.com/cedricdada/tactic
- Repository: https://github.com/cedricdada/tactic

## Overview

##### Main Components
- Data Persistence Layer:
- Core Processing Modules:
– tactic_main.py: Likely acts as the orchestration or entry point for the tactical analysis.
– func_in_pitch.py and func_players_batch.py: Handle computations related to in-pitch actions and batch processing of player data.
– pitch_utils.py and track_utils.py: Provide utility functions for managing pitch-related calculations (e.g., spatial computations) and processing tracking data.
– players.py and team.py: Manage individual player data and aggregate team information.
- Rendering/Visualization Layer:
- Data Input/Output:
– The .env file can be used for configuration settings.
– The assorted .npy files are the main means of persisting and retrieving tracking and tactical data.

##### Relationships and Interactions
- The entry point (tactic_main.py) coordinates the flow:
– It loads configurations from .env.
– It accesses data from various .npy files.
– It calls utility modules (pitch_utils.py, track_utils.py) to perform computations.
– It coordinates data processing from modules like func_in_pitch.py and func_players_batch.py.
– It interacts with players.py and team.py to process and maintain domain-specific information.
- Data flows from raw data files through processing utilities into the output/rendering stages.
- Function modules (e.g., func_in_pitch.py) may call upon various “*_dict.npy” datasets to complete their calculations and then pass processed data to subsequent modules.

##### Architectural Patterns and Design Principles
- Modularity: The clear division into distinct Python modules implies a modular design, where the functional concerns (data reading, processing, and rendering) are separated.
- Layered Approach: The architecture separates data persistence, processing, business logic (tactical analysis), and visualization.
- Data-Driven Processing: The reliance on preexisting data sets (e.g., via .npy files) suggests that processing is heavily data-driven, with a shared data model across modules.

##### Final Recommendations for the Principal Software Engineer
- Critical integration points (for example, where tactic_main.py orchestrates the flow across modules).
- Modularity by clearly segmenting utility modules (pitch_utils.py, track_utils.py), business logic (players.py, team.py, functional modules), and the rendering process (render_track.py).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Persistence Layer
    subgraph "Data Persistence Layer"
        dp_env[".env"]:::datapersistence
        bot_dict["bot_dict.npy"]:::datapersistence
        boxes["boxes.npy"]:::datapersistence
        boxes_pitch["boxes_pitch.npy"]:::datapersistence
        byte_dict["byte_dict.npy"]:::datapersistence
        clip_dict["clip_dict.npy"]:::datapersistence
        clip_dict_2["clip_dict_2.npy"]:::datapersistence
        clip_dict_3["clip_dict_3.npy"]:::datapersistence
        deep_dict["deep_dict.npy"]:::datapersistence
        tracks["tracks.npy"]:::datapersistence
        tracks_bot["tracks_bot.npy"]:::datapersistence
        tracks_clip["tracks_clip.npy"]:::datapersistence
        tracks_save["tracks_save.npy"]:::datapersistence
    end

    %% Processing Layer
    subgraph "Processing Layer"
        tactic_main["tactic_main.py"]:::processing
        subgraph "Functional Modules"
            func_in_pitch["func_in_pitch.py"]:::processing
            func_players_batch["func_players_batch.py"]:::processing
        end
        subgraph "Utility Modules"
            pitch_utils["pitch_utils.py"]:::processing
            track_utils["track_utils.py"]:::processing
        end
        subgraph "Domain Models"
            players["players.py"]:::processing
            team["team.py"]:::processing
        end
    end

    %% Visualization Layer
    subgraph "Visualization Layer"
        render_track["render_track.py"]:::visualization
    end

    %% Data Persistence to Processing connections
    dp_env -->|"loads"| tactic_main
    bot_dict -->|"loads"| tactic_main
    boxes -->|"loads"| tactic_main
    boxes_pitch -->|"loads"| tactic_main
    byte_dict -->|"loads"| tactic_main
    clip_dict -->|"loads"| tactic_main
    clip_dict_2 -->|"loads"| tactic_main
    clip_dict_3 -->|"loads"| tactic_main
    deep_dict -->|"loads"| tactic_main
    tracks -->|"loads"| tactic_main
    tracks_bot -->|"loads"| tactic_main
    tracks_clip -->|"loads"| tactic_main
    tracks_save -->|"loads"| tactic_main

    %% Processing internal connections
    tactic_main -->|"calls"| func_in_pitch
    tactic_main -->|"calls"| func_players_batch
    tactic_main -->|"uses"| pitch_utils
    tactic_main -->|"uses"| track_utils
    tactic_main -->|"processes"| players
    tactic_main -->|"processes"| team

    %% Processing to Visualization connection
    tactic_main -->|"renders"| render_track

    %% Click Events for Data Persistence Layer
    click dp_env "https://github.com/cedricdada/tactic/blob/main/.env"
    click bot_dict "https://github.com/cedricdada/tactic/blob/main/bot_dict.npy"
    click boxes "https://github.com/cedricdada/tactic/blob/main/boxes.npy"
    click boxes_pitch "https://github.com/cedricdada/tactic/blob/main/boxes_pitch.npy"
    click byte_dict "https://github.com/cedricdada/tactic/blob/main/byte_dict.npy"
    click clip_dict "https://github.com/cedricdada/tactic/blob/main/clip_dict.npy"
    click clip_dict_2 "https://github.com/cedricdada/tactic/blob/main/clip_dict_2.npy"
    click clip_dict_3 "https://github.com/cedricdada/tactic/blob/main/clip_dict_3.npy"
    click deep_dict "https://github.com/cedricdada/tactic/blob/main/deep_dict.npy"
    click tracks "https://github.com/cedricdada/tactic/blob/main/tracks.npy"
    click tracks_bot "https://github.com/cedricdada/tactic/blob/main/tracks_bot.npy"
    click tracks_clip "https://github.com/cedricdada/tactic/blob/main/tracks_clip.npy"
    click tracks_save "https://github.com/cedricdada/tactic/blob/main/tracks_save.npy"

    %% Click Events for Processing Layer
    click tactic_main "https://github.com/cedricdada/tactic/blob/main/tactic_main.py"
    click func_in_pitch "https://github.com/cedricdada/tactic/blob/main/func_in_pitch.py"
    click func_players_batch "https://github.com/cedricdada/tactic/blob/main/func_players_batch.py"
    click pitch_utils "https://github.com/cedricdada/tactic/blob/main/pitch_utils.py"
    click track_utils "https://github.com/cedricdada/tactic/blob/main/track_utils.py"
    click players "https://github.com/cedricdada/tactic/blob/main/players.py"
    click team "https://github.com/cedricdada/tactic/blob/main/team.py"

    %% Click Event for Visualization Layer
    click render_track "https://github.com/cedricdada/tactic/blob/main/render_track.py"

    %% Styles
    classDef datapersistence fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef processing fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef visualization fill:#F08080,stroke:#000,stroke-width:1px;
```
