Package: worksheet-grading
Worksheet Grading ToolkitA collection of scripts aiming to simplify the grading process for exercise
sheet grading. Supports Moodle grading worksheet import/export.This package contains four utilities for exercise sheet grading:wg-import: Generates the required directory structure from a Moodle grading worksheet filewg-export: Writes the assigned grades to a Moodle grading worksheet filewg-grade: Used to grade submissionswg-split: Splits/merges exercise CSV filesThe utilitieswg-gradeandwg-splitcan also be used without Moodle
integration, but require a file structure as described in the Usage section.A usage example and detailed guide for theworksheet-gradingpackage can be found in theWorksheet Grading Sandboxrepository and correspondingWikiExercise sheet grading tool (wg-grade)InstallationSupported platformsGiven a Python 3 installation with the required packages, the script is
supported on the following platforms:LinuxmacOSWindows (WSL only, see next section)WSL dependenciesThe "Open PDF" functionality in WSL requires eitherwslvieworxdg-open(packagexdg-utils) to be installed. "Open PDF (Browser)" is not supported on
Windows Systems.Note that Windows without WSL isnot supporteddue to dependency
incompatibilities (notablyreadchar).Installation usingpipTo install, run:pip install worksheet_gradingConfigurationNote: As of version 1.0.0, a configuration file corresponding to the format below is generated bywg-importThe exercise sheet that is to be graded can be configured with a JSON file with the following keys:sheetname(string, required): used to specify the sheet name (i.e. prefix of the used CSV files)exercises(dictionary, required): points of the exercises on the sheet as key-value pairs (values are arrays of sub-exercise points). Note that exercise keys must bestrings(as they would otherwise violate JSON syntax) and sub-exercise points must be integer values. Keys are strings, values are arrays of integers.group-size(integer, optional): specifies the (maximum) number of students per group, is autodetected from the CSV files if not specifiedpdf-path(string, optional): specifies a custom path for the submission PDF files (default ispdf/)exercise-basename(string, optional): specifies a custom exercise basename (default isExercise) to which the exercise number is appended (e.g.Exercise 4->Task 4if exercise-basename=Task). This field is primarily intended to be used for translations.exercise-names(dictionary, optional): specifies custom exercise names for exercise numbers (keys and values are strings) (e.g.{"1": "A+B Problem", "2": "Depth-First-Search"}). If used, this doesnothave to be provided for all exercise numbers defined inexercises.{"sheetname":"blatt2","exercises":{"1":[1,1,1],"2":[2],"3":[2],"4":[1,6,1],"5":[2,1,1],"6":[2,2,2],"7":[2,5,5],"8":[7,3]},"group-size":2}In the above example, thesheetnameisblatt2and exercise 4 consists of 3
sub-exercises with 1, 6 and 1 points, respectively.UsageNote: As of version 1.0.0, the CSV files below are automatically generated bywg-importThe argument-eforwg-gradespecifies the range of
exercises that should be graded as a comma-separated list of integers and
integer ranges.For every exercise, there must be a corresponding CSV file
namedSHEETNAME_EXNUM.csv, whereSHEETNAMEis the sheet name set in the
configuration section andEXNUMa two-digit decimal number for the exercise
number (for example, ifSHEETNAME=blatt1and the file describes exercise 1,
the file should be calledblatt1_01.csv).Using-s, a suffix for the CSV files can be used, such that only CSV files with this suffix are considered
(i.e.,-s _tutor1takes only files suffixed with_tutor1, e.g.blatt1_01_tutor1.csv).These CSV files are expected to have the following format:"exercise","group","student_1","student_2","points","feedback"
1,"Group 1","Frank Zappa",NA,NA,""
1,"Group 2","Ruth Underwood","George Duke",3,"@1@0@correct
@2@0@correct
@3@-0.5@j should be private"Note that quotes are only required if the column spans over multiple rows.  CSV
files should also contain the same "keys", i.e. student and group names.  NA
marks unassigned student_2 and points fields. The feedback field accepts a
string matching the regular expression@([0-9]+)@(-?[0-9]*(\.[0-9]+)?)@(.*).
The first number is the sub-exercise number, the second one the number of points
that are deducted.The script also supports opening PDF files for each group, these have to be
contained in a folderpdf/and must be namedGROUPNAME.pdf, whereGROUPNAMEis the name of the group the PDF was submitted by (PDF's can beexported in this format from Moodle with the Assign Submission Download Plugin). For single-person groups,
the PDF file should be namedFULL NAME.pdf, whereFULL NAMEis the student's full
name as defined in Moodle.You can specify a custom configuration file path using the-cargument.For accessibility and compatibility purposes, the colored terminal output can be
turned off using the--no-colorargument.SinceVersion 1.3.0, the script supports general remarks, which adds the
possibility to add general remarks for each group as well as to deduct points
for errors not strictly belonging to a certain exercise. These remarks are saved
to a file calledSHEETNAME_remarks.csvwhich is structured the same way as the
exercise CSV files with exercise number 0. The script will automatically detect
whether this file is present. Initially, the remarks file can be generated usingwg-importwith the-rflag. This also works for already existing projects
generated without-rin case general remarks should be added after the fact.Saving and exportingThe script exports the same file type that can be read, using theWrite to csv [w]feature in the main menu. Furthermore, after grading of every exercise and
on exit withCtrl+C(which is possible in any menu prompt) auto-saves will be
created for common deductions and the currently assigned grades (files.SHEETNAME_autosave.csvand.sheetname_deductions.csv, respectively).LimitationsThere is a maximum of 15 Exercises per exercise sheet (such that they can be selected
with a hex digit1-Ffrom the group view)CSV split and Merge Script (wg-split)The split script can be used to split the exercise CSV files into multiple files
with given suffixes and merge them together again. This is intended as a
supplement to thewg-gradescript to be able to more easily split exercises
upon several tutors.For example, a file calledblatt1_02.csvcan be split into two filesblatt1_02_tutor1.csvandblatt1_02_tutor2.csvusing$wg-splitblatt1_02.csv_tutor1_tutor2The resulting two files can be merged together to obtain the original file using$wg-split--mergeblatt1_02.csv_tutor1_tutor2Files are split on a line-by-line basis, e.g. if there are 12 groups with subsequent numbering that should be split upon
3 tutors, groups1,4,7,10will be assigned to tutor 1,2,5,8,11to tutor 2, and3,6,9,12to tutor three.Note: As of version 1.3.0 which supports a general remarks file,wg-splitis not intended for
splitting/merging general remarks files that contain the same groups as the
intended behavior for this would deviate for the exercise CSV merging procedure.wg-splitcan however be used to divide the general remarks file into several groups, enabling
tutors to add general remarks if they grade a subset ofgroups, not exercises.Moodle import and export utilities (wg-import,wg-export)wg-importtakes a Moodle grading worksheet file as well as the number of
exercises (-e) and the desired internal name of an exercise sheet (-s) and creates the
necessary directory structure to usewg-grade. The generated config file
(per defaultconfig.json) is supposed to be adapted to the exercise sheet structure
according to the format in the Configuration section. The script also supports
setting a start exercise offset with--start-exerciseto start the exercise
numbering at a different number than 1. Since Version 1.3.0, the script also
supports generating a general remarks from a Moodle grading worksheet. This
can be enabled with the-rflag and will enablewg-gradeto add general
remarks and deductions to a submission.wg-exportexports the comments and grades given to a Moodle grading
worksheet, such that it can be uploaded and parsed by Moodle. The script
allows specifying whether exercises with a single sub-exercise should be
'collapsed' in the output, meaning that the single sub-exercise is
not listed explicitly to make the output more readable. This can be
disabled with the--no-collapseflag.