Retrieving student responses to Quiz using canvasapi

Kevin_Healy
Community Member

My academic department is planning to deploy a program assessment to all Canvas courses taught by department faculty members. The assessment will take the form of a short (original-style) Quiz that will be imported into all faculty Canvas courses. The quiz will have the same title in all courses.

After students complete the quiz, we want to retrieve all student responses for analysis using Python through the canvasapi library. If anyone has developed a Python script that already does this or something like it, I'd love to hear about it.

If not, I'm hoping to get a bit of help on a Python command sequence I've been working on to do the job.

I'm relatively new to the Canvas API. I've learned enough of the canvasapi library to figure out how to identify quizzes by title, and generate the Item Analysis report which contains the student responses to each question in CSV format.

I am stuck at the point of retrieving the CSV file that was generated by calling quiz.create_report(). I see there is a file id and a URL for the file embedded in the quiz.get_quiz_report() metadata. However, course.get_file() retrieves JSON-formatted data. So this command appears incompatible with the Item Analysis report in CSV format.

  • Am I approaching this wrong?
  • Is there another way to retrieve the student responses to each question?
  • Is there a method for reading the CSV file directly into a Python data structure instead of downloading what is likely to be many dozens of Item Analysis reports, one from each course?

Thank you in advance for any solutions you can provide,
Kevin Healy
Mesa Community College, Mesa AZ

0 Likes