daemon03/Gale_shapely
1
๐ Roommate Allocation System โ Python & Streamlit Edition
  
A modern Streamlit UI for the Gale-Shapley Roommate Allocation algorithm. This version uses Python for the algorithm and file-system storage (JSON) instead of MySQL.
๐ For the original C + MySQL version, see: https://github.com/Harshwardhan-Deshmukh03/Roommate-allocation-using-Gale-Shapley-Algorithm.git
โจ Features
- Stable Matching via the Nobel Prize-winning Gale-Shapley algorithm
- Two-Stage Allocation: Roommate matching โ CGPA-ranked room assignment
- CSV Import: Bulk-upload students & rooms via CSV files
- File-System Storage: No database needed โ data stored as JSON
- Interactive Charts: Plotly visualizations of CGPA distributions
- Premium UI: Dark theme with glassmorphism, gradients, and animations
๐ Quick Start
# 1. Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # macOS/Linux
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the app
streamlit run app.py๐ Project Structure
streamlit_gale_shapely/
โโโ app.py # Main Streamlit UI application
โโโ gale_shapley.py # Gale-Shapley algorithm (Python port)
โโโ db.py # File-system database layer (JSON)
โโโ requirements.txt # Python dependencies
โโโ .streamlit/
โ โโโ config.toml # Streamlit theme configuration
โโโ data/
โ โโโ students.json # Student records (replaces MySQL 'main' table)
โ โโโ rooms.json # Room records (replaces MySQL 'RoomNum' table)
โ โโโ allocations.json # Allocation results
โโโ sample_csv/
โโโ sample_students_10.csv # 10 students (5 pairs)
โโโ sample_rooms_5.csv # 5 rooms for 10 students
โโโ sample_students_26.csv # 26 students (13 pairs)
โโโ sample_rooms_13.csv # 13 rooms for 26 students๐ CSV Format
Students CSV
Rooms CSV
๐ง Algorithm
- Stage 1 โ Roommate Matching: Gale-Shapley pairs students into stable roommate matches.
- Stage 2 โ Room Allocation: Pairs ranked by max CGPA select rooms via Gale-Shapley.
Higher CGPA pairs get priority in room selection.
