A Flask-based web application that generates personalized learning paths based on learner profiles and preferences.
🔗 https://learning-path-generator-uf6z.onrender.com
- Captures comprehensive learner information including:
- Name and academic background
- Skills assessment
- Socio-economic context
- Learning pace preference
- Language preference
- Subject selection
- Current skill level (Beginner/Intermediate/Advanced)
- Career goals
- Rule-based path generation engine
- Subject-specific pathways (e.g., Geography, Music)
- Skill-level appropriate content sequencing
- Structured progression from fundamentals to advanced topics
- Unique user session tracking using UUID
- Persistent session storage via Flask sessions
- Cross-request user identification
- Stores all generated learning paths per user session
- Timestamp-based history organization
- Descending chronological order display
- Uses
mysql-connector-pythonfor database connectivity - Compatible with macOS without requiring MySQL development libraries
- Two main tables:
learners: Stores learner profile datalearning_paths: Stores generated paths with session tracking
- Backend Framework: Flask 3.1.2
- Database Driver: mysql-connector-python (no compilation required)
- Database: MySQL
- Template Engine: Jinja2
- Session Management: Flask sessions with UUID-based user tracking
Learning Path Project/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── templates/
│ ├── index.html # Home page with learner form
│ └── history.html # Learning path history display
└── README.md # Project documentation
- Python 3.x installed
- MySQL server running locally
- Database
learning_path_dbcreated in MySQL
pip install -r requirements.txtRequired packages:
- flask==3.1.2
- mysql-connector-python
- jinja2==3.1.6
- werkzeug==3.1.3
- itsdangerous==2.2.0
- blinker==1.9.0
- click==8.3.0
- colorama==0.4.6
Ensure your MySQL server is running and the database exists:
CREATE DATABASE learning_path_db;Update database credentials in app.py (lines 11-15):
def get_db_connection():
conn = mysql.connector.connect(
host="localhost",
user="root", # Your MySQL username
password="DB Passwords", # Your MySQL password
database="learning_path_db"
)
return connRun the following SQL commands to create required tables:
CREATE TABLE learners (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
academic TEXT,
skills TEXT,
socio_context TEXT,
learning_pace VARCHAR(50),
language VARCHAR(50),
subject VARCHAR(100),
skill_level VARCHAR(50),
career_goal TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE learning_paths (
id INT AUTO_INCREMENT PRIMARY KEY,
learner_id INT,
path TEXT,
session_id VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (learner_id) REFERENCES learners(id) ON DELETE CASCADE
);python app.pyThe application will start on http://localhost:5000
- User fills out a comprehensive learner profile form
- Data is submitted via POST to
/save_learner
- Receives JSON data from the frontend
- Creates/retrieves user session using UUID
- Inserts learner profile into
learnerstable - Calls
generate_learning_path()function - Stores generated path in
learning_pathstable - Returns the generated learning path as JSON
The generate_learning_path(subject, skill_level) function:
- Takes subject and skill level as inputs
- Applies rule-based logic for different subjects
- Generates 6-step sequential learning paths
- Returns path as arrow-separated string (e.g., "Topic 1 → Topic 2 → ...")
Example Paths:
Geography - Beginner:
Introduction to Geography → Map Reading Basics → Physical Geography →
Human Geography → Basic GIS Tools → Practice Projects
Music - All Levels:
Music Theory Basics → Instrument Practice → Rhythm and Timing →
Composition Basics → Music Production Tools → Performance Practice
- Retrieves all learning paths for current session
- Displays paths in descending order of creation time
- Shows timestamp for each generated path
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Home page with learner form |
/save_learner |
POST | Save learner data and generate path |
/history |
GET | View learning path history |
- Each user gets a unique UUID stored in Flask session
- Session persists across requests during browser session
- Learning paths are linked to session ID for history tracking
- Secret key configured in
app.secret_key
def get_db_connection():
conn = mysql.connector.connect(
host="localhost",
user="root",
password="Hardik@9981",
database="learning_path_db"
)
return conn- Supports multiple subjects with differentiated paths
- Three difficulty levels (beginner/intermediate/advanced)
- Fallback generic path for unsupported subjects
if "user_id" not in session:
session["user_id"] = str(uuid.uuid4())✅ No Compilation Required: Uses pure Python MySQL driver
✅ macOS Compatible: No need for MySQL development libraries
✅ Session Tracking: Persistent user identification across requests
✅ History Feature: Users can view past learning paths
✅ Extensible: Easy to add new subjects and difficulty levels
✅ Structured Data: Normalized database schema with foreign keys
- Add more subjects and specialized learning paths
- Implement AI-based path personalization
- User authentication and persistent profiles
- Progress tracking for completed steps
- Resource recommendations for each step
- Export learning paths as PDF
- Admin dashboard for managing paths
- RESTful API for mobile app integration
If you see connection errors:
- Verify MySQL server is running
- Check username/password in
get_db_connection() - Ensure database
learning_path_dbexists - Confirm MySQL is listening on localhost
Make sure app.secret_key is set in the Flask app configuration.
Install all dependencies:
pip install -r requirements.txtThis project is open-source and available for educational purposes.
Author: Hardik Kumar For questions or contributions, please reach out to the project maintainer.



