- 1. Marks to PDF - Canvas Edition
- 2. PDF generation script (MarksToPdf)
- 3. Upload Feedback PDFs to Canvas (pdfsToCanvas)
- 4. Contact
These scripts automate the generation and distribution of individual student feedback PDFs via canvas.
This script will generate PDFs feedback rubrics based on a spreadsheet (in CSV format) containing each student's personal details, marks and feedback. It can also email the feedback PDFs to students as they are generated [emailing feature is deprecated and will be removed at some point].
Refer to the COOK10001 example Excel sheet, JSON file, and CanvasSubmissions downloaded assignments folder in /examples
I recommend that you work from the JSON file without comments. MarksToPDF will accept comments in the config JSON file, but JSON validators like https://jsonlint.com won't work if you have comments.
If the tool reports a syntax error in the JSON, use https://jsonlint.com to debug the JSON.
-
You will need Node.js version 12+ and npm installed. If you're on an older version of ubuntu etc, you can use nvm https://github.com/nvm-sh/nvm to get a version of node > 12. I have had success running the script on the Windows Subsystem for Linux on Windows 10, but otherwise installing node from https://nodejs.org/en/ works fine.
-
Before running the script for the first time, run
npm installto fetch dependencies. -
Prepare a CSV file with student marks. This should contain one row for every student (rows with no student number, or an invalid student number, will be ignored). The row containing the maximum available marks for each question should come before the first student row. If you are going to use the email functionality, make sure there is a column that contains student email addresses. Place this file into
/input
- If there are students who should not receive feedback (e.g. suspected of academic misconduct), you can either delete their rows from the CSV, or mask the email addresses by prefixing them with XXXX or similar.
-
Prepare a configuration JSON file. There are various example JSON files included in
/example, which contain documentation explaining what is required. If you need advice, or you want to do something that does not appear possible, please contact Alan Thomas alan.thomas@unimelb.edu.au. Place this file into/input -
Run the script. A typical invocation to generate PDFs without emailing them might look like:
$ node markstopdf.mjs --config A1_2021_S1.json --csv A1_2021_S1.csv
- See the 'command line args' section below for more details.
The structure (only showing files relevant to marksToPdf) should look as follows (with your own csv and pdf spec from steps 3 and 4, and your student assignments from step 5 in place).
| .gitignore
| markstopdf.mjs
| markstopdfutils.mjs
| package.json
| README.md
|
----examples
| | COOK10001-example-with-comments.json
| | COOK10001-example.`json`
| | COOK10001-example.xlsx
|
|
----fonts
| ...
|
----input
| myPdfSpec.json
| myStudentGrades.csv
| myLogo.png
usage: node markstopdf.mjs [--ids 123456,345678,...] [--mail n] --config config.json --csv marks.csv
--ids list,of,ids optional: only generate PDFs for the given student IDs
--mail 1, --mail 2 optional: whether to email the generated PDFs
--mail 1: send all the emails to the subject coordinator
--mail 2: actually send an email to each student
--config config.json required: the JSON configuration file for this assignment
--csv marks.csv required: the CSV file containing the marks data
note that the emailing functionality will not work without additional work for accounts with MultiFactor authentication enabled, hence the need for the canvas upload extension.
Eventually the Email functionality will be removed or at least refactored into its own script.
A separate script is included which can upload feedback PDFs (or any file really) to the corresponding feedback page on the canvas assignment for each student.
- Follow the first 2 steps for the above marksToPDF to setup Node.js
- Ensure your node environment is version 12 or later.
- Generate feedback PDFs or other files (eg using marksToPdf).
- Place the PDFs in the "./generatedPdfs/" directory (configurable in script args, see below)
- Create a uploadConfig.json file modelled on the example
example-uploadConfig.jsonlocated in the examples folder- To create a token for use with canvas, see https://canvas.instructure.com/doc/api/file.oauth.html#manual-token-generation. The 'manual token generation' works fine.
- You can find the canvas subject Id and assignment ID from the URL of the assignment,
eg
https://<canvasUrl>/courses/108072/assignments/204232/has a subjectID of 108072 and an assignment ID of 204232
- Place the uploadConfig.json in the input folder (configurable in script args)
- Run the script as
node pdfsToCanvas.jsm
usage: node pdfsToCanvas.mjs [--config ./config.json] [--pdfsDir ./pdfs/] [--fileExtension pdf]
--config ./config.json optional: The JSON configuration file for this assignment
Defaults to ./input/uploadConfig.json if not provided
--pdfsDir ./pdfs/ optional: The dir containing the pdfs generated by marksToPdf.
Defaults to ./generatedPdfs/ if not provided"
--fileExtension optional: Files with this extension will be uploaded.
This prevents accidental upload of other file types.
Defaults to pdf if not provided.
The default structure (only showing files relevant to pdfsToCanvas) should look as follows (with your own uploadConfig.json from step 3, and your feedbackPDFs from step 1&2 in place).
| .gitignore
| pdfsToCanvas.mjs
| uploadSingleFeedbackCanvas.mjs
| package.json
| README.md
|
----examples
| | example-uploadConfig.json
|
----generatedPdfs
| | Feedback_<canvasId>_Fname1_Lname1.pdf
| | Feedback_<canvasId>_Fname2_Lname2.pdf
| | ...
|
----input
| uploadConfig.json
The uploaded files do not need to be PDFs, and in fact do not need to have been generated from marksToPdf (could be any type of feedback file).
However, each file to be uplaoded MUST be named as xxxx_<canvasId>_..., for example,
the naming produced by marksToPdf of Feedback_<canvasId>_<studentId>_Fname_Lname.pdf
works perfectly.
If you have any questions or feedback, contact Alan Thomas alan.thomas@unimelb.edu.au or <colton.carner ‘at’ unimelb.edu.au>