A comprehensive web application for organizing badminton tournaments, tracking player statistics, and analyzing game results.
Developer: Leran Peng(23909531), Andrew Mekhail (23775973), Dennis Chuo (23863534), Will Craig (23180621)
Badminton MASTER allows tournament organizers to easily analyse and calculate key data of their hosted tournaments.
Users can upload match data via CSV or input results through the web interface, then access analytics to track player performance, view match statistics, and share tournament data with other users.
- Player Management: Register and manage player profiles
- Tournament Creation: Set up new tournaments with customizable settings
- Match Recording: Input match results with flexible scoring formats
- Data Import/Export: Upload and download tournament data via CSV
- Results Sharing: Share tournament results with other user accounts
- Player Statistics: View detailed performance metrics and match history
- Tournament Standings: Access tournament brackets and results
- Head-to-Head Analysis: Compare performance between any two players
- Match History: Review past match details and outcomes
- Beautiful Frontend: Modern UI with Bootstrap framework
- Server-side Rendering: Fast performance with Flask and Jinja templates
- Robust Backend: Python with Flask for reliable processing
- Secure Authentication: User account system with password protection
- Admin Controls: Special admin accounts for system management
- Python 3.8 or higher
- Pip package manager
- SQLite (included with Python)
View detailed installation instructions
- Clone the repository:
git clone https://github.com/LeranPeng/AgilWebDev2025.git
cd AgilWebDev2025- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Initialize the admin user(optional):
python admin_init.pyWe have an admin panel to manage all matches, users, and tournaments. But it's fine to sign up as an user.
- Run the application:
python app.py- Access the application in your browser at
http://localhost:5000
-
Manual Data Entry:
- Use the Input Form to add tournament details and match results
- Specify match types (Singles, Doubles, Mixed)
- Enter scores in standard format (e.g., "21-19, 19-21, 21-18")
-
Post-Tournament Results:
- Upload match results using CSV with required columns:
- Team 1, Team 2, Score 1, Score 2, Round, Match Type
- For doubles matches, separate player names with commas
- Upload match results using CSV with required columns:
-
Pre-Tournament Setup:
- Upload player list using CSV format
- Player names must be in the first column
- Player Analytics: View detailed statistics for individual players
- Tournament Analytics: Analyze tournaments by match types, rounds, and more
- Head-to-Head: Compare any two players' performance against each other
- Overall Analysis: View system-wide statistics across all tournaments
badminton-tournament-manager/
βββ app.py # Main Flask application
βββ admin_init.py # Admin Initialization Script
βββ admin.py # Admin account functions
βββ analytics.py # Analytics module
βββ models.py # Database models
βββ requirements.txt # Project dependencies
βββ static/ # Static files (CSS, JS, images)
βββ routes/ # Python Flask backend logic for the sub pages
| βββ admin.py # functions for admin panel
β βββ analytics.py # functions for data analysis
β βββ auth.py # functions for login and signup
β βββ match.py # functions for matches
β βββ sharing.py # functions for information sharing
β βββ tournament.py # functions for tournament logic
β βββ user.py # functionality for user settings
βββ tests/
β βββ test_uploads/ # directory for unittests testing uploads
β βββ systemtests.py # System Tests
β βββ unittest.py # Unittests
βββ templates/ # HTML templates
β βββ layout.html # Base template
β βββ analytics.html
β βββ overall_analysis.html
β βββ head_to_head.html
β βββ player_analytics.html
β βββ review_results.html
β βββ tournament_analytics.html
β βββ html/ # HTML templates for main pages
β βββ 404.html
β βββ 500.html
β βββ dashboard.html
β βββ homepage.html
β βββ InputForm.html
β βββ Login.html
β βββ Signup.html
β βββ upload.html
β βββ User_settings.html
βββ README.md
βββ uploads/ # Directory for uploaded files
Application security features:
- Login required for all protected routes (everything other than "/" and "/home")
- Admin user accounts with additional protected permissions
- Session management with configurable timeout
- Password hashing and validation
- CSRF protection for all forms
- User login input data validation and sanitization
This project uses SQLite for simplicity and easy deployment. The database file is badminton.db.
- User: Stores user accounts and authentication data
- Tournament: Stores tournament details and metadata
- Player: Represents individual players in the system
- Team: Represents singles or doubles teams (links to players)
- Match: Stores match details, scores, and results
- SharedTournament: Manages tournament sharing between users
Admin accounts provide extended capabilities for managing the entire system, availiable at
View admin setup instructions
The admin functionality requires an is_admin field in the User model:
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(150), nullable=False, unique=True)
email = db.Column(db.String(150), nullable=False, unique=True)
password_hash = db.Column(db.String(256), nullable=False)
last_login = db.Column(db.DateTime, default=db.func.current_timestamp())
is_admin = db.Column(db.Boolean, default=False) # Admin status field
tournaments = db.relationship('Tournament', backref='organizer', lazy=True)For new installations, run the admin_init.py script:
python admin_init.pyFollow the prompts to create a new admin user or grant admin privileges to an existing user.
View admin features
- User Management: Create, edit, and delete users
- Tournament Management: Manage all tournaments in the system
- Player Management: Track player statistics and merge duplicates
- System Statistics: Monitor platform usage and activity
- Database Maintenance: Clean up and optimize the database
Once logged in as an admin, visit:
http://your-domain/admin
Common issues and solutions
-
Dependency errors: Make sure you're using Python 3.8+ and have updated pip
python -m pip install --upgrade pip
-
Database initialization fails: Remove the existing database file and try again
rm badminton.db
-
Login issues: If you can't log in, you may need to clear browser cookies or reset your password
-
CSV import errors: Ensure your CSV files match the expected format with correct column headers
-
Page not found errors: Check that you're accessing the correct URL and are logged in
This project is licensed under the MIT License - see the LICENSE file for details.
This file is fully generated by AI