gradescope

This module process the gradescope generated csv grades file, and use canvas api to post grade to students, with late penalty.

source

gradescope_grade

 gradescope_grade (credentials_fp='', API_URL='https://canvas.ucsd.edu',
                   course_id='', assignment_id=-1, gradescope_fp='',
                   verbosity=1)

Initialize Canvas Group within a Group Set and its appropriate memberships

Type Default Details
credentials_fp str credential file path. Template of the credentials.json
API_URL str https://canvas.ucsd.edu the domain name of canvas
course_id str Course ID can be found in the course url
assignment_id int -1 assignment id, can be found in the canvas assignment url
gradescope_fp str gradescope csv file path
verbosity int 1 Controls the verbosity: 0 = Silent, 1 = print all messages

source

gradescope_grade.auth_canvas

 gradescope_grade.auth_canvas (credentials_fp:str)

Authorize the canvas module with API_KEY

Type Details
credentials_fp str the Authenticator key generated from canvas

source

gradescope_grade.set_course

 gradescope_grade.set_course (course_id:int)

Set the target course by the course ID

Type Details
course_id int the course id of the target course

source

gradescope_grade.load_gradescope_csv

 gradescope_grade.load_gradescope_csv (csv_pf:str)

Load gradescope exported csv file

Type Details
csv_pf str csv file path

source

gradescope_grade.calculate_late_hour

 gradescope_grade.calculate_late_hour (target_assignment:str)

Calculate the late hours of each submission of the target assignment

Type Details
target_assignment str target assignment name. Must in the column of gradescope csv
Returns Series late hours of the target assignment

source

gradescope_grade.calculate_credit_balance

 gradescope_grade.calculate_credit_balance (passed_assignments:List[str],
                                            total_credit=120)

Calculate the balance of late hours from the gradescope file

Type Default Details
passed_assignments List list of passed assignment. Must in the column of gradescope csv
total_credit int 120 total number of allowed late hours
Returns dict {email: credit balance} late credit balance of each student

source

gradescope_grade.calculate_total_score

 gradescope_grade.calculate_total_score (components:List[str])

Calculate the total score of an assignment

Type Details
components List components of a single assignment. Must in the column of gradescope csv
Returns Series

source

gradescope_grade._post_grade

 gradescope_grade._post_grade (student_id:int, grade:float,
                               text_comment='', force=False)

Post grade and comment to canvas to the target assignment

Type Default Details
student_id int canvas student id of a student. found in self.email_to_canvas_id
grade float grade of that assignment
text_comment str Text comment of the submission. Can feed
force bool False Whether force to post grade for all students. If False (default), it will skip post for the same score.
Returns Submission created submission

source

gradescope_grade.post_to_canvas

 gradescope_grade.post_to_canvas (target_assignment:str,
                                  passed_assignments:List[str],
                                  components=[], total_credit=120,
                                  post=False, force=False, student=[])

Post grade to canvas with late penalty.

Type Default Details
target_assignment str target assignment name to grab the late time. Must in the column of gradescope csv
passed_assignments List list of passed assignment. Must in the column of gradescope csv
components list [] components of a single assignment. Must in the column of gradescope csv
total_credit int 120 total number of allowed late hours
post bool False For testing purposes. Can halt the post-operation
force bool False whether force to post grade for all students. If False (default), it will skip post for the same score.
student list [] list of student email to post grade. If empty, it will post all students

Additionally, one can also generate quick report to get a general sense of how the late situation overall for the students in the class so far.


source

gradescope_grade.calculate_late_reports

 gradescope_grade.calculate_late_reports (passed_assignments:List[str],
                                          total_credit=120)
Type Default Details
passed_assignments List list of passed assignment. Must in the column of gradescope csv
total_credit int 120 total number of allowed late hours
Returns List {email: (str: late_assignments, int: late_hours, bool: penalty_applied )}, {email: int total_late_hours}