AI-Driven Approach For Fusion (Task 3)
AI-Driven Approach For Fusion (Task 3)
1. Prompt 1 :
< Use the Problem statement to generate the use cases>
Problem Statement :
This is the ‘Awards and Scholarships’ (SPACS) module of Fusion, Institute ERP portal,
which is to be used by User, Student, SPACS Convener (Faculty), SPACS Assistant
(Staff). The intended use of the system by its users are as follows:
A user is the person who has logged in the system.
A User is able to browse through a catalog of Convocation medals, browse through
a catalog of MCM scholarship.
Users can view previous year’s winners for various convocation medals and MCM
Scholarships
Students can view administration in charge of the system, and other related staff
details.
The student is able to browse through the details and modalities regarding
eligibility and application procedure.
The student can apply for Convocation Medals by filling out a form and uploading
necessary documents, and can apply for MCM scholarship by filling out a form and
uploading necessary documents.
The Student views application status for each of the applied medals/scholarships.
The main purpose of the SPACS Assistant is physical verification of the
documents and updating the application status of the students in the portal.
He can Invite applications - can introduce new awards and modify the existing
ones.
Can Approve or reject student applications based on document verification and
eligibility
He can select recipients for awards.
Can Manage the catalog of awards, prizes, and scholarships, including making
changes to application procedures or deleting existing entries.
He can manage scholarship status.
He can notify a student in case of lack of required information in the applications.
The SPACS Convenor has overarching authority regarding awards and
scholarships. They can Invite applications by introducing new awards or modifying
existing ones.
Can Approve or reject applications.
Select recipients for awards, acting as the final decision-making authority.
Manage the catalog of medals, awards, and scholarships
OUTPUT :
Using Chat GPT-4o:
Based on the detailed requirements provided for the SPACS module, here’s the proposed
database schema.
Database Tables
1. Users
2. Students
3. SPACS_Staff
● staff_id (PK) - Unique identifier for SPACS staff (FK referencing user_id).
● name - Name of the staff.
● designation - Designation of the staff (SPACS Assistant or SPACS Convenor).
● contact_info - Contact details.
4. Awards_Scholarships
5. Applications
6. Winners
7. Notifications
1. Users table will be the parent for both Students and SPACS_Staff tables (1:1
relationship).
2. Awards_Scholarships will be linked with Applications and Winners.
3. Applications will have a many-to-one relationship with both Students and
Awards_Scholarships.
4. Notifications will be linked to students through the Users table.
Users
|--> Students
|--> SPACS_Staff
Awards_Scholarships
|--> Applications
|--> Winners
This schema allows all functionalities like user-specific operations, managing award/scholarship
catalogs, applying, tracking, and administering awards, as well as handling notifications
efficiently.
-- Users Table
contact_number VARCHAR(15)
);
-- Students Table
department VARCHAR(50),
batch_year INT,
contact_info VARCHAR(255),
);
-- SPACS_Staff Table
contact_info VARCHAR(255),
);
-- Awards_Scholarships Table
description TEXT,
eligibility_criteria TEXT,
application_procedure TEXT,
created_by INT,
);
-- Applications Table
rejection_reason TEXT,
documents_uploaded TEXT,
);
-- Winners Table
);
-- Notifications Table
);
Using Gemini 1.5 Flash:
● Users:
○ user_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ username (VARCHAR(255), UNIQUE)
○ password (VARCHAR(255)) (Consider using a secure hashing algorithm)
○ user_type (ENUM('student', 'staff', 'faculty', 'admin'))
○ first_name (VARCHAR(255))
○ last_name (VARCHAR(255))
○ email (VARCHAR(255), UNIQUE)
○ student_id (INT, UNIQUE, NULLABLE - For students only, links to Students table)
● Students:
○ student_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ enrollment_number (VARCHAR(255), UNIQUE)
● Awards:
○ award_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ award_name (VARCHAR(255))
○ award_type (ENUM('medal', 'scholarship'))
○ description (TEXT)
○ eligibility_criteria (TEXT)
○ application_procedure (TEXT)
● Applications:
○ application_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ student_id (INT, FOREIGN KEY referencing Students)
○ award_id (INT, FOREIGN KEY referencing Awards)
○ application_date (TIMESTAMP)
○ status (ENUM('pending', 'approved', 'rejected', 'incomplete'))
○ verification_status (ENUM('pending', 'verified', 'rejected'))
● Application_Documents:
○ document_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ application_id (INT, FOREIGN KEY referencing Applications)
○ document_name (VARCHAR(255))
○ document_path (VARCHAR(255))
● Award_Recipients:
○ recipient_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ award_id (INT, FOREIGN KEY referencing Awards)
○ student_id (INT, FOREIGN KEY referencing Students)
○ year (YEAR)
● Staff:
○ staff_id (INT, PRIMARY KEY, AUTO_INCREMENT)
○ staff_name (VARCHAR(255))
○ role (VARCHAR(255)) (e.g., 'SPACS Assistant')
○ contact_info (VARCHAR(255))
Relationships:
This schema allows for efficient data management and querying. The use of enums
improves data integrity. Consider adding more fields as needed, such as deadlines for
applications or specific award criteria. Remember to handle data sanitization and
security appropriately.
Here are the `CREATE TABLE` statements for the database schema described
previously. Remember to adapt data types (e.g., VARCHAR lengths) to your specific
needs. Also, ensure you're using a database system that supports the `ENUM` data type
(MySQL, for instance, does; PostgreSQL uses `CHECK` constraints for similar
functionality).
```sql
password VARCHAR(255),
first_name VARCHAR(255),
last_name VARCHAR(255),
);
);
award_name VARCHAR(255),
description TEXT,
eligibility_criteria TEXT,
application_procedure TEXT
);
student_id INT,
award_id INT,
);
application_id INT,
document_name VARCHAR(255),
document_path VARCHAR(255),
);
CREATE TABLE Award_Recipients (
award_id INT,
student_id INT,
year YEAR,
);
staff_name VARCHAR(255),
role VARCHAR(255),
contact_info VARCHAR(255)
);
```
The use of `AUTO_INCREMENT` assumes your database system supports this feature.
Always back up your data before making schema changes.
Comparison:
Both models are strong, but ChatGPT-4.0 is likely better suited for tasks heavily reliant
on textual precision, like database design and SQL scripting.
Use Gemini 1.5 if you need visual aids, conceptual overviews, or are working in a
mixed-media environment.
Use ChatGPT-4.0 if you want an exhaustive textual explanation, detailed SQL scripts,
and support in refining technical requirements via conversation.
2. Prompt 2:
now for the SPACS Convener actor generate the complete working backend code in django>
OUTPUT :
Using Chat GPT-4o:
Here’s the backend code for the SPACS Convenor actor in a similar style using Django and
Django REST Framework (DRF). This will include model definitions, serializers, views, URLs,
and optional permissions for role-based access.
1. Models
# models.py
from django.db import models
from django.contrib.auth.models import User
class Award(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
type = models.CharField(max_length=50, choices=[('Convocation Medal', 'Convocation
Medal'), ('MCM Scholarship', 'MCM Scholarship')])
eligibility_criteria = models.TextField()
application_procedure = models.TextField()
created_by = models.ForeignKey(User, on_delete=models.CASCADE,
related_name='awards_created')
def __str__(self):
return self.name
class Application(models.Model):
STATUS_CHOICES = [
('Pending', 'Pending'),
('Approved', 'Approved'),
('Rejected', 'Rejected'),
('Under Review', 'Under Review'),
]
def __str__(self):
return f"{self.student.username} - {self.award.name}"
2. Serializers
# serializers.py
from rest_framework import serializers
from .models import Award, Application
class AwardSerializer(serializers.ModelSerializer):
class Meta:
model = Award
fields = '__all__'
class ApplicationSerializer(serializers.ModelSerializer):
class Meta:
model = Application
fields = '__all__'
class ApplicationUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Application
fields = ['status', 'rejection_reason']
3. Views
# views.py
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from .models import Award, Application
from .serializers import AwardSerializer, ApplicationSerializer, ApplicationUpdateSerializer
class AwardView(APIView):
permission_classes = [IsAuthenticated]
class ApplicationView(APIView):
permission_classes = [IsAuthenticated]
4. URLs
# urls.py
from django.urls import path
from .views import AwardView, ApplicationView
urlpatterns = [
path('awards/', AwardView.as_view(), name='award-list'),
path('applications/', ApplicationView.as_view(), name='application-list'),
path('applications/<int:application_id>/', ApplicationView.as_view(), name='application-detail'),
]
5. Permissions
# permissions.py
from rest_framework.permissions import BasePermission
class IsSPACSConvenor(BasePermission):
def has_permission(self, request, view):
return request.user.groups.filter(name='SPACS Convenor').exists()
6. Testing
"status": "Approved",
"rejection_reason": ""
}
This code is structured to meet the SPACS Convenor's requirements, ensuring functionality for
award management, application handling, and role-based access.
**1. models.py:**
```python
from django.contrib.auth.models import User
from django.db import models
class Counselor(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
specialization = models.CharField(max_length=100)
# Add other relevant fields as needed (e.g., contact info)
class Student(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
counselor = models.ForeignKey(Counselor, on_delete=models.SET_NULL, null=True,
blank=True) #Allow null/blank for initial creation
academic_year = models.CharField(max_length=20)
date_of_birth = models.DateField()
# Add other fields (e.g., address, contact details)
class AcademicPerformance(models.Model):
student = models.ForeignKey(Student, on_delete=models.CASCADE)
subject = models.CharField(max_length=100)
grade = models.CharField(max_length=2)
remarks = models.TextField(blank=True) #Simplified null handling
class Attendance(models.Model):
student = models.ForeignKey(Student, on_delete=models.CASCADE)
total_days = models.IntegerField()
days_present = models.IntegerField()
# Consider adding date ranges or specific dates for better tracking
class Achievement(models.Model):
student = models.ForeignKey(Student, on_delete=models.CASCADE)
title = models.CharField(max_length=255)
description = models.TextField()
date_achieved = models.DateField()
class CounselingSession(models.Model):
student = models.ForeignKey(Student, on_delete=models.CASCADE)
counselor = models.ForeignKey(Counselor, on_delete=models.CASCADE)
date = models.DateTimeField()
feedback = models.TextField(blank=True)
status = models.CharField(max_length=20, choices=[
('scheduled', 'Scheduled'),
('completed', 'Completed'),
('canceled', 'Canceled'),
], default='scheduled') #Set default status
```
class AcademicPerformanceListAPIView(ListAPIView):
serializer_class = AcademicPerformanceSerializer
permission_classes = [IsAuthenticated]
def get_queryset(self):
student_id = self.kwargs['student_id']
return AcademicPerformance.objects.filter(student_id=student_id)
class CounselingSessionCreateAPIView(CreateAPIView):
queryset = CounselingSession.objects.all()
serializer_class = CounselingSessionSerializer
permission_classes = [IsAuthenticated]
class CounselingSessionListAPIView(ListAPIView):
serializer_class = CounselingSessionSerializer
permission_classes = [IsAuthenticated]
def get_queryset(self):
student_id = self.kwargs['student_id']
return CounselingSession.objects.filter(student_id=student_id)
```
```python
from django.urls import path
from .views import (AcademicPerformanceListAPIView, AttendanceListAPIView,
AchievementListAPIView,
CounselingSessionCreateAPIView, CounselingSessionListAPIView)
urlpatterns = [
path('students/<int:student_id>/academic-performance/',
AcademicPerformanceListAPIView.as_view(), name='academic-performance-list'),
path('students/<int:student_id>/attendance/', AttendanceListAPIView.as_view(),
name='attendance-list'),
path('students/<int:student_id>/achievements/', AchievementListAPIView.as_view(),
name='achievement-list'),
path('students/<int:student_id>/counseling-sessions/',
CounselingSessionListAPIView.as_view(), name='counseling-session-list'),
path('students/<int:student_id>/counseling-sessions/create/',
CounselingSessionCreateAPIView.as_view(), name='counseling-session-create'),
]
```
```python
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsStudentOrReadOnly(BasePermission):
def has_permission(self, request, view):
if request.method in SAFE_METHODS:
return True
return request.user.groups.filter(name='Students').exists()
```
Remember to:
This enhanced version provides a more robust and structured foundation for your SPACS
Convener backend. Remember to add authentication and authorization for production use. Let
me know if you want further explanations or have more specific requirements.
Comparison:
Both implementations (from Gemini Flash 1.5 and ChatGPT-4) provide a Django REST
Framework (DRF)-based backend structure for handling specific functionality. However, there
are notable differences in approach, structure, and features:
1. Models
ChatGPT-4
● Tailored to the SPACS module, with models like Award and Application.
● Includes detailed fields specific to awards and scholarships, such as
eligibility_criteria, application_procedure, and documents_uploaded.
● Focuses on role-specific relationships, e.g., created_by for tracking which user
created an award.
● Models directly reflect SPACS module requirements.
2. Serializers
ChatGPT-4
3. Views
ChatGPT-4
● Uses APIView for flexibility, with explicit methods (get, post, put).
● Allows complex logic per method, e.g., handling permissions and data validation inline.
● Provides tailored functionality for award and application management, reflecting SPACS
Convenor responsibilities.
4. URLs
● Concise and clean URL patterns using DRF's generic views for specific endpoints.
● Includes both list and create views for counseling sessions.
ChatGPT-4
5. Permissions
ChatGPT-4
6. Error Handling
ChatGPT-4
7. Extensibility
● Encourages extensibility by suggesting additional fields and features but keeps the
implementation minimal.
● Relies heavily on DRF conventions for simplicity.
ChatGPT-4
● Tailors the implementation to the SPACS module’s specific requirements, adding fields,
serializers, and endpoints directly related to award and scholarship management.
● Offers more granular functionality, such as updating application status with rejection
reasons.
8. Custom Features
ChatGPT-4
Summary
Conclusion
Gemini Flash 1.5 focuses on simplicity and adaptability for general academic use, while
ChatGPT-4 delivers a feature-complete, SPACS-specific implementation with enhanced
customizability, making it more suited for real-world deployment in the given context.
Note :
Here I have provided the response in text format and I have
attached the zip of my entire working backend code (From
Chat GPT-4o Model).