[API] Improve the Canvas API tool for tracking student attendance

Problem statement:

Tracking student activity in a course has become very important since covid, especially in online courses, where it is used as a measure of student attendance. Schools are funded based on this measure! But the Canvas API has not kept up with the need to pull this data accurately.

 

The course level page view API returns ALL data requested with a student's token, including API calls made by any LTI, not just page views as the API name would suggest. This is not a good measure of student activity. It can have many false positives, and the API does not return enough data to filter out false positives. It is also slow due to rate limits on the teacher token as we request one student at a time.

/api/v1/courses/:course_id/analytics/users/:student_id/activity

 

The Course analytics Online Attendance tool solves this by using graphQL to get the data and ignore API requests, but that is not an option available to LTI creators because graphQL is not scoped. https://community.canvaslms.com/t5/Admin-Guide/How-do-I-enable-the-Course-Analytics-Online-Attendanc...

 

We have an account level API that kind of works

/api/v1/users/:user_id/page_views

It has filters for date range, but not for course, and it does not filter out API calls like the graphQL call does. So we have to pull in a huge amount of data and then filter out the page views that are not real activity in a specific course using the app_name parameter and context ID. Also, this API only works one student at a time, so if I want to make a class report, using only my single admin token, it is subject to rate limits and it takes a VERY long time to load the data. If we are generating the same report for many classes at the same time, it will often fail or take a VERY VERY long time.

Proposed solution:

Please update the course level page view API request

/api/v1/courses/:course_id/analytics/users/:student_id/activity

Add:

• Filtering by date range

• Option to only return actual page views generated by the student (like graphQL does)

• Filtering by app_name (option to exclude and include by app_name and return app_name like account level requests does)

• Use the student's AND teacher's token to request the data

Using both the student and teacher token to get the data is REALLY important because it allows us to quickly get page views for the whole class using ASYNC requests and avoid throttling. Otherwise, using just the teacher token, it takes a very long time. If we have the student token, we can use that to get the data, anyone left over that we don't have a student token for, we can get with the teacher token.

 

 

User role(s):

admin,instructor,student