Skip to main content

Aspects plugin for Tutor

Project description

Aspects Learner Analytics combines several free, open source, tools to add analytics and reporting capabilities to the Open edX platform. This plugin offers easy installation, configuration, and deployment of these tools using Tutor. The tools Aspects uses are:

  • ClickHouse, a fast, scalable analytics database that can be run anywhere

  • Apache Superset, a data visualization platform and data API

  • OpenFUN Ralph, a Learning Record store (and more) that can validate and store xAPI statements in ClickHouse

  • Vector, a log forwarding tool that can be used to forward tracking log and xAPI data to ClickHouse

  • event-routing-backends, an Open edX plugin that transforms tracking logs into xAPI and optionally forwards them to one or more Learning Record Stores in near real time

  • event-sink-clickhouse, an Open edX plugin that exports course structure and high level data to ClickHouse at publish time

  • dbt, a tool to build data pipelines from SQL queries. The dbt project used by this plugin is aspects-dbt.

See https://github.com/openedx/openedx-aspects for more details about the Aspects architecture and high level documentation.

Aspects is a community developed effort combining the Cairn project by Overhang.io and the OARS project by EduNEXT, OpenCraft, and Axim Collaborative.

Note: Aspects is in heavy development and not yet production ready! Please feel free to experiment with the system and offer feedback about what you’d like to see by adding Issues in this repository.

Compatibility

This plugin is compatible with Tutor 15.0.0 and later and is expected to be compatible with Open edX releases from Nutmeg forward.

Installation

The Aspects project can be installed in a Tutor environment with the following command

pip install tutor-contrib-aspects

Or to install the main branch you can:

::

pip install git+https://github.com/openedx/tutor-contrib-aspects

Usage

  1. Enable the plugins:

    tutor plugins enable aspects
  2. Save the changes to the environment:

    tutor config save
  3. Because we’re installing a new app in LMS (event-routing-backends) you will need to rebuild your openedx image:

    tutor images build openedx
  4. Run the initialization scripts in your chosen environment (dev or local):

    tutor [dev|local] do init
  5. (Optional) Load test xAPI data into Ralph/Clickhouse/Superset (with --help for usage):

    tutor [dev|local] do load-xapi-test-data
  6. (Optional) Sink course data from the LMS to clickhouse (see https://github.com/openedx/openedx-event-sink-clickhouse for more information):

    tutor [dev|local] do dump-courses-to-clickhouse --options "--force"
    # If you already have some courses in your clickhouse sink, its better to drop --options "--force" as it will create duplicates of the pre-existing courses.
  7. (Optional) Sink Historical event data to ClickHouse:

    tutor [dev|local] run lms ./manage.py lms transform_tracking_logs --source_provider LOCAL --source_config '{"key": "/openedx/data", "container": "logs", "prefix": "tracking.log"}' --transformer_type xapi
    # Note that this will work only for default tutor installation. If you store your tracking logs any other way, you need to change the source_config option accordingly.
    # See https://event-routing-backends.readthedocs.io/en/latest/howto/how_to_bulk_transform.html#sources-and-destinations for details on how to change the source_config option.

Superset Assets

Aspects maintains the Superset assets in this repository, specifically the dashboards, charts, datasets, and databases. That means that any updates made here will be reflected on your Superset instance when you update your deployment.

But it also means that any local changes you make to these assets will be overwritten when you update your deployment. To prevent your local changes from being overwritten, please create new assets and make your changes there instead. You can copy an existing asset by editing the asset in Superset and selecting “Save As” to save it to a new name.

Sharing Charts and Dashboards

To share your charts with others in the community, use Superset’s “Export” button to save a zip file of your charts and related datasets.

To import charts or dashboards shared by someone in the community:

  1. Expand the zip file and look for any files added under databases. Update the sqlalchemy_uri to match your database’s connection details.

  2. Compress the files back into a .zip file.

  3. On the Charts or Dashboards page, use the “Import” button to upload your .zip file.

Contributing Charts and Dashboards to Aspects

The Superset assets provided by Aspects can be found in the templated assets.yaml file. For the most part, these files what Superset exports, but with some crucial differences which make these assets usable across all Tutor deployments.

To contribute assets to Aspects:

  1. Export the assets you want to contribute as described in Sharing Charts and Dashboards

  2. Expand the .zip file.

  3. Update any database connection strings to use Tutor configuration template variables instead of hard-coded strings, e.g. replace clickhouse with {{CLICKHOUSE_HOST}}. Passwords can be left as {{CLICKHOUSE_PASSWORD}}, though be aware that if you are adding new databases, you’ll need to update SUPERSET_DB_PASSWORDS in the init scripts. Here is the default connection string for reference:

    ``clickhousedb+connect://{{CLICKHOUSE_REPORT_URL}}``
  4. Remove any metadata.yaml files from the export. We generate these as needed during import.

  5. Merge your exported files into the directories and files in the assets.yaml.

  6. Submit a PR with screenshots of your new chart or dashboards, along with an explanation of what data question they answer.

Virtual datasets in Superset

Superset supports creating virtual datasets, which are datasets defined using a SQL query instead of mapping directly to an underlying database object. Aspects leverages virtual datasets, along with SQL templating, to make better use of table indexes.

To make it easier for developers to manage virtual datasets, there is an extra step that can be done on the output of tutor aspects serialize. The sql section of the dataset yaml can be moved to its own file in the queries directory and included in the yaml like so:

sql: "{% include 'openedx-assets/queries/query.sql' %}"

However, please keep in mind that the assets declaration is itself a jinja template. That means that any jinja used in the dataset definition should be escaped. There are examples of how to handle this in the existing queries, such as dim_courses.sql.

License

This software is licensed under the terms of the AGPLv3.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tutor-contrib-aspects-0.19.0.tar.gz (68.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tutor_contrib_aspects-0.19.0-py3-none-any.whl (124.5 kB view details)

Uploaded Python 3

File details

Details for the file tutor-contrib-aspects-0.19.0.tar.gz.

File metadata

  • Download URL: tutor-contrib-aspects-0.19.0.tar.gz
  • Upload date:
  • Size: 68.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for tutor-contrib-aspects-0.19.0.tar.gz
Algorithm Hash digest
SHA256 aa2f830c94a7c65132d589ffa984709e29f500a5947b0cf84e0ebc89af3562c2
MD5 4e2f2128041f782b22198286050dc7a4
BLAKE2b-256 4c8f170947060e8f99f5d4f3f978f546028d5dce2fba5b5ab106aa575ff58a53

See more details on using hashes here.

File details

Details for the file tutor_contrib_aspects-0.19.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tutor_contrib_aspects-0.19.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d70c5c590465866a2b8ed68ef290cb17561757489727d0c4fc036df8829d567
MD5 34e6073b165951b6b522151dfa29e9a8
BLAKE2b-256 41a2ae5aed8143f7b95e4c2f831e1a12c9fb45b4cb7bf3a76856000e60a7ade7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page