poke-tcg-analyzer

Pokémon TCG Log Analyzer

Parse Pokémon TCG Live battle logs, replay matches turn-by-turn with a reconstructed board, and aggregate meta matchup statistics across many saved games.

What it does

Layout

poke-tcg-analyzer/
  backend/
    app/
      parser.py      # raw log -> structured events + match summary
      state.py       # events -> per-event board snapshots (replay)
      archetypes.py  # deck archetype detection (curated + heuristic)
      db.py          # SQLite persistence
      stats.py       # meta analytics (performance + matchup matrix)
      main.py        # FastAPI app + serves the frontend
    tests/           # fixtures + inspection/smoke scripts
    data/matches.db  # created on first run
  frontend/          # vanilla JS single-page UI (no build step)

Run it locally

Clone the repo, then from its folder:

git clone https://github.com/h0ku-lea/poke-tcg-analyzer.git
cd poke-tcg-analyzer\backend
.\.venv\Scripts\python.exe -m uvicorn app.main:app --reload

Then open http://127.0.0.1:8000/.

(First-time setup, if the venv is missing:)

cd poke-tcg-analyzer\backend
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt

Workflow

  1. Parse & Save tab → paste a log (or choose a .txt) → Parse log.
  2. Review the summary, confirm/rename the two deck archetypes → Save match (or Preview replay to watch it without saving).
  3. Replay tab → scrub/step/play through the match.
  4. Meta tab → win rates and the matchup matrix across everything saved.
  5. Saved Matches tab → reopen or delete past matches.

Extending archetype detection

Add signatures to KNOWN_ARCHETYPES in backend/app/archetypes.py:

"My Deck Name": ["Key Pokemon ex", "Second Signature ex"],

Unrecognized decks fall back to naming after the most prominent ex / Mega ... ex Pokémon, so the tool stays useful for rogue decks.

Tests / dev checks

cd poke-tcg-analyzer\backend
.\.venv\Scripts\python.exe tests\inspect_parse.py   # parser coverage
.\.venv\Scripts\python.exe tests\inspect_state.py   # board reconstruction
.\.venv\Scripts\python.exe tests\api_smoke.py       # full API (server must be running)

Notes for going public later