Skip to content

🧩 The ultimate dashboard for your cubing data. Import CSTimer sessions, track PB history, and see where you stand in the global WCA rankings.

License

Notifications You must be signed in to change notification settings

havl-code/speedcube-training-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Speedcube Training Explorer

A web-based speedcubing training analysis tool with WCA rankings integration. Track personal progress, analyze statistics, and compare performance against worldwide competitors.

✨ Features

πŸ“Š Core Functionality

  • Session Management: Track training sessions with solve-by-solve data
  • Multi-Event Support: 3x3, 2x2, 4x4, and all official WCA events
  • Cube Inventory: Manage and track performance by specific cubes
  • Statistics Dashboard: Real-time PB, averages, Ao5/Ao12, session counts
  • WCA Integration: Percentile rankings and estimated world rank via REST API

πŸ“ˆ Data Visualization

  • Progress tracking over time with Plotly charts
  • Solve time distribution analysis
  • Rolling averages (Ao5, Ao12)
  • Session consistency comparisons
  • Interactive charts with zoom/pan

πŸ’Ύ Import & Export

  • CSTimer JSON/TXT import with session selection
  • Preserve scrambles and penalties
  • Batch import with preview

🎨 UI Features

  • Dark/light mode with persistent preference
  • Sortable tables (sessions, solves)
  • Responsive design
  • Session filtering by event
  • Clickable stats with detail modals

πŸ› οΈ Tech Stack

Backend:

  • Python 3.13 | Flask | SQLite | Pandas
  • WCA REST API client

Frontend:

  • Vanilla JavaScript (ES6+) | Plotly.js | CSS3
  • No framework dependencies

πŸš€ Installation

# Clone repository
git clone https://github.com/havl-code/speedcube-training-explorer.git
cd speedcube-training-explorer

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Initialize database
python src/python/db_manager.py

πŸ“± Usage

Web Interface (Recommended)

python website_server.py
# Navigate to http://localhost:5000

Or via main menu:

python main.py  # Select option 1

CLI Interface

python main.py  # Select option 2 for CLI menu

# Or direct commands:
python src/python/import_cstimer.py data/raw/your_file.txt
python src/python/training_logger.py --interactive
python src/python/my_progress.py

πŸ“ Project Structure

speedcube-training-explorer/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ python/              # Backend logic
β”‚   β”‚   β”œβ”€β”€ training_logger.py
β”‚   β”‚   β”œβ”€β”€ import_cstimer.py
β”‚   β”‚   β”œβ”€β”€ wca_api_client.py
β”‚   β”‚   β”œβ”€β”€ cube_manager.py
β”‚   β”‚   └── analyzer.py
β”‚   └── web/
β”‚       β”œβ”€β”€ api/             # Flask routes (Blueprints)
β”‚       β”‚   β”œβ”€β”€ routes/
β”‚       β”‚   β”‚   β”œβ”€β”€ stats.py
β”‚       β”‚   β”‚   β”œβ”€β”€ sessions.py
β”‚       β”‚   β”‚   β”œβ”€β”€ cubes.py
β”‚       β”‚   β”‚   β”œβ”€β”€ charts.py
β”‚       β”‚   β”‚   └── imports.py
β”‚       β”‚   └── __init__.py
β”‚       β”œβ”€β”€ css/
β”‚       β”œβ”€β”€ js/
β”‚       └── index.html
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ speedcube.db         # SQLite database
β”‚   └── raw/                 # Import files
β”œβ”€β”€ website_server.py        # Flask entry point
└── requirements.txt

πŸ—„οΈ Database Schema

Tables:

  • training_sessions: Session metadata, aggregated stats
  • personal_solves: Individual solve records with timestamps
  • cubes: Cube inventory with purchase dates

Key Implementation:

  • Times stored in milliseconds (ms)
  • DNF stored as time_ms = 0, dnf = 1
  • Ao5/Ao12 calculated per WCA rules (remove best/worst)

🌐 API Endpoints

GET  /api/stats                        # Dashboard statistics
GET  /api/pb-details                   # Personal best details
GET  /api/sessions                     # All sessions
POST /api/sessions/add                 # Create session
GET  /api/sessions/<id>/solves         # Session solves
POST /api/sessions/<id>/solves/add     # Add solve
GET  /api/cubes                        # Cube inventory
GET  /api/charts/*                     # Chart data
POST /api/import/preview               # Preview import
POST /api/import/selected              # Import sessions

βœ… WCA Rules Compliance

  • DNF Handling: DNF excluded from averages, not converted to numbers
  • Ao5: Remove best/worst, average middle 3 (DNF if <3 valid)
  • Ao12: Remove best/worst, average middle 10 (DNF if <10 valid)
  • Session Mean: Average of all valid (non-DNF) solves

πŸ”§ Development

Adding New Routes

  1. Create route file in src/web/api/routes/
  2. Define Blueprint with endpoints
  3. Import in src/web/api/routes/__init__.py
  4. Register in src/web/api/__init__.py

Running Tests

python src/python/wca_api_client.py    # Test WCA API
python src/python/db_manager.py         # Verify database

πŸ“Š Data Sources

πŸ“„ License

MIT License

πŸ™ Acknowledgments

  • WCA REST API by Robin Ingelbrecht
  • CSTimer for export format compatibility
  • WCA for official competition data

πŸ‘€ Author

Viet Ha Ly

About

🧩 The ultimate dashboard for your cubing data. Import CSTimer sessions, track PB history, and see where you stand in the global WCA rankings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published