{"id":21258297,"url":"https://github.com/ubc/canvas-discussion","last_synced_at":"2025-10-13T15:37:51.113Z","repository":{"id":41951551,"uuid":"175499075","full_name":"ubc/canvas-discussion","owner":"ubc","description":"Outputs Canvas discussions as a CSV for specified course.","archived":false,"fork":false,"pushed_at":"2024-09-23T19:49:18.000Z","size":9990,"stargazers_count":12,"open_issues_count":10,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-11T06:02:39.377Z","etag":null,"topics":["canvas","csv","discussion","ubc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ubc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-13T21:06:46.000Z","updated_at":"2024-09-18T00:00:02.000Z","dependencies_parsed_at":"2024-04-05T01:42:55.823Z","dependency_job_id":"7a3f3d0f-b11f-4859-94a7-21729f6cd768","html_url":"https://github.com/ubc/canvas-discussion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ubc/canvas-discussion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fcanvas-discussion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fcanvas-discussion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fcanvas-discussion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fcanvas-discussion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubc","download_url":"https://codeload.github.com/ubc/canvas-discussion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fcanvas-discussion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015931,"owners_count":26085777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","csv","discussion","ubc"],"created_at":"2024-11-21T04:08:09.718Z","updated_at":"2025-10-13T15:37:51.081Z","avatar_url":"https://github.com/ubc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\u003e 💡 If you are teaching at the University of British Columbia, you may also be interested in the tool `Threadz` which provides visualizations and data from your Canvas discussion forums through a user interface in Canvas. You can learn more about the tool and how to request access in your course from the [LTHub Instructor Guide](https://lthub.ubc.ca/guides/threadz-instructor-guide/). `Threadz` was developed by Eastern Washington University.\n\n# Canvas Discussion\n\n### Data\n\u003e `{course_id}-discussion.csv`  \n\nThis project pulls data via the Canvas API the discussions for the specified Canvas course(s) and exports the results as CSV. The columns exported are:\n* 'topic_id',\n* 'topic_title',\n* 'topic_message',\n* 'topic_author_id',\n* 'topic_author_name',\n* 'topic_created_at',\n* 'topic_posted_at',\n* 'post_author_id',\n* 'post_author_name',\n* 'post_id',\n* 'post_parent_id',\n* 'post_message',\n* 'post_likes',\n* 'post_timestamp'\n\nWhere a `topic` corresponds to a `discussion_topic` and `post` refers to all replies to the `discussion_topic`. If a `discussion_topic` has no posts then you will see the `topic_` columns filled with no corresponding `post_` data. A `post` may have a `post_parent_id ` if it is part of a threaded response.\n\n### Summary Data\n\u003e `{course_id}-discussion-summary.csv`\n\nWe have calculated summary metrics for each topic. The csv with the summary information includes the following columns:\n* 'topic_id',\n* 'topic_title',\n* 'topic_author_id',\n* 'topic_author_name',\n* 'topic_created_at', \n* 'topic_posted_at',\n* 'number_of_posts': the total number of posts and replies in the topic\n* 'median_posts_word_count': the median word count for all posts and replies to the topic\n* 'average_time_to_post_hours': the average time to post or reply from the topic created_at date\n* 'first_reply_timestamp': the timestamp of the first post\n* 'average_time_to_post_from_first_reply_hours': the average time to post or reply from the first post (for cases where all discussions are released at once, this may be a more meaningful metric of time to reply)\n* 'average_posts_per_author': the average posts per author (does not include enrollments with no posts)\n\nWhere a `post` is a response to a topic, and a `reply` is a reply to the post. \n\n![alt text](image-1.png)\n\n\u003e `{course_id}-module-discussion-summary.csv`\n\nWe have calculated summary metrics at the level of `module` where there are multiple discussion topics. This is optional (see .env creation above) The csv with the summary information includes the following columns:\n* 'module_id',\n* 'module_name',\n* 'module_unlock_at': assuming the course uses an unlock_at date this will be used to calculate,\n* 'number_of_posts': the total number of posts and replies in the module\n* 'median_posts_word_count': the median word count for all posts and replies to the module topics\n* 'average_time_to_post_hours': the average time to post or reply from the module_unlock_at date\n* 'first_reply_timestamp': the timestamp of the first post\n* 'average_time_to_post_from_first_reply_hours': the average time to post or reply from the first post (for cases where all discussions are released at once, this may be a more meaningful metric of time to reply)\n* 'average_posts_per_author': the average posts per author (does not include enrollments with no posts)\n\n\n## Getting Started\nThese instructions will get you a copy of the project up and running on your local machine for use with your own API tokens and Canvas domains.\n\n### Prerequisites\n\n1. **Install [Node 10 or greater](https://nodejs.org)**.\n1. **Install [Git](https://git-scm.com/downloads)**.\n\n### Installation and execution of script\n\n1. Clone this repo. `git clone https://github.com/ubccapico/canvas-discussion.git`\n1. Then cd into the repo. `cd canvas-discussion`\n1. Run the installation script. `npm install` (If you see `babel-node: command not found`, you've missed this step.)\n1. Generate Canvas API token and copy it to clipboard\n    \u003e - See [Get Started with the Canvas API](https://learninganalytics.ubc.ca/guides/get-started-with-the-canvas-api/) for more information.\n    \u003e - ⚠️ Your Canvas API token is the equivalent to your username and password and must be treated as such (following any security guidelines of your home institution).\n1. Create a `.env` file.\n1. Add the following: `CANVAS_API_TOKEN={YOUR API TOKEN}`, `CANVAS_API_DOMAIN={YOUR API DOMAIN}`, `COURSE_IDS={YOUR COURSE ID(s)}`. \u003e - At UBC the `CANVAS_API_DOMAIN` is `https://ubc.instructure.com/api/v1`\n    \u003e - At another institution it might be something like `https://{school}.instructure.com/api/v1`\n1. Add `INCLUDE_MODULE_SUMMARY=true` (or `INCLUDE_MODULE_SUMMARY=false`) to indicate whether you would like to include a summary grouped by module. If this is not in the .env it will default to false and no module summary will be created. \n\n    Your .env file should look like\n    ```\n    CANVAS_API_TOKEN=22322...\n    CANVAS_API_DOMAIN=https://ubc.instructure.com/api/v1\n    COURSE_IDS=1111,1112\n    INCLUDE_MODULE_SUMMARY=false\n    ```\n1. Run the script. `npm start`.\n1. A `{course_id}-discussion.csv` and a ` {course_id}-discussion-summary.csv` file should be generated with discussion data in the output folder for each provided course_id. If you have set `INCLUDE_MODULE_SUMMARY` to `true` then you will also see a file `{course_id}-module-discussion-summary.csv`. \n\n## Authors\n\n* [justin0022](https://github.com/justin0022) -\n**Justin Lee** \u0026lt;justin.lee@ubc.ca\u0026gt;\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fcanvas-discussion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubc%2Fcanvas-discussion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fcanvas-discussion/lists"}