# entropicsky/s2combatlogsql architecture

> Architecture diagram of the GitHub repository entropicsky/s2combatlogsql, 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/entropicsky/s2combatlogsql
- Repository: https://github.com/entropicsky/s2combatlogsql

## Overview

##### Main Components
- Combat Log Parser Module:
- Represented by the smite_parser directory (including cli.py, parser.py, transformers.py, and models.py).
- This component handles the extraction of events, player details, and combat actions from raw log files.
- Tools like “load.py” and “reprocess_data.py” also integrate with this module, handling data ingestion or reprocessing.
- Data Exploration & Utility Scripts:
- The “data_explore” folder contains scripts for analyzing specific fields, sample events, and quick data introspection.
- The “scripts” directory includes tasks like enhancing timelines, exporting to Excel, and migrating schemas.
- Database:
- The parsed data is stored in a SQLite database (as referenced in both the README and in files such as the SQLite.sql script in agent_notes).
- Streamlit Web Application:
- Represented by the “streamlit” directory, which includes the main Home.py file, pages for Match Summary and Items & Builds analysis, and an internal testing area.
- This component provides the interactive UI for uploading combat log files, reviewing match metadata, and visualizing data (charts, timelines, tables).

##### Relationships and Interactions
- Data Flow:
- Raw combat log files (input by the user via the Streamlit Upload interface) are passed to the Combat Log Parser.
- The parser processes these files and stores the structured output in the SQLite database.
- The Streamlit application then queries the SQLite DB to generate visualizations and display match statistics.
- Interdependencies:
- Scripts and utilities in “data_explore” and “scripts” serve as auxiliary tools for maintenance, schema migration, or additional analysis (they can be depicted as support components that interact with both the parser and the database).
- Testing:
- Both “tests” and “streamlit/tests” directories should be shown as verifying the correctness of models, parsing, data transformations, and UI interactions.

##### Important Architectural Patterns and Technologies
- Separation of Concerns:
- The tool cleanly separates concerns by dividing the project into a parsing backend (smite_parser), data utilities, and the Streamlit-driven presentation layer.
- Modular Design:
- Each directory/module (e.g., smite_parser for core processing, streamlit for UI) performs isolated functions.
- Data Pipeline:
- A pipeline where raw inputs are ingested, transformed, and then visualized.
- Technologies:
- Python is the core language.
- SQLite is used as the database.
- Streamlit provides the web front-end.
- Other Python libraries and dependencies are managed via requirements.txt and setup.py.

##### Elements
- Clear Labels:
- Components as “Combat Log Parser”, “Data Processing Scripts”, “SQLite Database”, “Streamlit UI”, etc.
- Data flow (e.g., log file processing, database insertions, query responses) between these components.
- Visual Distinctions:
- Functional components (e.g., modules vs. database vs. UI)
- External tools (such as Python environment and dependency management)
- Additional Details:
- With the architectural patterns (e.g., separation of concerns, layered architecture) and the interactions for maintenance routines (e.g., the auxiliary scripts and tests).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer"
        User["User (Upload Combat Logs)"]:::frontend
        UI["Streamlit Web Application"]:::frontend
        User -->|"uploads_log"| UI
    end

    subgraph "Backend Processing"
        Parser["Combat Log Parser"]:::backend
        UI -->|"sends_file_for_processing"| Parser

        subgraph "Data Ingestion & Reprocessing"
            LP["load.py"]:::script
            RP["reprocess_data.py"]:::script
        end
        LP -->|"initiates_processing"| Parser
        RP -->|"initiates_processing"| Parser
    end

    subgraph "Data Storage"
        DB["Data Storage / SQLite Database"]:::db
        Parser -->|"stores_structured_data"| DB
        DB -->|"provides_query_data"| UI
    end

    subgraph "Support Tools"
        subgraph "Analysis Scripts"
            DataExp["Data Exploration Scripts"]:::script
            Utility["Utility Scripts"]:::script
        end
        DataExp -->|"supports_analysis"| Parser
        DataExp -->|"inspects_data"| DB
        Utility -->|"maintains_schema"| DB
    end

    subgraph "Testing"
        TEST1["Tests (Parser & Models)"]:::test
        TEST2["Streamlit Tests"]:::test
        TEST1 -->|"validates_parser"| Parser
        TEST2 -->|"validates_ui"| UI
    end

    %% Click Events
    click Parser "https://github.com/entropicsky/s2combatlogsql/tree/main/smite_parser/"
    click LP "https://github.com/entropicsky/s2combatlogsql/blob/main/load.py"
    click RP "https://github.com/entropicsky/s2combatlogsql/blob/main/reprocess_data.py"
    click DataExp "https://github.com/entropicsky/s2combatlogsql/tree/main/data_explore/"
    click Utility "https://github.com/entropicsky/s2combatlogsql/tree/main/scripts/"
    click DB "https://github.com/entropicsky/s2combatlogsql/blob/main/agent_notes/SQLite.sql"
    click UI "https://github.com/entropicsky/s2combatlogsql/tree/main/streamlit/"
    click TEST1 "https://github.com/entropicsky/s2combatlogsql/tree/main/tests/"
    click TEST2 "https://github.com/entropicsky/s2combatlogsql/tree/main/streamlit/tests/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef db fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef script fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef test fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
```
