Skip to content

josephclander/canvas-speedgrader-response-capture

Repository files navigation

Canvas SpeedGrader Individual Response Capture

A small Python tool to collect individual student question level response data from Canvas SpeedGrader and export it to a flattened CSV.

In the Canvas UI, SpeedGrader shows per student question responses, but loading each student can take several seconds. This makes manual review or data extraction slow at scale. This tool automates that process using Playwright and captures the same network responses the browser receives.

What this does

  • Logs into Canvas using a real browser session
  • Opens SpeedGrader for a specific course and assignment
  • Clicks through each student in SpeedGrader
  • Captures Learnosity question response data from network requests
  • Enriches each response with student ID and name
  • Saves all student data into a single JSON file
  • Converts that JSON into a flattened CSV where each question is one row
  • The result is a CSV suitable for analysis in Excel, Google Sheets, or a data tool.

How it works

The project is split into three scripts, each with a clear role.

  1. login.py
  • Handles Canvas authentication.
  • Opens a Chromium browser using Playwright
  • Allows you to complete Canvas login and MFA manually
  • Saves the authenticated session to storage_state.json
  • Reuses the saved session on future runs until it expires
  • You only need to log in again if the session becomes invalid.
  1. speedgrader_capture.py
  • Automates SpeedGrader and captures student responses.
  • Opens SpeedGrader for a given course and assignment
  • Waits for speed_grader.json to load to build a student ID to name map
  • Iterates through students using the Next Student button
  • Detects and skips students with no submission
  • Listens for Learnosity questionresponses network calls
  • Attaches student ID and name to each response
  • Writes all collected data to data/studentBreakdown.json
  • The script stops once it detects it has looped back to the first student.
  1. speedgrader_data_clean.py
  • Converts raw JSON into a CSV.
  • Reads studentBreakdown.json
  • Cleans HTML from question text
  • Dynamically determines the maximum number of answer options
  • Outputs one row per student per question

Includes:

  • Student name
  • Question text
  • All answer options
  • Correct solution(s)
  • Student response(s)
  • The output is written to data/studentBreakdownParsed.csv.

Requirements

  • Python 3.9 or later
  • Playwright
  • Chromium browser (installed via Playwright)

Installation

  1. Create and activate a virtual environment (recommended)
    python -m venv .venv
    source .venv/bin/activate  # macOS / Linux
    # .venv\Scripts\activate   # Windows
  1. Install dependencies
    pip install -r requirements.txt
    playwright install

Configuration

Edit the following values in speedgrader_capture.py:

    COURSE_ID = 100
    ASSIGNMENT_ID = 123
    CANVAS_DOMAIN = "https://yourinstitution.instructure.com"

Replace these with the correct values for your Canvas instance.

Usage

  1. Run the login script and complete Canvas login:
    python login.py
  1. Capture all student responses from SpeedGrader:
    python speedgrader_capture.py
  1. Convert the captured JSON to CSV:
    python speedgrader_data_clean.py

After completion, your data will be available in the data folder.

Output files

data/studentBreakdown.json

Raw captured Learnosity responses enriched with student metadata.

data/studentBreakdownParsed.csv

Flattened CSV with one row per question per student.

Notes and limitations

  • Playwright is pinned to a specific version to avoid breaking changes.
  • This relies on Canvas UI behaviour and network responses. Changes to Canvas or Learnosity endpoints may break it.
  • The browser runs in non headless mode so you can see progress and troubleshoot.
  • This is not an official Canvas API integration.
  • Use responsibly and in line with your institution’s data and privacy policies.

Intended use

This tool is intended for analysis, QA, or internal review workflows where SpeedGrader UI access is too slow for large cohorts. It mirrors what a human user can see in the browser, but automates the repetitive parts.

About

Automates collection of per student, per question response data from Canvas SpeedGrader and exports it to CSV.

Resources

License

Stars

Watchers

Forks

Contributors

Languages