Google Sheets Grade Override¶
This plugin allows you to override test case scores during grading by specifying the new score in a Google Sheet that is pulled in. To use this plugin, you must set up a Google Cloud project and obtain credentials for the Google Sheets API. This plugin relies on
gspread to interact with the Google Sheets API and its documentation contains instructions on how to obtain credentials. Once you have created credentials, download them as a JSON file.
This plugin requires two configurations: the path to the credentials JSON file and the URL of the Google Sheet. The former should be entered with the key
credentials_json_path and the latter
sheet_url; for example, in Otter Assign:
plugins: - otter.plugins.builtin.GoogleSheetsGradeOverride: credentials_json_path: /path/to/google/credentials.json sheet_url: https://docs.google.com/some/google/sheet
The first tab in the sheet is assumed to be the override information.
During Otter Generate, the plugin will read in this JSON file and store the relevant data in the
otter_config.json for use during grading. The Google Sheet should have the following format:
|Assignment ID||Test Case||Points|
|firstname.lastname@example.org||q1a - 1||1||false|
Assignment IDshould be the ID of the assignment on Gradescope (to allow one sheet to be used for multiple assignments)
Test Caseshould be the name of the test case as a string (e.g. if you have a test file
q1a.pywith 3 test cases, overriding the second case would be
q1a - 2)
Pointsshould be the point value to assign the student for that test case
Note that the use of this plugin requires specifying
gpsread in your requirements, as it is not included by default in Otter’s container image.
The actions taken by at hook for this plugin are detailed below.
- class otter.plugins.builtin.GoogleSheetsGradeOverride(submission_path, submission_metadata, plugin_config)¶
Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the Gradescope assignment ID, student email, and test case name.
after_gradingevents. Make sure to list this plugin as ``otter.plugins.builtin.GoogleSheetsGradeOverride``, otherwise the ``during_generate`` event of this plugin will not work.
The google sheet should have the following format:
q1a - 1
Assignment IDshould be the ID of the assignment on Gradescope,
Questionshould be the name of the question, and
Pointsshould be the number of points that the student should be assigned.
falseif the student’s PDF should not be regenerated during this run of the autograder.
Modifies the results of grading by pulling in the Google Sheet as a dataframe and updating the scores for the test cases found.
otter.test_files.GradingResults) – the results of grading
Controls whether or not a PDF is generated by setting the
tokenkey of the grading options to
Noneif any of the rows in the dataframe matching this (email, assignment ID) tuple indicate that a PDF should not be generated.
dict) – the grading configurations
- property df¶
The grade override information dataframe
- during_generate(otter_config, assignment)¶
Takes a path to Google Service Account credentials stored in this plugin’s config as key
credentials_json_pathand extracts the data from that file into the plugin’s config as key
dict) – the parsed Otter configuration JSON file
otter.assign.assignment.Assignment) – the assignment configurations if Otter Assign is used