Skip to content

Commit

Permalink
Merge pull request openedx#2252 from openedx/bmtcril/pii_annotations
Browse files Browse the repository at this point in the history
docs: Add PII annotations to models
  • Loading branch information
bmtcril authored Nov 26, 2024
2 parents e7eeb4c + f205f78 commit 5ce4156
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openassessment/assessment/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class Rubric(models.Model):
once created, they're never updated. When the problem changes, we end up
creating a new Rubric instead. This makes it easy to cache and do hash-based
lookups.
.. no_pii:
"""
# SHA1 hash, including prompts and explanations
content_hash = models.CharField(max_length=40, unique=True, db_index=True)
Expand Down Expand Up @@ -160,6 +162,8 @@ class Criterion(models.Model):
and clarity. Each of those would be separate criteria.
All Rubrics have at least one Criterion.
.. no_pii:
"""
rubric = models.ForeignKey(Rubric, related_name="criteria", on_delete=models.CASCADE)

Expand Down Expand Up @@ -199,6 +203,8 @@ class CriterionOption(models.Model):
Note that this is the representation of the choice itself, *not* a
representation of a particular assessor's choice for a particular
Assessment. That state is stored in :class:`AssessmentPart`.
.. no_pii:
"""
# All Criteria must have at least one CriterionOption.
criterion = models.ForeignKey(Criterion, related_name="options", on_delete=models.CASCADE)
Expand Down Expand Up @@ -419,6 +425,8 @@ class Assessment(models.Model):
an assessment of some submission. It is composed of :class:`AssessmentPart`
objects that map to each :class:`Criterion` in the :class:`Rubric` we're
assessing against.
.. no_pii:
"""
MAX_FEEDBACK_SIZE = 1024 * 100

Expand Down Expand Up @@ -689,6 +697,8 @@ class AssessmentPart(models.Model):
It's implemented as a foreign key to the `CriterionOption` that was chosen
by this assessor for this `Criterion`. So basically, think of this class
as :class:`CriterionOption` + student state.
.. no_pii:
"""
MAX_FEEDBACK_SIZE = 1024 * 100

Expand Down Expand Up @@ -911,6 +921,7 @@ class SharedFileUpload(TimeStampedModel):
"""
Define a single file uploaded by a student when attached to a team.
.. no_pii:
"""
team_id = models.CharField(max_length=255, db_index=True)
course_id = models.CharField(max_length=255, db_index=True)
Expand Down
6 changes: 6 additions & 0 deletions openassessment/assessment/models/peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class AssessmentFeedbackOption(models.Model):
Over time, we may decide to add, delete, or reword assessment feedback options.
To preserve data integrity, we will always get-or-create `AssessmentFeedbackOption`s
based on the option text.
.. no_pii:
"""
text = models.CharField(max_length=255, unique=True)

Expand All @@ -53,6 +55,8 @@ class AssessmentFeedback(models.Model):
("Please provide any thoughts or comments on the feedback you received from your peers")
as well as zero or more feedback options
("Please select the statements below that reflect what you think of this peer grading experience")
.. no_pii:
"""
MAXSIZE = 1024 * 100 # 100KB

Expand Down Expand Up @@ -107,6 +111,7 @@ class PeerWorkflow(models.Model):
The student item is the author of the submission. Peer Workflow Items are
created for each assessment made by this student.
.. no_pii:
"""
# Amount of time before a lease on a submission expires
TIME_LIMIT = timedelta(hours=getattr(settings, "ORA_PEER_LEASE_EXPIRATION_HOURS", 8))
Expand Down Expand Up @@ -514,6 +519,7 @@ class PeerWorkflowItem(models.Model):
associated workflow represents the scorer of the given submission, and the
assessment represents the completed assessment for this work item.
.. no_pii:
"""
scorer = models.ForeignKey(PeerWorkflow, related_name='graded', on_delete=models.CASCADE)
author = models.ForeignKey(PeerWorkflow, related_name='graded_by', on_delete=models.CASCADE)
Expand Down
3 changes: 3 additions & 0 deletions openassessment/assessment/models/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class StaffWorkflow(models.Model):
3) Does this staff member already have a submission open for assessment?
4) Close open assessments when completed.
.. no_pii:
"""
# Amount of time before a lease on a submission expires
TIME_LIMIT = timedelta(hours=getattr(settings, "ORA_STAFF_LEASE_EXPIRATION_HOURS", 8))
Expand Down Expand Up @@ -214,6 +215,8 @@ def close_active_assessment(self, assessment, scorer_id):
class TeamStaffWorkflow(StaffWorkflow):
"""
Extends the StafWorkflow to be used for team based assessments.
.. no_pii:
"""
team_submission_uuid = models.CharField(max_length=128, unique=True, null=False)

Expand Down
4 changes: 4 additions & 0 deletions openassessment/assessment/models/student_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
class StudentTrainingWorkflow(models.Model):
"""
Tracks a student's progress through the student training assessment step.
.. no_pii:
"""
# The submission UUID of the student being trained
submission_uuid = models.CharField(max_length=128, db_index=True, unique=True)
Expand Down Expand Up @@ -183,6 +185,8 @@ class StudentTrainingWorkflowItem(models.Model):
then the student proceeds to the next example;
if there are no examples left, the student has
successfully completed training.
.. no_pii:
"""
workflow = models.ForeignKey(StudentTrainingWorkflow, related_name="items", on_delete=models.CASCADE)
order_num = models.PositiveIntegerField()
Expand Down
2 changes: 2 additions & 0 deletions openassessment/assessment/models/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
class TrainingExample(models.Model):
"""
An example assessment used to train students (before peer assessment) or AI.
.. no_pii:
"""
# The answer (JSON-serialized)
raw_answer = models.TextField(blank=True)
Expand Down
2 changes: 2 additions & 0 deletions openassessment/staffgrader/models/submission_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
class SubmissionGradingLock(models.Model):
"""
Internal model for locking a submission for exclusive grading
.. no_pii:
"""
TIMEOUT = StaffWorkflow.TIME_LIMIT

Expand Down
7 changes: 7 additions & 0 deletions openassessment/workflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
submissions you have to assess = 5"). The "status" field on this model is
an after the fact recording of the last known state of that information so
we can search easily.
.. no_pii:
"""
STAFF_STEP_NAME = 'staff'

Expand Down Expand Up @@ -701,6 +703,8 @@ def identifying_uuid(self):
class TeamAssessmentWorkflow(AssessmentWorkflow):
"""
Extends AssessmentWorkflow to support team based assessments.
.. no_pii:
"""
# Only staff assessments are supported for teams
TEAM_STAFF_STEP_NAME = 'teams'
Expand Down Expand Up @@ -855,6 +859,7 @@ class AssessmentWorkflowStep(models.Model):
sync until someone views this problem again (which will trigger a workflow
update to occur).
.. no_pii:
"""
workflow = models.ForeignKey(AssessmentWorkflow, related_name="steps", on_delete=models.CASCADE)
name = models.CharField(max_length=20)
Expand Down Expand Up @@ -1029,6 +1034,8 @@ class AssessmentWorkflowCancellation(models.Model):
It is created when a staff member requests removal of a submission
from the peer grading pool.
.. no_pii:
"""
workflow = models.ForeignKey(AssessmentWorkflow, related_name='cancellations', on_delete=models.CASCADE)
comments = models.TextField(max_length=10000)
Expand Down

0 comments on commit 5ce4156

Please sign in to comment.