Skip to content

Instantly share code, notes, and snippets.

@viadanna
Last active April 26, 2022 10:48
Show Gist options
  • Save viadanna/3420c6afe794a58d29d3937cb63f42a4 to your computer and use it in GitHub Desktop.
Save viadanna/3420c6afe794a58d29d3937cb63f42a4 to your computer and use it in GitHub Desktop.
Handout for Periodic Reports Workshop

Periodic Reports Workshop

Welcome to the workshop. Here we'll get a hands-on approach on creating periodic reports on a sandbox provided by OpenCraft.

Sandbox Instructions

  1. Register an account on the provided sandbox

https://lilac-periodic-reports.opencraft.hosting

  1. Create some instructor reports by joining the Demo course and navigating to the Instructor tab > Data Download

https://lilac-periodic-reports.opencraft.hosting/courses/course-v1:edX+DemoX+Demo_Course/instructor#view-data_download

  1. Now let's check out the Periodic Reports Administration

https://lilac-periodic-reports.opencraft.hosting/admin/periodic_instructor_reports/

  1. Create a schedule for one of the tasks

https://lilac-periodic-reports.opencraft.hosting/admin/periodic_instructor_reports/periodicreportschedule/add/

4.1. Pick a Task, your user as Owner, and set the interval for every minute.

4.2. Make sure to add the Demo course by adding ["course-v1:edX+DemoX+Demo_Course"] to the Course ids.

4.3. If you select the profile information task, ensure to add [['email', 'username']] to the Arguments.

4.4 Add a prefix for your generated reports.

4.5 Select a folder structure:

regular - the usual way of the reports are uploaded by the edX platform, uses the hashed course ID, prefix and report name
by_date - similar to regular, but instead of the hashed course ID, the current date (yyyy-mm-dd format) will be used
flat - no intermediate folders will be used, only the prefix and report name

Adding new report types

  1. Pick a task in edx-platform/lms/djangoapps/instructor_task/api.py you want to compatible with periodic reports.

  2. Extend the task_input of the report function with **kwargs as this task does.

  3. Ensure the called task can upload files to a custom location.

  4. Fix tests and update documentation.

  5. Pronto!

For an example, check this commit: https://github.com/openedx/edx-platform/commit/4d975899846df0671ca8faca8a9c1a5c6cecb76f

Getting this working in your own instance

  1. Ensure the instance is using Redis for Celery
CELERY_BROKER_TRANSPORT: redis
  1. Add the necessary configuration to /edx/etc/lms.yml
ENABLE_CELERY_BEAT: true
CELERYBEAT_SCHEDULER: 'django_celery_beat.schedulers:DatabaseScheduler'
ADDL_INSTALLED_APPS:
- django_celery_beat
  1. Install the plugin
$ pip install git+https://github.com/open-craft/[email protected]#egg=periodic-instructor-reports
  1. Restart the LMS and lms-worker services

More information at https://github.com/open-craft/periodic-instructor-reports/blob/main/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment