Commit 5a8c91c2 by Stephen Sanchez

Cleaning up some of my initial attempts at models.

Deleting a few files I don't believe we'll need.
parent 286e4752
from django.db import models
MAX_LENGTH = 1028
ESSAY_BODY_MAX_LENGTH = 8192
GRADING_TYPES = (
('PE', 'Peer Assessment'),
)
class Essay(models.Model):
class Submission(models.Model):
student_id = models.CharField(max_length=MAX_LENGTH, db_index=True)
location_id = models.CharField(max_length=MAX_LENGTH, default="")
course_id = models.CharField(max_length=MAX_LENGTH, default="")
essay_body = models.CharField(max_length=MAX_LENGTH, default="")
scoring_type = models.CharField(max_length=MAX_LENGTH, default="")
scores = models.CharField(max_length=MAX_LENGTH, default="")
essay_body = models.CharField(max_length=ESSAY_BODY_MAX_LENGTH, default="")
preferred_grading = models.CharField(max_length=2, choices=GRADING_TYPES)
submitted_date = models.DateTimeField()
class Scoring(models.Model):
points_earned = models.PositiveIntegerField(default=0)
points_possible = models.PositiveIntegerField(default=0)
feedback = models.CharField(max_length=MAX_LENGTH, default="") # TODO how to link to feedback keys?
scored_date = models.DateTimeField()
student_id = models.CharField(max_length=MAX_LENGTH)
score_type = models.CharField(max_length=MAX_LENGTH, default="")
score_type = models.CharField(max_length=2, choices=GRADING_TYPES)
confidence = models.FloatField(default=0.0)
included = models.BooleanField(default=True)
submission = models.ForeignKey(Submission)
class Feedback(models.Model):
text = models.CharField(max_length=MAX_LENGTH, default="")
scoring = models.CharField(max_length=MAX_LENGTH, default="") # TODO Link to Scoring keys.
score = models.ForeignKey(Scoring)
"""
Interface for all Peer Grading Workflow. Covers all requests made for Peer Grading.
"""
from models import Status
from common_grading.models import Essay
class EssayViewSet(viewsets.ModelViewSet):
queryset = Essay.objects.all()
def create(self, request, *args, **kwargs):
"""
Submit an essay to be graded. This specifically requests that the given essay should be graded by peers.
@param self: Self.
@param request: Student, Question, and Essay information will be passed through via an HTTP Request.
@return: Once an essay has been submitted, the student's status for beginning peer grading should be immediately
returned. See student_status for more information.
"""
pass
def retrieve(self, request, *args, **kwargs):
"""
Retrieves an essay for grading. This may be a calibration essay if the student requires calibration. If not, they
will begin to grade actual essays for the particular question.
@param self: Self.
@param request: An HTTP Request with the student information, and location information, allowing the retrieval of
an appropriate essay to grade.
@return: Response will contain essay grading information, or student status information regarding why an essay could
not be retrieved.
"""
pass
def get(self, request):
"""
Notification message to determine if the submitted essay for a student is still being processed (graded) or has been
fully graded, in which case the grade can be returned.
@param self: Self.
@param request: An HTTP request for the grade of a particular submission. Requires student and question information.
@return: The requested grade, or status of the submission.
"""
pass
def update(self, request, *args, **kwargs):
"""
Grading Updates from Peer Reviews.
@param request:
@param args:
@param kwargs:
@return:
"""
pass
class StatusViewSet(viewsets.ModelViewSet):
queryset = Status.objects.all()
def get(self, request):
"""
Check to see if the student is ready to grade essays. In order to determine if the student can begin grading,
the follow criteria must be met:
1) The student has submitted an essay.
2) The instructor has graded enough enough calibration essays.
3) The student has graded enough calibration essays.
4) There essays available to be graded.
@param self: Self.
@param request: An HTTP Request containing the student information and the location of this particular open ended
question.
@return: A JSON response indicating the state of grading for this particular. The student may be given instruction
based on this status.
"""
pass
"""
WSGI config for peer_grading project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "peer_grading.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
import logging
log = logging.getLogger(__name__)
class PeerGradingService(object):
"""
Interface with the grading controller for peer grading
TODO: Create service communication with views. ?
"""
def __init__(self, config, system):
config['system'] = system
self.url = config['url'] + config['peer_grading']
self.login_url = self.url + '/login/'
self.submit_peer_essay = self.url + '/submit_peer_essay/'
self.request_grade = self.url + '/request_grade/'
self.grade_essay = self.url + '/grade_essay/'
self.student_status = self.url + '/student_status/'
self.system = system
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment