npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

canvas-grade-uploader

v1.1.0

Published

Upload a CSV file of grades to Canvas

Downloads

9

Readme

Canvas Grade Uploader

A simple tool to handle grade uploading to Canvas, a learning management system.

Installation

The grade uploader works well as a command line tool. If you're using it this way be sure to use the -g option:

npm install -g canvas-grade-uploader

Usage

There are two use cases:

  1. Command line tool:

    grade-uploader [leave blank for short help]
    usage: grade-uploader [-h] [-v] -c COURSE_ID -a ASSIGNMENT_ID -f FILE [-u URL] -t
              TOKEN [-uid {"",sis_login_id,sis_user_id}]
    grade-uploader -t [token] -c 1268501 -a 7148451 -f ~/Desktop/Midterm_scores.csv
    • When using the command line, you can optionally define CANVAS_TOKEN in your environment. This will be used if no -t option is provided.
  2. As a module:

    var postGrades = require('canvas-grade-uploader');
    
    postGrades(options, data, callback); // See below for options

NOTE The module interface is currently a work in progress. Breaking changes to this interface will be semver-minor, at least until it's fully stable.

Configuration

The grade uploader uploads grades to a specific Canvas assignment. To do this a few details are required. The command line help will walk you through most of them.

Canvas assignment and course IDs are easily obtained from the URL of the assignments page.

For example:

https://bcourses.berkeley.edu/courses/1268501/assignments/7148451
  • URL: https://bcourses.berkeley.edu/
  • Course ID: 1268501
  • Assignment ID: 7148451

Getting a Canvas Token

Canvas authenticates users with Oauth Tokens. You can generate a token for yourself by visiting your personal settings page. There is Canvas documentation about generating your own token.

The short version is: Visit this page. https:/<canvas-instance>/profile/settings

CSV Format

This tool was built to speed up working with Gradescope

The CSV file requires the following values:

  • "SID" -- This is the unique user ID for each student.
  • "Total Score" -- This is the score that each user will receive.
  • Optional "Name" -- The name column currently isn't used, but might be for debugging in the future. (Really, it's much much nicer to deal with names over IDs when possible.)

Default Values

Currently, there are a couple default values which as "Berkeley-specific". If this tool gets enough use, I'll gladly change them…

  • URL, -u defaults to: https://bcourses.berkeley.edu
  • User ID format, -sid defaults to: sis_user_id. This parameter controls how Canvas interprets user IDs. See this.

(In the future, I'd consider supporting some means of having user-default parameters, so please submit a PR if you'd like!)

Options and Callback Formats

Using this as a module requires 3 parameters:

  • options: A JS object, with keys that mirror the command line arguments. Note: in this form, the only defaults that are applied are the CSV column names. The file parameter is not required.
    {
      course_id: '1268501',
      assignment_id: '7148451',
      url: 'https://bcourses.berkeley.edu/',
      token: '<token>',
      user_id_format: 'sis_user_id'
    }
  • data: This is the CSV data, as a string.
  • callback: This is called with a string, updating the progress of uploading grades. Note that it will be called quite a few times in the process uploading grades.
    • WARNING This will be updated to have a signature like (err, resp) very soon.

Tips

  • If you want to test things, use http://<domain>.beta.instructure.com/
    • Instructure's beta instances have a separate DB that is supposed to be purged and refreshed each week.