How scodive/matchpredict works
Project Type and Purpose
• This is a predictive analytics tool for football (soccer) matches. It gathers historical data, processes and calculates key performance indicators (features), and applies statistical prediction models (using SciPy’s Poisson distribution and optional Scikit-learn models) to forecast match outcomes and recommend bets.
• The system supports both command-line usage and a web-based interactive interface (see “app.py”, “index.html”, “js/” folder).
Main Components
a. Data Ingestion & Collection:
• Modules: data_collection.py, collect_league_data.py
• Data Sources: CSV/JSON files in the data/ directory (including raw match and team data, odds data, and pre-processed features).
• Function: Retrieve historical match data from APIs or local files and cache/store them.
b. Data Processing & Feature Engineering:
• Modules: data_processing.py, feature_engineering.py, convert_csv_to_json.py
• Data Flow: Raw CSV/JSON data → Feature extraction & transformation → Derived datasets for predictions.
• Use of libraries like Pandas and NumPy.
c. Prediction Engine:
• Prediction Scripts: match.py, parlay_predictor.py, models.py, match_predictor.py (if applicable from the sample structure in README).
• A component for odds analysis and value bets calculation.
d. Web/API Interface:
• Files: app.py (Flask-based API server), index.html, js/ (JavaScript files) and style.css.
• Function: Provides an interactive front end for users to input match parameters and view predictions.
• Deployment instructions with Gunicorn and Nginx (as detailed in README).
e. Configuration & Utility Services:
• Files: config.py (for configuration settings), __pycache__, and next.config.js (suggesting potential integration with Next.js for frontend, or configuration for deployment).
• Purpose: Manage settings for data sources, thresholds, and model configuration.
Relationships and Interactions
• Data flows from the “data/” directory (and external APIs) into the Data Processing module.
• The Feature Engineering layer transforms and cleans data which is then fed into the Prediction Engine.
• The Prediction Engine (executed via command-line scripts like match.py or parlay_predictor.py) provides outputs that are either rendered on a web interface (via app.py and static files like index.html, js/app.js) or returned as JSON responses for API calls.
• The configuration layer (config.py) provides global settings, and deployment scripts (e.g., Dockerfile, next.config.js, and deployment instructions in the README) orchestrate the environment.
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly separates data collection, data processing, prediction logic, and user interaction into distinct scripts and modules.
• Modularity & Reusability: Each script (or module) is responsible for a specific function, making it easier to maintain and upgrade (for instance, feature engineering is separated from prediction logic).
• Scalability & Deployment: The use of Docker, Flask, and Gunicorn indicates a design that can be scaled for production deployments. The static assets (HTML/CSS/JS) are kept separate from the backend logic.