Skip to content

The Aspects Plugin for Tutor

Aspects Learner Analytics integrates several open-source tools to add powerful analytics and reporting capabilities to the Open edX platform. This plugin enables seamless installation, configuration, and deployment of these tools via Tutor. The tools integrated by Aspects are:

  • ClickHouse: A fast and scalable analytics database.
  • Apache Superset: A data visualization and exploration platform.
  • OpenFUN Ralph: A Learning Record Store that validates and stores xAPI statements in ClickHouse.
  • Vector: A tool for forwarding logs and xAPI data to ClickHouse.
  • Event-Routing-Backends: An Open edX plugin that transforms tracking logs into xAPI and forwards them to Learning Record Stores in near real-time.
  • dbt: A SQL-based data pipeline builder, utilizing the aspects-dbt project.

For more information, refer to the Aspects architecture documentation.

Key Features

  • Streamlined deployment of analytics and reporting tools.
  • Integration with Open edX for real-time and historical data analytics.
  • Extensible architecture supporting customization.
  • Open edX Teak or higher: In-context metrics in Studio.

Compatibility

Current versions of the plugin are compatible with Tutor 19.0.0 and later and support Open edX releases from Sumac onward. Older releases can support Open edX versions as far back as Nutmeg. Details are available in the Aspects Documentation.

Breaking Changes

As of Aspects V4 the default data pipeline has changed from Ralph to Vector. This change improves performance and simplifies the architecture by eliminating the need to scale multiple Ralph containers and Celery workers for high-throughput scenarios.

Key changes:

  • Vector is now the default for xAPI event ingestion
  • The ASPECTS_VECTOR_RAW_XAPI_TABLE setting has been replaced with ASPECTS_RAW_XAPI_TABLE
  • The default database has changed from xapi (Ralph) to openedx (Vector)

To keep using Ralph as your data pipeline:

tutor config save --set ASPECTS_XAPI_SOURCE=ralph
tutor config save --set RUN_RALPH=True
tutor config save --set RUN_VECTOR=False

This will configure Aspects to use Ralph with the xapi database, preserving your existing data.

If you have customized ASPECTS_VECTOR_RAW_XAPI_TABLE in your configuration, update it to use ASPECTS_RAW_XAPI_TABLE instead.

For new installations or users switching to Vector, your data will be stored in the openedx database. You can migrate existing data from the xapi database to openedx if needed.

Installation

Aspects is implemented as a Tutor plugin. For now, the easiest installation method is via Tutor. Follow these steps for a tutor local installation:

  1. Install Tutor: Follow the instructions at Tutor Installation Guide.

  2. Create an Admin User: Refer to the Tutor Setup Guide.

  3. Install and Enable the Plugin:

    pip install tutor-contrib-aspects
    tutor plugins enable aspects
    tutor config save
  4. Turn on In-Context Metrics (Optional): If using Open edX Teak or higher, in-context metrics can be enabled in Studio. See frontend-plugin-aspects for more information.

  5. Rebuild Docker Images:

    tutor images build openedx --no-cache
    tutor images build mfe --no-cache  # Only necessary if using in-context metrics
    tutor images build aspects aspects-superset
  6. Initialize the Environment:

    tutor local do init

Data Population Options

To visualize data:

  • Generate test data:

    tutor local do load-xapi-test-data
  • Import a demo course and create real data:

    Follow these steps.

  • Interact with the course to generate data:

    Complete a few activities within the course (e.g., enroll, take quizzes, watch videos) to generate real data. This will provide a more realistic dataset for analytics.

xAPI S3 Sink Configuration

The S3 sink serves as a backup and safeguard for xAPI events. If ClickHouse is unavailable or encounters errors during event ingestion, events are stored in S3 as a safeguard. This ensures data durability and allows you to recover missed events later using the xapi-backfill command.

To enable this backup mechanism, configure the following settings:

ASPECTS_XAPI_S3_ACCESS_KEY=openedx
ASPECTS_XAPI_S3_BUCKET=xapi-events
ASPECTS_XAPI_S3_ENDPOINT=http://minio:9000
ASPECTS_XAPI_S3_REGION=us-east-1
ASPECTS_XAPI_S3_SECRET_KEY=...

Vector S3 sink options:

ASPECTS_XAPI_S3_SINK_MAX_EVENTS=10000
ASPECTS_XAPI_S3_SINK_TIMEOUT_SECS=600

Note

  • ASPECTS_XAPI_S3_SINK_MAX_EVENTS controls how many events are batched before writing to S3
  • ASPECTS_XAPI_S3_SINK_TIMEOUT_SECS controls how long to wait before flushing a batch
  • Setting ASPECTS_XAPI_S3_SINK_TIMEOUT_SECS too low can create many small files in S3

xAPI S3 Backfill

If you have xAPI events stored in S3 (configured via ASPECTS_XAPI_S3_BUCKET), you can backfill them into ClickHouse using the xapi_block_storage_backfill command. This is useful for:

  • Restoring data from a backup
  • Importing data from another environment
  • Re-processing historical events

Basic usage:

tutor local do xapi_block_storage_backfill

By default, this imports all events. You can filter by date using year, month, day, and hour options:

tutor local do xapi_block_storage_backfill --year 2026 --month 3
tutor local do xapi_block_storage_backfill --year 2026 --month 03 --day 19
tutor local do xapi_block_storage_backfill --year 2026 --month 03 --day 19 --hour 14

For flexible path matching, use the --path option to specify a custom S3 path:

tutor local do xapi_block_storage_backfill --path xapi/2026/03/19/14/*.log.zst

Note

  • Date options accept both single and double-digit values (03 and 3 are equivalent)
  • Hour should be in 24-hour format
  • The --path option is exclusive with date options

After backfilling, you can run deduplication to remove duplicate events:

tutor local do xapi_block_storage_backfill --deduplicate

Or run deduplication separately:

tutor local do xapi-deduplicate

Warning

Deduplication uses OPTIMIZE TABLE FINAL which can be resource-intensive on large tables. Run during low-traffic periods if you have a large dataset.

  • Sync data from an existing Tutor installation with default settings:

    tutor local do dump-data-to-clickhouse --options "--object course_overviews"
    tutor local do transform-tracking-logs --source_provider LOCAL --source_config '{"key": "/openedx/data", "container": "logs", "prefix": "tracking.log"}' --transformer_type xapi

Superset and Autoscaling

Superset Assets

Aspects maintains its Superset assets (dashboards, charts, datasets) in the repository. Local changes to these assets will be overwritten during updates unless saved as new assets.

To rebuild and re-import assets:

tutor images build aspects-superset --no-cache
tutor local do import-assets

Autoscaling

Aspects supports Kubernetes autoscaling configurations for Ralph, Superset, and Superset Worker via the Pod Autoscaling plugin. Modify autoscaling settings as needed.

Contributing Charts and Dashboards

To contribute Superset assets:

  1. Fork this repository and set up a local Tutor instance with Aspects installed.

  2. You should work on the non-localized versions of the Superset dashboards. Export the new or updated dashboard(s) using Superset’s “Export” feature. It is best to export the entire dashboard instead of just charts or datasets to ensure that all of the correct changes are captured.

  3. Use the command:

    tutor aspects import_superset_zip ~/Downloads/your_file.zip
  4. Update database connection strings to use template variables.

  5. Validate and rebuild:

    tutor images build aspects-superset --no-cache
    tutor aspects check_superset_assets
    tutor local do import-assets
  6. Submit a pull request with screenshots and details of your contributions.

Release Workflow

Releases are handled by repository maintainers via GitHub Actions:

  • Trigger the Bump version and changelog action to update the version and changelog.
  • Merge the PR to initiate the release and build-image workflows.

Ensure the updated version appears on PyPI and DockerHub.

Additional Resources

About

The Open Analytics Reference System - Tutor plugin

Resources

Code of conduct

Contributing

Security policy

Stars

14 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages