Smart AI Study Planner is a web-based application built with Flask, MySQL, and Pandas that helps students organize their study schedules, track progress, and receive personalized recommendations.
Smart AI Study Planner This repository contains the backend code for a "Smart AI Study Planner," a Flask web application designed to help students manage their academic life. The application provides user authentication and various features to track subjects, log study hours, manage assignments, and receive personalized study recommendations and data visualizations.
Features User Authentication: Secure registration and login for students.
Subject Management: Users can add and manage their subjects, including a self-assessed difficulty level.
Study History Logging: Allows students to log their study sessions, including the subject and hours studied.
Assignment Tracking: A system to add and view upcoming assignments with due dates.
Personalized Recommendations: Provides study hour recommendations based on a student's average study time and the difficulty level of subjects, using data analysis with the pandas library.
Data Visualization: Generates chart data to visually represent a student's total study hours per subject.
Database Integration: Utilizes a MySQL database to persistently store all user and academic data.
Technologies Backend Framework: Flask
Database: MySQL
Database Connector: mysql-connector-python
Data Manipulation: pandas
Web Server Gateway Interface (WSGI): Werkzeug (Flask's dependency)
Prerequisites Before running the application, you need to have the following installed:
Python 3.x: Ensure Python is installed on your system.
MySQL Server: A running instance of a MySQL database.
Python Libraries: All required Python packages can be installed using pip.
pip install Flask mysql-connector-python pandas
Database Setup Create the Database: First, create a database named study_planner_db in your MySQL server. You can do this using the MySQL command-line client or a graphical tool like DBeaver or MySQL Workbench.
Configure database.py: Open the database.py file and update the host, user, and password variables in the create_connection function to match your MySQL server credentials.
Create Tables: Run the database.py script to create the necessary tables (Students, Subjects, Study_History, Assignments).
python database.py
How to Run the Application Clone the Repository: Download the project files.
Run the Flask App: In your terminal, navigate to the directory containing your Flask application files (app.py, database.py, etc.).
Start the Server: Execute the following command:
python app.py
Access the Application: The application will be running on http://127.0.0.1:5000. Open this URL in your web browser.
API Endpoints The backend exposes several API endpoints to handle data interaction:
POST /api/login: Authenticates a user.
POST /api/register: Registers a new user.
GET /api/subjects: Retrieves a list of subjects for the authenticated user.
POST /api/subjects: Adds a new subject for the authenticated user.
POST /api/study-history: Logs a new study session.
GET /api/assignments: Retrieves assignments for the authenticated user.
POST /api/assignments: Adds a new assignment.
GET /api/recommendations: Provides study hour recommendations based on past performance.
GET /api/chart-data: Fetches data for study hours chart visualization.
Future Enhancements Frontend Development: The project currently only includes the backend logic. A frontend (using HTML, CSS, and JavaScript) is needed to provide a complete user interface.
Improved Recommendation System: Integrate more advanced machine learning models (e.g., using scikit-learn or TensorFlow) to provide more sophisticated and accurate study recommendations.
Assignment Status Update: Add an endpoint to allow users to update the status of their assignments (e.g., from 'Pending' to 'Completed').
User Profiles: Implement a more detailed user profile system to track additional academic metrics
- 🔐 User Authentication – Secure login, registration, and session handling.
- 📊 Dashboard – Personalized student dashboard with subjects and study history.
- 📘 Subjects Management – Add subjects with difficulty levels (Easy, Medium, Hard).
- ⏳ Study History Tracking – Log study sessions with hours and dates.
- 📝 Assignments Manager – Track assignments with due dates and statuses.
- 🤖 AI Recommendations – Personalized study time suggestions based on logged sessions.
- 📈 Analytics & Charts – Visualize time spent per subject with dynamic chart data.
- 🌐 RESTful API – JSON endpoints for seamless frontend integration.
- Backend: Flask (Python)
- Database: MySQL
- Data Processing: Pandas
- Frontend Templates: HTML + Jinja2
- Authentication: Flask Sessions
The AI-powered recommendation system analyzes your study history and generates an optimal study schedule:
- Easy subjects → ~0.75× baseline study hours
- Medium subjects → ~1× baseline study hours
- Hard subjects → ~1.5× baseline study hours
Baseline study hours are calculated as the average of your past study sessions.
smart-ai-study-planner/ │── app.py # Main Flask application │── database.py # Database connection helper │── templates/ # HTML templates (login, register, dashboard) │── static/ # Static assets (CSS, JS) │── requirements.txt # Python dependencies │── README.md # Project documentation
yaml Copy code
git clone https://github.com/yourusername/smart-ai-study-planner.git
cd smart-ai-study-planner
2. Create a Virtual Environment
bash
Copy code
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows
3. Install Dependencies
bash
Copy code
pip install -r requirements.txt
4. Set Up MySQL Database
Create a new database (e.g., study_planner).
Import your schema (tables for Students, Subjects, Assignments, Study_History).
Update database.py with your MySQL credentials.
5. Run the App
bash
Copy code
python app.py
The app will run on http://127.0.0.1:5000/
🌐 API Endpoints
Authentication
POST /api/register → Register a new user
POST /api/login → Login with email & password
Subjects
GET /api/subjects → Get all subjects
POST /api/subjects → Add a new subject
Study History
POST /api/study-history → Log study hours
Assignments
GET /api/assignments → Fetch all assignments
POST /api/assignments → Add new assignment
AI Recommendations
GET /api/recommendations → Get personalized study time suggestions
Charts
GET /api/chart-data → Get chart-friendly JSON study data
🤝 Contributing
Contributions are welcome! Please fork this repo, make your changes, and submit a pull request.
📜 License
This project is licensed under the MIT License – feel free to use and modify it.