---
# System prepended metadata

title: AI Grader

---

# AI Grader

### Background
The system is intended to automate the process of grading assignments by utilizing AI capabilities provided by the ChatGPT API. This automation aims to reduce manual efforts and improve consistency in grading. The user can customize the grading criteria through rubrics, and the system will evaluate assignments based on these rubrics. The results will be compiled into reports in PDF or CSV format.

### Requirements
Let's prioritize the requirements using the MoSCoW method (Must have, Should have, Could have, Won't have):

- **Must Have**
  1. User interface built with ReactJS to upload rubrics and assignments.
  2. ExpressJS backend for handling business logic.
  3. Integration with ChatGPT API for processing the content of the assignments.
  4. Ability to upload assignments as a ZIP file.
  5. Generate reports in PDF or CSV format.
  6. Choice of Firebase or MariaDB for data persistence.
  7. Authentication and authorization mechanisms to secure the application.

- **Should Have**
  1. An interface for users to define and modify rubrics.
  2. Enhanced security measures for file upload and data handling.

- **Could Have**
  1. Options for users to choose report formats.
  2. Advanced reporting features (graphs, analytics).

- **Won’t Have**
  1. Mobile app version of the system in the initial release.
  2. Real-time collaboration on rubric creation.

Let's proceed step by step to build a comprehensive Software Design Document for your system that grades assignments using the ChatGPT API. We've established the **Background** and **Requirements**. Next, we will focus on the **Method** section where we'll outline the technical architecture, including the system components, database schema, and potential algorithms.

### Method

#### Architecture Overview

The system will be divided into three main components:

1. **Frontend (Client-Side)**: Built with ReactJS, this part of the application will handle all user interactions, including the uploading of rubrics and assignments, displaying results, and managing user sessions.

2. **Backend (Server-Side)**: Developed using Express.js, the backend will manage API requests, interact with the database, handle file uploads, process data with the ChatGPT API, and generate reports.

3. **Database**: You have the choice between Firebase and MariaDB. Considering Firebase for its ease of setup and real-time data handling or MariaDB for a more traditional SQL approach will depend on your scalability needs and preference for NoSQL vs SQL.

#### Component Diagram

Here's a high-level component diagram to illustrate the system architecture:

```plantuml
@startuml
package "Frontend (ReactJS)" {
    [User Interface] as UI
    [Session Management] as Session
}

package "Backend (Express.js)" {
    [File Handling]
    [Rubric Management]
    [Assignment Processing]
    [Report Generation]
    [API Integration] as ChatGPT
    [Database Management]
}

database "Firebase or MariaDB" {
    [User Data]
    [Rubrics]
    [Assignments]
    [Results]
}

UI --> Session
Session --> [Database Management]
[File Handling] --> [Rubric Management]
[Rubric Management] --> [Assignment Processing]
[Assignment Processing] --> ChatGPT
ChatGPT --> [Report Generation]
[Report Generation] --> [Database Management]
[Database Management] --> [Firebase or MariaDB]
@enduml
```

#### Database Schema

For **Firebase** (NoSQL):
- Users: { UserID, Name, Email }
- Rubrics: { RubricID, UserID, Title, Criteria }
- Assignments: { AssignmentID, UserID, RubricID, FileURL }
- Results: { ResultID, AssignmentID, ReportURL, Feedback }

For **MariaDB** (SQL):
- Users (UserID, Name, Email)
- Rubrics (RubricID, UserID, Title)
- Criteria (CriteriaID, RubricID, Description, MaxScore)
- Assignments (AssignmentID, UserID, RubricID, FilePath)
- Results (ResultID, AssignmentID, Score, Feedback, ReportPath)

#### Algorithms

1. **File Upload and Extraction**:
   - Validate file format (ZIP) and extract contents.
   - For each file, check against rubric criteria.

2. **Grading Algorithm**:
   - Utilize ChatGPT API to process each assignment.
   - Compare assignment against rubric, generating scores and feedback.

3. **Report Generation**:
   - Compile scores, feedback into the chosen format (PDF/CSV).


### Implementation

The implementation process will be divided into distinct phases to ensure systematic development and deployment of the system:

#### Phase 1: Environment Setup and Basic Framework

1. **Environment Setup**:
   - Set up development environments for ReactJS and Express.js.
   - Initialize Firebase or MariaDB depending on the choice made for the database.

2. **Basic Framework Development**:
   - Implement the basic ReactJS frontend structure.
   - Develop the foundational Express.js backend.
   - Establish initial connection to the database (Firebase or MariaDB).

#### Phase 2: Core Functionalities

3. **User Authentication and Authorization**:
   - Implement user registration, login, and session management using secure practices.

4. **File Upload and Management**:
   - Develop functionality for users to upload ZIP files and handle file extraction on the server.

5. **Rubric Management**:
   - Create interfaces and backend services for users to add, edit, and delete rubrics.

#### Phase 3: Integration and Processing

6. **ChatGPT API Integration**:
   - Implement API calls to ChatGPT for processing assignment text based on rubrics.

7. **Assignment Evaluation Logic**:
   - Develop the logic to evaluate assignments against rubrics, using outputs from ChatGPT.

8. **Report Generation**:
   - Code the functionality to generate and store reports in either PDF or CSV format.

#### Phase 4: Testing and Deployment

9. **Testing**:
   - Conduct thorough unit, integration, and system tests to ensure reliability and functionality.
   - Perform user acceptance testing with potential end-users.

10. **Deployment**:
    - Prepare the system for deployment.
    - Deploy the application on a suitable cloud platform.

### Milestones

To track the progress of the implementation, we can define the following milestones:

- **Milestone 1: Environment Setup and Framework Completion** (Estimated Time: 2 weeks)
- **Milestone 2: Core Functionalities Implementation** (Estimated Time: 4 weeks)
- **Milestone 3: Integration and Advanced Features** (Estimated Time: 3 weeks)
- **Milestone 4: Testing and Pre-Deployment** (Estimated Time: 2 weeks)
- **Milestone 5: Deployment and Post-Deployment Review** (Estimated Time: 1 week)

### Gathering Results

Post-deployment, the system's performance and functionality will be evaluated based on:

- **User Feedback**: Gather and analyze user feedback on system usability and functionality.
- **System Performance**: Assess system reliability, response times, and error rates.
- **Compliance with Requirements**: Verify that all the must-have requirements are fulfilled and assess the quality of the should-have and could-have features.

