platform_plugin_aspects package#
Subpackages#
- platform_plugin_aspects.extensions package
- platform_plugin_aspects.management package
- platform_plugin_aspects.settings package
- platform_plugin_aspects.sinks package
- Submodules
- platform_plugin_aspects.sinks.base_sink module
BaseSink
ClickHouseAuth
ModelBaseSink
ModelBaseSink.clickhouse_table_name
ModelBaseSink.dump()
ModelBaseSink.dump_related()
ModelBaseSink.fetch_target_items()
ModelBaseSink.get_last_dumped_timestamp()
ModelBaseSink.get_model()
ModelBaseSink.get_object()
ModelBaseSink.get_queryset()
ModelBaseSink.get_serializer()
ModelBaseSink.get_sink_by_model_name()
ModelBaseSink.is_enabled()
ModelBaseSink.model
ModelBaseSink.name
ModelBaseSink.nested_sinks
ModelBaseSink.pk_format
ModelBaseSink.queryset
ModelBaseSink.send_item()
ModelBaseSink.send_item_and_log()
ModelBaseSink.serialize_item()
ModelBaseSink.serializer_class
ModelBaseSink.should_dump_item()
ModelBaseSink.timestamp_field
ModelBaseSink.unique_key
- platform_plugin_aspects.sinks.course_overview_sink module
CourseOverviewSink
CourseOverviewSink.clickhouse_table_name
CourseOverviewSink.get_course_last_published()
CourseOverviewSink.model
CourseOverviewSink.name
CourseOverviewSink.nested_sinks
CourseOverviewSink.pk_format
CourseOverviewSink.serializer_class
CourseOverviewSink.should_dump_item()
CourseOverviewSink.timestamp_field
CourseOverviewSink.unique_key
XBlockSink
- platform_plugin_aspects.sinks.external_id_sink module
- platform_plugin_aspects.sinks.serializers module
- platform_plugin_aspects.sinks.user_profile_sink module
- platform_plugin_aspects.sinks.user_retire_sink module
- Module contents
- platform_plugin_aspects.tests package
Submodules#
platform_plugin_aspects.apps module#
platform_plugin_aspects Django application initialization.
- class platform_plugin_aspects.apps.PlatformPluginAspectsConfig(app_name, app_module)#
Bases:
AppConfig
Configuration for the aspects Django application.
- name = 'platform_plugin_aspects'#
- plugin_app = {'settings_config': {'cms.djangoapp': {'common': {'relative_path': 'settings.common'}, 'production': {'relative_path': 'settings.production'}}, 'lms.djangoapp': {'common': {'relative_path': 'settings.common'}, 'production': {'relative_path': 'settings.production'}}}, 'signals_config': {'cms.djangoapp': {'receivers': [{'receiver_func_name': 'receive_course_publish', 'signal_path': 'xmodule.modulestore.django.COURSE_PUBLISHED'}]}}, 'url_config': {'cms.djangoapp': {'namespace': '', 'regex': '^aspects/', 'relative_path': 'urls'}, 'lms.djangoapp': {'namespace': '', 'regex': '^aspects/', 'relative_path': 'urls'}}}#
- ready()#
Load modules of Aspects.
platform_plugin_aspects.signals module#
Signal handler functions, mapped to specific signals in apps.py.
- platform_plugin_aspects.signals.on_externalid_saved(sender, instance, **kwargs)#
Receives post save signal and queues the dump job.
- platform_plugin_aspects.signals.on_user_profile_updated(sender, instance, **kwargs)#
Receives post save signal and queues the dump job.
- platform_plugin_aspects.signals.on_user_retirement(sender, user, **kwargs)#
Receives a user retirement signal and queues the retire_user job.
- platform_plugin_aspects.signals.receive_course_publish(sender, course_key, **kwargs)#
Receives COURSE_PUBLISHED signal and queues the dump job.
platform_plugin_aspects.tasks module#
This file contains a management command for exporting course modulestore data to ClickHouse.
platform_plugin_aspects.urls module#
Urls for the Aspects plugin.
platform_plugin_aspects.utils module#
Utilities for the Aspects app.
- platform_plugin_aspects.utils.generate_guest_token(user, course, dashboards, filters) str #
Generate and return a Superset guest token for the user.
Raise ImproperlyConfigured if the Superset API client request fails for any reason.
- Parameters:
user – User object.
course – Course object, used to populate filters template strings.
dashboards – list of dashboard UUIDs to grant access to.
filters – list of string filters to apply.
- Returns:
Superset guest token and dashboard id. or None, exception if Superset is missconfigured or cannot generate guest token.
- Return type:
- platform_plugin_aspects.utils.generate_superset_context(context, dashboards, language=None) dict #
Update context with superset token and dashboard id.
- Parameters:
context (dict) – the context for the instructor dashboard. It must include a course_id.
user (XBlockUser or User) – the current user.
superset_config (dict) – superset config.
dashboards (list) – list of superset dashboard uuid.
filters (list) – list of filters to apply to the dashboard.
language (str) – the language code of the end user.
- platform_plugin_aspects.utils.get_ccx_courses(course_id)#
Get the CCX courses for a given course.
- platform_plugin_aspects.utils.get_detached_xblock_types()#
Import and return DETACHED_XBLOCK_TYPES.
Placed here to avoid model import at startup and to facilitate mocking them in testing.
- platform_plugin_aspects.utils.get_localized_uuid(base_uuid, language)#
Generate an idempotent uuid.
- platform_plugin_aspects.utils.get_model(model_setting)#
Load a model from a setting.
- platform_plugin_aspects.utils.get_modulestore()#
Import and return modulestore.
Placed here to avoid model import at startup and to facilitate mocking them in testing.
platform_plugin_aspects.views module#
Endpoints for the Aspects platform plugin.
- class platform_plugin_aspects.views.Course(course_id, display_name)#
Bases:
tuple
- course_id#
Alias for field number 0
- display_name#
Alias for field number 1
- class platform_plugin_aspects.views.IsCourseStaffInstructor#
Bases:
BasePermission
Permission class to use during tests.
Importing from edx-platform doesn’t work when running tests, so we declare our own permission class here.
- has_object_permission(request, view, obj)#
Return False for security; mock this out during tests.
- class platform_plugin_aspects.views.IsStaffOrReadOnly#
Bases:
BasePermission
Permission class to use during tests.
Importing from edx-platform doesn’t work when running tests, so we declare our own permission class here.
- has_object_permission(request, view, obj)#
Return False for security; mock this out during tests.
- class platform_plugin_aspects.views.SupersetView(**kwargs)#
Bases:
GenericAPIView
Superset-related endpoints provided by the aspects platform plugin.
- authentication_classes = (<class 'rest_framework.authentication.SessionAuthentication'>,)#
- get(request, *args, **kwargs)#
Return a guest token for accessing the Superset API.
- get_object()#
Return a Course-like object for the requested course_id.
- lookup_field = 'course_id'#
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>, <rest_framework.permissions.OperandHolder object>)#
platform_plugin_aspects.waffle module#
Configuration for event sink clickhouse.
platform_plugin_aspects.xblock module#
XBlock to embed Superset dashboards in Open edX.
- class platform_plugin_aspects.xblock.SupersetXBlock(runtime, field_data=None, scope_ids=<object object>, *args, **kwargs)#
Bases:
StudioEditableXBlockMixin
,XBlock
XBlock provides a way to embed dashboards from Superset in a course.
- children: ReferenceList#
- dashboard_uuid#
A field class for representing a string.
The value, as loaded or enforced, can either be None or a basestring instance.
- dashboards()#
Return an array of dashboards configured for this XBlock.
- display_name#
A field class for representing a string.
The value, as loaded or enforced, can either be None or a basestring instance.
- editable_fields = ('display_name', 'dashboard_uuid', 'filters')#
- filters#
A field class for representing a list.
The value, as loaded or enforced, can either be None or a list.
- get_superset_guest_token(request_body, suffix='')#
Return a guest token for Superset.
- render_template(template_path, context=None) str #
Render a template with the given context.
The template is translatedaccording to the user’s language.
- Parameters:
template_path – The path to the template
context – The context to render in the template
- Returns:
The rendered template
- student_view(context=None)#
Render the view shown to users of this XBlock.
- static workbench_scenarios()#
Return a canned scenario for display in the workbench.
Module contents#
Aspects plugins for edx-platform.