Exporting gradebook history
It is very easy using the API to get a gradebook history showing when each assignment was submitted, when it was graded, who graded, etc. The simple program i wrote to export this as an XLSX file has the following column headings:
assignment_id | assignment_name | attachments | attempt | body | |
cached_due_date | current_grade | current_graded_at | current_grader | entered_grade | entered_score |
excused | grade | grade_matches_current_submission | graded_at | grader | grader_id |
points_deducted | grading_period_id | id | late | late_policy_status | |
missing | preview_url | score | seconds_late | submission_type | submitted_at |
url | user_id | user_name | workflow_state |
The program is called as:
./export-gradebook-history.py
Download export-gradebook-history.py course_id
The bulk of the work is done with:
def list_gradebook_history_feed(course_id):
entries_found_thus_far=[]
# Use the Canvas API to get the feed of gradebook information
#GET /api/v1/courses/:course_id/gradebook_history/feed
url = baseUrl + '%s/gradebook_history/feed' % (course_id)
if Verbose_Flag:
print("url: " + url)
r = requests.get(url, headers = header)
if Verbose_Flag:
write_to_log("result of getting gradebook history feed: " + r.text)
if r.status_code == requests.codes.ok:
page_response=r.json()
for p_response in page_response:
entries_found_thus_far.append(p_response)
# the following is needed when the response has been paginated
# i.e., when the response is split into pieces - each returning only some of the list of modules
# see "Handling Pagination" - Discussion created by tyler.clair@usu.edu on Apr 27, 2015, https://community.canvaslms.com/thread/1500
while r.links['current']['url'] != r.links['last']['url']:
r = requests.get(r.links['next']['url'], headers=header)
page_response = r.json()
for p_response in page_response:
entries_found_thus_far.append(p_response)
return entries_found_thus_far
An obvious future effort would be to look at how machine learning techniques could be used to audit such histories.