This project automates the process of fetching, grading, and evaluating student submissions from Google Classroom. Using Google APIs, it retrieves assignments, submissions, and associated files, grades them using an AI model, and generates reports.
- Fetch Courses: Automatically lists all courses from your Google Classroom.
- Retrieve Assignments: Fetches all assignments and their details for each course.
- Download Submissions: Downloads student submissions (PDF format) for evaluation.
- Automated Grading: Grades submissions based on the assignment requirements using an AI-powered evaluation model.
- Feedback Generation: Provides feedback, including strengths, areas for improvement, and remarks.
- Report Export: Saves grading data to Excel files for further analysis.
pandas
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
PyPDF2
langchain
faiss-cpu
pydantic
groq
-
Google API Setup:
- Enable the Google Classroom and Google Drive APIs.
- Download your
credentials.json
file.
-
Environment Variables:
- Set the
GROQ_API_KEY
in your environment for AI-based evaluation.
- Set the
-
Install Dependencies:
pip install -r requirements.txt
The following OAuth 2.0 scopes are used:
https://www.googleapis.com/auth/classroom.courses
https://www.googleapis.com/auth/classroom.coursework.me
https://www.googleapis.com/auth/classroom.student-submissions.me.readonly
https://www.googleapis.com/auth/classroom.student-submissions.students.readonly
https://www.googleapis.com/auth/classroom.announcements.readonly
https://www.googleapis.com/auth/drive.readonly
-
Authenticate Google Account:
- On the first run, the script will guide you through authenticating your Google account and generating a
token.pickle
file for subsequent use.
- On the first run, the script will guide you through authenticating your Google account and generating a
-
Execute the Script:
python main.py
-
Process Flow:
- Lists courses.
- Fetches assignments for each course.
- Downloads student submissions for assignments.
- Evaluates the submissions using an AI model.
- Saves results to an Excel file.
- Authenticates and initializes Google Classroom and Drive APIs.
- Fetches courses and processes assignments and submissions.
- Retrieves assignments for a given course.
- Fetches and evaluates submissions for each assignment.
- Downloads student submissions from Google Drive.
- Grades submissions and generates feedback using AI.
- Saves results to an Excel file.
- Downloads a student's submission file from Google Drive.
- Exports submission data, including grades and feedback, to an Excel file.
- Building FAISS Index: Parses and indexes submission content using the
CharacterTextSplitter
andSentenceTransformerEmbeddings
. - Excerpts Retrieval: Retrieves relevant excerpts for evaluation based on the assignment description.
- Grading and Feedback: Uses the Groq AI client to evaluate the submission and generate feedback.
- Combines the entire workflow of indexing, retrieval, and evaluation to grade student submissions.
project/
├── credentials.json # Google API credentials
├── token.pickle # Cached Google API credentials
├── downloads/ # Directory for downloaded files
├── faiss_index/ # Directory for FAISS index files
├── main.py # Main script
├── evaluate_submission.py # AI evaluation logic
├── requirements.txt # Python dependencies
- Console Logs: Detailed logs showing progress (e.g., courses fetched, assignments processed, submissions evaluated).
- Excel Reports: Saved in the format
submissions_<assignment_id>.xlsx
containing the following columns:- Student ID
- Submission State
- Grade
- Remarks
- Strengths
- Areas of Improvement
- Ensure valid Google API credentials are in place (
credentials.json
). - Use the
GROQ_API_KEY
for AI model-based evaluation. - Handle exceptions (e.g., missing files, invalid tokens) for a seamless experience.
- Add support for real-time notifications of submission evaluations.
- Extend grading logic to handle non-PDF submissions.
- Integrate more advanced AI models for feedback.
This project is licensed under the MIT License.