cancel
Showing results for 
Search instead for 
Did you mean: 
ryucali
Surveyor II

Identify if an assignment counts towards final grade from Canvas Data

Jump to solution

I want to identify from Canvas Data if "do not count this assignment towards the final grade" is checked for any assignment, but I don't find this info from assignment_dim/fact tables. Is there anyway to get this information from the data?

Actually this question applies to some other checkboxes in assignment/quiz/module setup stage as well, such as "Show one question at a time" in a quiz setup.

Labels (4)
0 Kudos
1 Solution

Accepted Solutions

@ryucali 

The current version of Canvas Data does not include any way to infer the information.

The API approach is not efficient, but it is all that you currently have to work with until Canvas Data 2 comes out. Live Events won't help in this case anyway.

The good news is that you would only need to download the assignment information once for completed courses since the information wouldn't be changing. You may want to periodically refresh the status for current courses.

You can use GraphQL to quickly get the omitFromFinalGrade property without having to download all of the other information that would come with the Assignments API. You would need to repeat this once for each course using the ID for the course.

query assignmentQuery {
  course(id: "3119582") {
    assignmentsConnection {
      nodes {
        _id
        omitFromFinalGrade
      }
    }
  }
}

  

You can also run the report for all classes within a subaccount at one time, but it will likely timeout (especially if you run it for the root account) and force you to use pagination. This query returns information for the first 500 courses (use your account ID) and pagination information needed to continue.

query allAssignmentsQuery {
  account(id: "97773") {
    id
    coursesConnection(first: 500) {
      nodes {
        _id
        assignmentsConnection {
          nodes {
            _id
            omitFromFinalGrade
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

 

This includes information for courses that are deleted as there is no way to filter on Canvas' implementation of GraphQL. However, it took me under 10 seconds to fetch the results for the first 500 courses. It took me 35 seconds to get the first 1000 courses and I thought Canvas was going to complain and fail, so I cut the number back. The first query -- for a single course -- took under 400 ms. Your speeds will likely vary.

For additional requests, use the endCursor that is returned to make the next request. For example, my hasNextPage was true and my endCursor from the previous request was "NTAw". So in my second request, I specified that on the coursesConnection line.

    coursesConnection(first: 500, after: "NTAw") {

 

View solution in original post

4 Replies
James
Navigator II

@ryucali 

There are various sources of information in Canvas (API, Canvas Data, Live Events, GraphQL via the API) and the data coverage is different for each of them. Canvas Data does not contain the information that you want, but you could get it through the API and store it in your own local tables that you could then combine with Canvas Data.

Here is a similar question from a couple of years ago with a little more information: Assignment Counts Towards Final Grade

ryucali
Surveyor II

@James Thanks for the timely response! My use case is institutional research which evaluates thousands of courses at once (instead of looking at a few courses/assignments), so the API approach doesn't seem to be efficient. Also we don't have Live Events. Do you think there's an indirect way of inferring this information from different parts of Canvas Data?

Hi @ryucali --

Canvas Data 2 (beta schema documentation) will provide much more detail about assignments, and I expect it will give you what you need. At this point I wouldn't build anything new using legacy Canvas Data as it'll all have to be rewritten for Canvas Data 2. 

It's a pain to have to wait for CD2, but it'll be much more useful for use cases like yours when it is available. 

--Colin

 

Tags (2)

@ryucali 

The current version of Canvas Data does not include any way to infer the information.

The API approach is not efficient, but it is all that you currently have to work with until Canvas Data 2 comes out. Live Events won't help in this case anyway.

The good news is that you would only need to download the assignment information once for completed courses since the information wouldn't be changing. You may want to periodically refresh the status for current courses.

You can use GraphQL to quickly get the omitFromFinalGrade property without having to download all of the other information that would come with the Assignments API. You would need to repeat this once for each course using the ID for the course.

query assignmentQuery {
  course(id: "3119582") {
    assignmentsConnection {
      nodes {
        _id
        omitFromFinalGrade
      }
    }
  }
}

  

You can also run the report for all classes within a subaccount at one time, but it will likely timeout (especially if you run it for the root account) and force you to use pagination. This query returns information for the first 500 courses (use your account ID) and pagination information needed to continue.

query allAssignmentsQuery {
  account(id: "97773") {
    id
    coursesConnection(first: 500) {
      nodes {
        _id
        assignmentsConnection {
          nodes {
            _id
            omitFromFinalGrade
          }
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

 

This includes information for courses that are deleted as there is no way to filter on Canvas' implementation of GraphQL. However, it took me under 10 seconds to fetch the results for the first 500 courses. It took me 35 seconds to get the first 1000 courses and I thought Canvas was going to complain and fail, so I cut the number back. The first query -- for a single course -- took under 400 ms. Your speeds will likely vary.

For additional requests, use the endCursor that is returned to make the next request. For example, my hasNextPage was true and my endCursor from the previous request was "NTAw". So in my second request, I specified that on the coursesConnection line.

    coursesConnection(first: 500, after: "NTAw") {

 

View solution in original post