
This project provides a web application for analyzing and visualizing FC Barcelona's match data. The application is built with Streamlit, scrapes match data from WhoScored, processes and stores it in MongoDB, and displays it in a streamlined dashboard.
-
Data Scraping: Scrapes FC Barcelona's match data from WhoScored.
-
MongoDB Storage: Stores all match, team, player, and event data in MongoDB.
-
Data Visualization: Interactive visualizations including:
- Pass networks
- Shot maps
- Match momentum
- Team statistics
- Player Statistics: Detailed stats for each player, including goals, assists, pass accuracy, and more.
- Competition Summary: Summary statistics for each competition, such as total matches played, wins, goals scored, and key performance metrics.
-
Streamlit Interface: Simple and interactive web dashboard for viewing and analyzing match data.
- Python 3.7+
- MongoDB instance
- Chrome WebDriver (for Selenium)
-
Clone the repository:
git clone https://github.com/MahmoudNamNam/FC-Barcelona-Reports cd FC-Barcelona-Reports
-
Set up environment variables:
-
Create a
.env
file in the project root and add your MongoDB URI:MONGO_URI="your_mongodb_connection_string"
-
-
Install dependencies:
pip install -r requirements.txt
To scrape data and add it to your MongoDB, run:
python scraper.py
- This script only scrapes new matches not already in the database.
To launch the dashboard, run:
streamlit run dashboard.py
- Access the dashboard at http://localhost:8501.
scraper.py
: Web scraping script that fetches match data from WhoScored.data_loader.py
: Loads data from MongoDB into DataFrames.dashboard.py
: Streamlit app for displaying match data.visualizations.py
: Functions for visualizations used in the app.utilities.py
: Helper functions and utilities for data processing and analysis.config.toml
: Configuration for Streamlit app styling..env
: Environment variables.
Dependencies listed in requirements.txt
:
- pandas
- numpy
- selenium
- pymongo
- beautifulsoup4
- streamlit
- mplsoccer
- matplotlib
- python-dotenv
- Environment Variables: Ensure
.env
is added to.gitignore
to keep credentials secure. - Chrome WebDriver: Ensure compatibility with your Chrome version. You may need to update the
webdriver.Chrome()
configuration inscraper.py
based on your setup.
- Add support for other teams or leagues.
- Include more advanced visualizations and analytics.
- Enable user authentication to save and share custom reports.