A modern, responsive web application for visualizing cricket player statistics with interactive charts and comprehensive data analysis.
Project/
├── cricguru/ # Core cricket data module
│ ├── __init__.py
│ ├── player.py # Player statistics extraction
│ ├── player_search.py # Player search functionality
│ ├── scraper.py # Web scraping utilities
│ ├── team.py # Team-related functions
│ ├── app.py # Standalone Flask app (optional)
│ ├── README.md # Module documentation
│ └── LICENSE.md # License information
│
├── backend/ # Flask API server
│ ├── app.py # Main Flask application
│ └── requirements.txt # Python dependencies
│
└── frontend/ # Web interface
├── index.html # Main HTML page
├── css/
│ └── dashboard.css # Styling and responsive design
└── js/
└── dashboard.js # Frontend logic and API communication
- Responsive Design: Works on desktop, tablet, and mobile devices
- Interactive Charts: Bar charts, doughnut charts, line graphs using Chart.js
- Real-time Search: Dynamic player lookup with live API calls
- Format Switching: Toggle between Test, ODI, and T20I statistics
- Data Tables: Sortable, searchable team-wise statistics
- Modern UI: Gradient backgrounds, animations, and smooth transitions
- REST API: Clean JSON endpoints for data retrieval
- Data Processing: Statistical calculations and data aggregation
- Error Handling: Comprehensive error responses and validation
- CORS Support: Cross-origin resource sharing for frontend integration
- Cricket Module Integration: Uses cricguru package for ESPN Cricinfo data
- Web Scraping: Extracts data from ESPN Cricinfo
- Player Statistics: Comprehensive batting, bowling, and fielding stats
- Multi-format Support: Test, ODI, and T20I cricket data
- Data Validation: Safe data conversion and error handling
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/player/{id} |
GET | Get player statistics |
/ |
GET | Serve frontend application |
{
"player_id": 253802,
"status": "success",
"formats": {
"test": {
"overview": {
"total_matches": 113,
"total_runs": 8848,
"highest_score": 254,
"batting_average": 49.15,
"centuries": 29,
"catches": 130,
"wickets": 8
},
"teams": [
{
"team": "Australia",
"matches": 30,
"runs": 2232,
"batting_average": 43.76,
"centuries": 8,
"wickets": 2,
"catches": 28
}
]
}
}
}cd backend
pip install -r requirements.txt
python app.py- Open
frontend/index.htmlin a web browser - Or access via backend server at
http://localhost:5000
- 253802 - Virat Kohli
- 28081 - MS Dhoni
- 35320 - Rohit Sharma
- 290630 - Babar Azam
- Start Backend: Run the Flask server
- Open Frontend: Access the web interface
- Search Player: Enter a player ID and click search
- Explore Data: Switch between formats and view charts
- Analyze Statistics: Use interactive tables and visualizations
- HTML5: Semantic markup and structure
- CSS3: Modern styling with flexbox and grid
- JavaScript (ES6+): Async/await, fetch API, DOM manipulation
- Chart.js: Interactive data visualizations
- DataTables: Enhanced table functionality
- Python 3.8+: Core programming language
- Flask: Web framework and API server
- Flask-CORS: Cross-origin resource sharing
- Pandas: Data manipulation and analysis
- BeautifulSoup4: HTML parsing for web scraping
- ESPN Cricinfo: Official cricket statistics database
- cricguru Package: Custom scraping and data extraction
The application is fully responsive and optimized for:
- Desktop: Full-featured dashboard with multiple charts
- Tablet: Responsive grid layout with touch-friendly controls
- Mobile: Stacked layout with simplified navigation
- Loading States: Animated spinners during data fetch
- Error Handling: User-friendly error messages
- Smooth Animations: CSS transitions and Chart.js animations
- Interactive Elements: Hover effects and click feedback
- Accessibility: Keyboard navigation and screen reader support
- Player name lookup and autocomplete
- Historical performance trends
- Team comparison features
- Match-by-match statistics
- Export functionality for data
- Real-time score updates
- Social sharing capabilities
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions:
- Check the documentation
- Review API response formats
- Ensure backend server is running
- Verify player IDs are valid ESPN Cricinfo IDs