5.1.2 Reading: Harvesting Discussion Data

The co-developer of this course, Dr. Brian Reid, wrote an userscript that gathers the discussion data for all discussion topics in a course. Course instructors can install the userscript and creates a csv file that can be saved on your local computer.

  1. Install a browser add-on: Greasemonkey for Firefox or Tampermonkey for Chrome/Safari. Please skip this step if you have already installed the add-on previously.
  2. Install the Get Discussion Data userscript.
  3. Login into Canvas, open a Canvas course that contains discussion activities, click on the ‘Discussions’ navigation tab, scroll down to the bottom of the discussion page, click on the ‘Get Discussion Entries’ tab, select “Generate one file with interactions”, and save the data in a csv file format. Each of the four column headers refers to:
    reply_author – from, initial_entry_author – to, reply_word_count – weight, topic_id – group
  4. Open the networkgraph app Links to an external site., load the csv file to the app. The discussion data is now presented in directed weighted network diagrams.

DT1-1024x417.png

  • The degree of a node (size of an orange circle) corresponds to the quantity of interactions associated with the node. You may adjust the size of nodes using the slider (control widget).
  • The weight of an edge (thickness of a directed link) represents the length of an interaction, in this case, it corresponds to the word count of a reply message. You may adjust the thickness of links using the weight control widget.
  • “edge.betweeness.community algorithm” – an approach to community detection in social network is applied to detect groups that consist of densely connected nodes with fewer connections across groups.
  • You can select a group to examine student discussion interactions within the network.
  • You can select an individual student and examine his/her discussion activities in relationship to overall discussion interactions.

 

Canvas admin can query against discussion APIs to gather discussion interaction data for a list of specified courses. A complete script is available at https://github.com/jingmayer/garden Links to an external site.. What the script does is to gather the info for thread reply and initial thread author, and generates a weighted edge list (from, to, weight) in a csv file format. We can load the file in R and draw a network diagram using igraph package.
...
canvas = Canvas::API.new(:host => "https://your.canvas.domain", :token => "your token")
#gather course id info
courses = canvas.get("/api/v1/courses?per_page=50")
...         
#plug the course id and gather the discussion_topics info in the course      
...
            discussions = canvas.get("/api/v1/courses/#{course["id"]}/discussion_topics?per_page=50")
  ...
       #gather discussion entries           
    ...
               entry=canvas.get("/api/v1/courses/#{course["id"]}/discussion_topics/#{ct["id"]}/entries?per_page=50")
    ...
      #gather discussion replies info  
       ...
                    reply=canvas.get("/api/v1/courses/#{course["id"]}/discussion_topics/#{ct["id"]}/entries/#{et["id"]}/replies?per_page=50")
  ...

List Discussion Topics:  GET /api/v1/courses/:course_id/discussion_topics

{
  "unread_entries": [1,3,4],
  "entry_ratings": {3: 1},
  "forced_entries": [1],
  "participants": [
    { "id": 10, "display_name": "user 1", "avatar_image_url": "https://...", "html_url": "https://..." },
    { "id": 11, "display_name": "user 2", "avatar_image_url": "https://...", "html_url": "https://..." }
  ],
  "view": [
    { "id": 1, "user_id": 10, "parent_id": null, "message": "...html text...", "replies": [
      { "id": 3, "user_id": 11, "parent_id": 1, "message": "...html....", "replies": [...] }
    ]},
    { "id": 2, "user_id": 11, "parent_id": null, "message": "...html..." },
    { "id": 4, "user_id": 10, "parent_id": null, "message": "...html..." }
  ]
}

List Topic Entries: GET /api/v1/courses/:course_id/discussion_topics/:topic_id/entries

{
    "id": 1016,
    "user_id": 7086,
    "user_name": "nobody@example.com",
    "message": "first top-level entry",
    "read_state": "unread",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:32:29Z",
    "recent_replies": [
      {
        "id": 1017,
        "user_id": 7086,
        "user_name": "nobody@example.com",
        "message": "Reply message",
        "created_at": "2011-11-03T21:32:29Z"
      } ],
    "has_more_replies": false }

List Entry Replies: GET /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/replies

[ {
    "id": 1015,
    "user_id": 7084,
    "user_name": "nobody@example.com",
    "message": "Newer message",
    "read_state": "read",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:27:44Z" },
  {
    "id": 1014,
    "user_id": 7084,
    "user_name": "nobody@example.com",
    "message": "Older message",
    "read_state": "unread",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:26:44Z" } ]