# surendar-s290707/chessie architecture

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

- Interactive diagram: https://gitdiagram.com/surendar-s290707/chessie
- Repository: https://github.com/surendar-s290707/chessie

## Overview

Chessie is a Flask-based personal chess analytics application. A player submits a Chess.com username and filters; the server fetches matching games, parses their PGNs, computes opening and behavioral summaries, and renders an interactive report. Opening lookup uses the bundled TSV book. The code also exposes position-tree and next-move exploration. The excerpts show the main analysis and parts of the web flow; details of omitted routes and the template’s wiring are uncertain, so those connections are not inferred.

Main entry points: [`app.py`](https://github.com/surendar-s290707/chessie/blob/main/app.py) (Web routes), [`chessie.py`](https://github.com/surendar-s290707/chessie/blob/main/chessie.py) (PGN game analysis), [`openings.py`](https://github.com/surendar-s290707/chessie/blob/main/openings.py) (Opening identification), [`position_tree.py`](https://github.com/surendar-s290707/chessie/blob/main/position_tree.py) (Position tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Web routes<br/>[app.py]"]
  node_report["Interactive report<br/>[app.py]"]
  node_charts["Report charts<br/>[app.py]"]
end

subgraph group_analysis["Game analysis"]
  node_game_fetch["Game retrieval and filters<br/>[chessie.py]"]
  node_pgn_analysis["PGN game analysis<br/>[chessie.py]"]
  node_opening_lookup["Opening identification<br/>[openings.py]"]
  node_opening_results["Opening statistics<br/>[chessie.py]"]
  node_behavior_metrics["Behavior metrics<br/>[chessie.py]"]
end

subgraph group_exploration["Position exploration"]
  node_position_tree["Position tree<br/>[position_tree.py]"]
  node_next_moves["Next-move counts<br/>[explorer.py]"]
end

subgraph group_reference["Opening reference"]
  node_opening_book["Opening reference data<br/>[a.tsv]"]
end

node_player(("Chess player"))
node_chess_api["Chess.com API"]

node_player -->|"submits filters"| node_flask
node_flask -->|"requests analysis"| node_game_fetch
node_game_fetch -->|"fetches archives"| node_chess_api
node_game_fetch -->|"passes games"| node_pgn_analysis
node_pgn_analysis -->|"matches moves"| node_opening_lookup
node_opening_lookup -->|"reads book"| node_opening_book
node_pgn_analysis -->|"aggregates results"| node_opening_results
node_pgn_analysis -->|"computes metrics"| node_behavior_metrics
node_flask -->|"renders results"| node_report
node_report -->|"displays statistics"| node_charts
node_flask -->|"builds tree"| node_position_tree
node_flask -->|"requests move counts"| node_next_moves

click node_flask "https://github.com/surendar-s290707/chessie/blob/main/app.py"
click node_report "https://github.com/surendar-s290707/chessie/blob/main/app.py"
click node_charts "https://github.com/surendar-s290707/chessie/blob/main/app.py"
click node_game_fetch "https://github.com/surendar-s290707/chessie/blob/main/chessie.py"
click node_pgn_analysis "https://github.com/surendar-s290707/chessie/blob/main/chessie.py"
click node_opening_lookup "https://github.com/surendar-s290707/chessie/blob/main/openings.py"
click node_opening_book "https://github.com/surendar-s290707/chessie/blob/main/a.tsv"
click node_opening_results "https://github.com/surendar-s290707/chessie/blob/main/chessie.py"
click node_behavior_metrics "https://github.com/surendar-s290707/chessie/blob/main/chessie.py"
click node_position_tree "https://github.com/surendar-s290707/chessie/blob/main/position_tree.py"
click node_next_moves "https://github.com/surendar-s290707/chessie/blob/main/explorer.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_flask,node_report,node_charts toneBlue
class node_game_fetch,node_pgn_analysis,node_opening_lookup,node_opening_results,node_behavior_metrics toneAmber
class node_position_tree,node_next_moves,node_chess_api toneMint
class node_opening_book toneRose
class node_player toneIndigo
```

## Components

### Web interface

- [Web routes](https://github.com/surendar-s290707/chessie/blob/main/app.py): `app.py`
- [Interactive report](https://github.com/surendar-s290707/chessie/blob/main/app.py): `app.py`
- [Report charts](https://github.com/surendar-s290707/chessie/blob/main/app.py): `app.py`

### Game analysis

- [Game retrieval and filters](https://github.com/surendar-s290707/chessie/blob/main/chessie.py): `chessie.py`
- [PGN game analysis](https://github.com/surendar-s290707/chessie/blob/main/chessie.py): `chessie.py`
- [Opening identification](https://github.com/surendar-s290707/chessie/blob/main/openings.py): `openings.py`
- [Opening statistics](https://github.com/surendar-s290707/chessie/blob/main/chessie.py): `chessie.py`
- [Behavior metrics](https://github.com/surendar-s290707/chessie/blob/main/chessie.py): `chessie.py`

### Position exploration

- [Position tree](https://github.com/surendar-s290707/chessie/blob/main/position_tree.py): `position_tree.py`
- [Next-move counts](https://github.com/surendar-s290707/chessie/blob/main/explorer.py): `explorer.py`

### Opening reference

- [Opening reference data](https://github.com/surendar-s290707/chessie/blob/main/a.tsv): `a.tsv`

### Other components

- **Chess player**
- **Chess.com API**

## Connections

- Chess player → Web routes: submits filters
- Web routes → Game retrieval and filters: requests analysis
- Game retrieval and filters → Chess.com API: fetches archives
- Game retrieval and filters → PGN game analysis: passes games
- PGN game analysis → Opening identification: matches moves
- Opening identification → Opening reference data: reads book
- PGN game analysis → Opening statistics: aggregates results
- PGN game analysis → Behavior metrics: computes metrics
- Web routes → Interactive report: renders results
- Interactive report → Report charts: displays statistics
- Web routes → Position tree: builds tree
- Web routes → Next-move counts: requests move counts
