# kennethadriann/vlml architecture

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

- Interactive diagram: https://gitdiagram.com/kennethadriann/vlml
- Repository: https://github.com/kennethadriann/vlml

## Overview

VLML turns GRID event exports into a DuckDB analytics model, then exposes structured metrics and reports through an MCP server for AI clients. The principal workflow is raw-event acquisition, parsing and loading, transformation into analytics tables, and report or SQL queries against that model. Distinct report modules cover match analysis, player profiles, scouting, and pattern detection. Edges reflect the pipeline orchestration and source-index references; some implementation details were not sampled, so uncertain links are omitted.

Main entry points: [`src/vlml/client/grid_client.py`](https://github.com/kennethadriann/vlml/blob/main/src/vlml/client/grid_client.py) (GRID GraphQL client), [`database/scripts/orchestration/run_pipeline.py`](https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/run_pipeline.py) (Pipeline orchestration), [`src/vlml/tools/insights_tools.py`](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/insights_tools.py) (Insight tool routing), [`src/vlml/db/manager.py`](https://github.com/kennethadriann/vlml/blob/main/src/vlml/db/manager.py) (DuckDB analytics store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_event_download["Event downloads"]
  node_raw_fetch["Raw event acquisition"]
  node_parsers["Event parsers<br/>[parsers.py]"]
  node_classifiers["Event classifiers<br/>[classifiers.py]"]
  node_db_loader["Atomic event loader<br/>[db_loader.py]"]
  node_load_data["Raw data loading<br/>[load_data.py]"]
end

subgraph group_modeling["Analytics modeling"]
  node_pipeline["Pipeline orchestration<br/>[run_pipeline.py]"]
  node_schema["Schema initialization<br/>[init_schema.py]"]
  node_transform["Table transformations"]
  node_event_db[("DuckDB analytics store<br/>[manager.py]")]
end

subgraph group_interface["MCP interface"]
  node_server["MCP server<br/>[server.py]"]
  node_tool_router["Insight tool routing<br/>[insights_tools.py]"]
  node_sql_tools["SQL and database tools<br/>[db_query_tools.py]"]
end

subgraph group_analytics["Analytics and reports"]
  node_data_fetch["Shared data access<br/>[data_fetch.py]"]
  node_metrics["Metric utilities<br/>[metrics.py]"]
  node_match_report["Match analysis<br/>[match_analysis.py]"]
  node_player_report["Player profiling<br/>[player_profile.py]"]
  node_scouting_report["Scouting reports<br/>[scouting.py]"]
  node_pattern_report["Pattern detection"]
end

subgraph group_grid["GRID data access"]
  node_grid_client["GRID GraphQL client<br/>[grid_client.py]"]
  node_grid_queries["GRID query definitions<br/>[queries.py]"]
  node_team_tools["Team lookup tools<br/>[team_tools.py]"]
  node_player_tools["Player lookup tools<br/>[player_tools.py]"]
  node_tournament_tools["Tournament lookup tools"]
end

node_operator(("Pipeline operator"))
node_ai_client(("AI tool client"))
node_grid_service{{"GRID APIs"}}

node_operator -->|"runs pipeline"| node_pipeline
node_pipeline -->|"initializes schema"| node_schema
node_pipeline -->|"loads data"| node_load_data
node_pipeline -->|"runs transforms"| node_transform
node_pipeline -->|"validates and reads"| node_event_db
node_raw_fetch -->|"downloads events"| node_event_download
node_raw_fetch -->|"queries metadata"| node_grid_client
node_event_download -.->|"fetches files"| node_grid_service
node_grid_client -->|"sends GraphQL"| node_grid_service
node_grid_client -.->|"executes queries"| node_grid_queries
node_load_data -->|"loads raw data"| node_db_loader
node_db_loader -->|"uses parsers"| node_parsers
node_db_loader -->|"uses classifiers"| node_classifiers
node_db_loader -.->|"writes events"| node_event_db
node_transform -.->|"transforms tables"| node_event_db
node_ai_client -->|"invokes tools"| node_server
node_server -->|"dispatches insights"| node_tool_router
node_server -->|"dispatches SQL"| node_sql_tools
node_tool_router -.->|"routes reports"| node_match_report
node_tool_router -.->|"routes reports"| node_player_report
node_tool_router -.->|"routes reports"| node_scouting_report
node_tool_router -.->|"routes reports"| node_pattern_report
node_sql_tools -->|"queries database"| node_event_db
node_match_report -->|"uses shared fetches"| node_data_fetch
node_player_report -->|"uses shared fetches"| node_data_fetch
node_data_fetch -->|"queries analytics"| node_event_db
node_data_fetch -->|"uses SQL helpers"| node_metrics
node_pattern_report -->|"reuses analysis"| node_match_report
node_pattern_report -->|"reuses profiling"| node_player_report
node_team_tools -->|"queries GRID"| node_grid_client
node_team_tools -->|"uses query definitions"| node_grid_queries
node_player_tools -->|"queries GRID"| node_grid_client
node_tournament_tools -->|"queries GRID"| node_grid_client
node_tournament_tools -->|"uses query definitions"| node_grid_queries

click node_event_download "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/file_download_client.py"
click node_raw_fetch "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/download_raw_events.py"
click node_parsers "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/parsers.py"
click node_classifiers "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/classifiers.py"
click node_db_loader "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/db_loader.py"
click node_load_data "https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/load_data.py"
click node_pipeline "https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/run_pipeline.py"
click node_schema "https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/init_schema.py"
click node_transform "https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/run_transformations.py"
click node_event_db "https://github.com/kennethadriann/vlml/blob/main/src/vlml/db/manager.py"
click node_server "https://github.com/kennethadriann/vlml/blob/main/src/vlml/server.py"
click node_tool_router "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/insights_tools.py"
click node_sql_tools "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/db_query_tools.py"
click node_data_fetch "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/common/data_fetch.py"
click node_metrics "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/common/metrics.py"
click node_match_report "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/match_analysis.py"
click node_player_report "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/player_profile.py"
click node_scouting_report "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/scouting.py"
click node_pattern_report "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/pattern_detection.py"
click node_grid_client "https://github.com/kennethadriann/vlml/blob/main/src/vlml/client/grid_client.py"
click node_grid_queries "https://github.com/kennethadriann/vlml/blob/main/src/vlml/client/queries.py"
click node_team_tools "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/team_tools.py"
click node_player_tools "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/player_tools.py"
click node_tournament_tools "https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/tournament_tools.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_event_download,node_raw_fetch,node_parsers,node_classifiers,node_db_loader,node_load_data,node_ai_client toneBlue
class node_pipeline,node_schema,node_transform,node_event_db toneAmber
class node_server,node_tool_router,node_sql_tools,node_grid_service toneMint
class node_data_fetch,node_metrics,node_match_report,node_player_report,node_scouting_report,node_pattern_report toneRose
class node_grid_client,node_grid_queries,node_team_tools,node_player_tools,node_tournament_tools,node_operator toneIndigo
```

## Components

### Data acquisition

- [Event downloads](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/file_download_client.py): `database/scripts/ingestion/file_download_client.py`
- [Raw event acquisition](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/download_raw_events.py): `database/scripts/ingestion/download_raw_events.py`
- [Event parsers](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/parsers.py): `database/scripts/ingestion/parsers.py`
- [Event classifiers](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/classifiers.py): `database/scripts/ingestion/classifiers.py`
- [Atomic event loader](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/db_loader.py): `database/scripts/ingestion/db_loader.py`
- [Raw data loading](https://github.com/kennethadriann/vlml/blob/main/database/scripts/ingestion/load_data.py): `database/scripts/ingestion/load_data.py`

### Analytics modeling

- [Pipeline orchestration](https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/run_pipeline.py): `database/scripts/orchestration/run_pipeline.py`
- [Schema initialization](https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/init_schema.py): `database/scripts/orchestration/init_schema.py`
- [Table transformations](https://github.com/kennethadriann/vlml/blob/main/database/scripts/orchestration/run_transformations.py): `database/scripts/orchestration/run_transformations.py`
- [DuckDB analytics store](https://github.com/kennethadriann/vlml/blob/main/src/vlml/db/manager.py): `src/vlml/db/manager.py`

### MCP interface

- [MCP server](https://github.com/kennethadriann/vlml/blob/main/src/vlml/server.py): `src/vlml/server.py`
- [Insight tool routing](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/insights_tools.py): `src/vlml/tools/insights_tools.py`
- [SQL and database tools](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/db_query_tools.py): `src/vlml/tools/db_query_tools.py`

### Analytics and reports

- [Shared data access](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/common/data_fetch.py): `src/vlml/tools/common/data_fetch.py`
- [Metric utilities](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/common/metrics.py): `src/vlml/tools/common/metrics.py`
- [Match analysis](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/match_analysis.py): `src/vlml/tools/reports/match_analysis.py`
- [Player profiling](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/player_profile.py): `src/vlml/tools/reports/player_profile.py`
- [Scouting reports](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/scouting.py): `src/vlml/tools/reports/scouting.py`
- [Pattern detection](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/reports/pattern_detection.py): `src/vlml/tools/reports/pattern_detection.py`

### GRID data access

- [GRID GraphQL client](https://github.com/kennethadriann/vlml/blob/main/src/vlml/client/grid_client.py): `src/vlml/client/grid_client.py`
- [GRID query definitions](https://github.com/kennethadriann/vlml/blob/main/src/vlml/client/queries.py): `src/vlml/client/queries.py`
- [Team lookup tools](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/team_tools.py): `src/vlml/tools/team_tools.py`
- [Player lookup tools](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/player_tools.py): `src/vlml/tools/player_tools.py`
- [Tournament lookup tools](https://github.com/kennethadriann/vlml/blob/main/src/vlml/tools/tournament_tools.py): `src/vlml/tools/tournament_tools.py`

### Other components

- **Pipeline operator**
- **AI tool client**
- **GRID APIs**

## Connections

- Pipeline operator → Pipeline orchestration: runs pipeline (evidence: `database/scripts/orchestration/run_pipeline.py`)
- Pipeline orchestration → Schema initialization: initializes schema (evidence: `database/scripts/orchestration/run_pipeline.py`)
- Pipeline orchestration → Raw data loading: loads data (evidence: `database/scripts/orchestration/run_pipeline.py`)
- Pipeline orchestration → Table transformations: runs transforms (evidence: `database/scripts/orchestration/run_pipeline.py`)
- Pipeline orchestration → DuckDB analytics store: validates and reads (evidence: `database/scripts/orchestration/run_pipeline.py`)
- Raw event acquisition → Event downloads: downloads events (evidence: `database/scripts/ingestion/download_raw_events.py`)
- Raw event acquisition → GRID GraphQL client: queries metadata (evidence: `database/scripts/ingestion/download_raw_events.py`)
- Event downloads → GRID APIs: fetches files
- GRID GraphQL client → GRID APIs: sends GraphQL (evidence: `src/vlml/client/grid_client.py`)
- GRID GraphQL client → GRID query definitions: executes queries
- Raw data loading → Atomic event loader: loads raw data (evidence: `database/scripts/ingestion/load_data.py`)
- Atomic event loader → Event parsers: uses parsers (evidence: `database/scripts/ingestion/db_loader.py`)
- Atomic event loader → Event classifiers: uses classifiers (evidence: `database/scripts/ingestion/db_loader.py`)
- Atomic event loader → DuckDB analytics store: writes events
- Table transformations → DuckDB analytics store: transforms tables
- AI tool client → MCP server: invokes tools (evidence: `README.md`)
- MCP server → Insight tool routing: dispatches insights (evidence: `src/vlml/server.py`)
- MCP server → SQL and database tools: dispatches SQL (evidence: `src/vlml/server.py`)
- Insight tool routing → Match analysis: routes reports
- Insight tool routing → Player profiling: routes reports
- Insight tool routing → Scouting reports: routes reports
- Insight tool routing → Pattern detection: routes reports
- SQL and database tools → DuckDB analytics store: queries database (evidence: `src/vlml/tools/db_query_tools.py`)
- Match analysis → Shared data access: uses shared fetches (evidence: `src/vlml/tools/reports/match_analysis.py`)
- Player profiling → Shared data access: uses shared fetches (evidence: `src/vlml/tools/reports/player_profile.py`)
- Shared data access → DuckDB analytics store: queries analytics (evidence: `src/vlml/tools/common/data_fetch.py`)
- Shared data access → Metric utilities: uses SQL helpers (evidence: `src/vlml/tools/common/data_fetch.py`)
- Pattern detection → Match analysis: reuses analysis (evidence: `src/vlml/tools/reports/pattern_detection.py`)
- Pattern detection → Player profiling: reuses profiling (evidence: `src/vlml/tools/reports/pattern_detection.py`)
- Team lookup tools → GRID GraphQL client: queries GRID (evidence: `src/vlml/tools/team_tools.py`)
- Team lookup tools → GRID query definitions: uses query definitions (evidence: `src/vlml/tools/team_tools.py`)
- Player lookup tools → GRID GraphQL client: queries GRID (evidence: `src/vlml/tools/player_tools.py`)
- Tournament lookup tools → GRID GraphQL client: queries GRID (evidence: `src/vlml/tools/tournament_tools.py`)
- Tournament lookup tools → GRID query definitions: uses query definitions (evidence: `src/vlml/tools/tournament_tools.py`)
