A Django-based web application that uses Q-learning algorithms to rank suppliers based on various performance metrics. This intelligent system learns from supplier interactions and performance data to optimize supplier selection for businesses.
- Intelligent Supplier Ranking: Utilizes reinforcement learning (Q-learning) to rank suppliers based on historical performance
- Performance Metrics Tracking: Monitor supplier performance across multiple dimensions
- Data-Driven Decisions: Make informed supplier selection decisions based on automated analysis
- REST API: Access ranking data and analytics through a comprehensive API
- Admin Dashboard: Manage suppliers and view performance analytics through a user-friendly interface
- Backend: Django 5.2
- Database: PostgreSQL
- Machine Learning: Q-learning implemented with NumPy and Pandas
- Data Visualization: Matplotlib
- Python 3.9 or higher
- PostgreSQL
- Virtual environment (recommended)
-
Clone the repository
git clone https://github.com/IASSCMS/supplier-ranking-service.git cd supplier-ranking-service -
Create and activate a virtual environment
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
cp .env.example .env
Edit the
.envfile and replace placeholder values with your actual configuration:- Generate a new Django secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())" - Configure database settings
- Set DEBUG mode appropriately
- Generate a new Django secret key:
-
Apply migrations
python manage.py makemigrations python manage.py migrate
-
Create a superuser (admin)
python manage.py createsuperuser
-
Run the development server
python manage.py runserver
Visit http://127.0.0.1:8000/ in your browser to access the application.
Access the admin interface at http://127.0.0.1:8000/admin/ to:
- Manage suppliers
- View performance metrics
- Configure ranking parameters
- Monitor system learning
/api/suppliers/- List all suppliers/api/suppliers/{id}/- Get specific supplier details/api/rankings/- Get current supplier rankings/api/metrics/- View performance metrics
The supplier ranking service implements a reinforcement learning approach using Q-learning. The algorithm:
- Evaluates supplier actions as states
- Assigns rewards based on performance metrics
- Updates Q-values to optimize future supplier selection
- Ranks suppliers based on their Q-values
Key metrics used in the learning process include:
- Delivery time performance
- Quality consistency
- Price competitiveness
- Responsiveness
- Compliance with requirements
pytestThis project follows PEP 8 style guidelines. To check code style:
flake8For production deployment:
- Set
DEBUG=Falsein.env - Configure proper database settings
- Set up a production-ready web server (e.g., Gunicorn)
- Use a reverse proxy (e.g., Nginx)
- Set up static files serving
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Django community for the excellent web framework
- Reinforcement learning resources and research papers on supplier evaluation