platform-plugin-aspects 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- platform_plugin_aspects/__init__.py +11 -0
- platform_plugin_aspects/apps.py +77 -0
- platform_plugin_aspects/conf/locale/babel_mako.cfg +10 -0
- platform_plugin_aspects/conf/locale/config.yaml +85 -0
- platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.mo +0 -0
- platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.po +99 -0
- platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.mo +0 -0
- platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.po +23 -0
- platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.mo +0 -0
- platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.po +70 -0
- platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.mo +0 -0
- platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.po +23 -0
- platform_plugin_aspects/extensions/__init__.py +0 -0
- platform_plugin_aspects/extensions/filters.py +108 -0
- platform_plugin_aspects/management/__init__.py +0 -0
- platform_plugin_aspects/management/commands/__init__.py +0 -0
- platform_plugin_aspects/management/commands/dump_data_to_clickhouse.py +214 -0
- platform_plugin_aspects/management/commands/load_test_tracking_events.py +310 -0
- platform_plugin_aspects/management/commands/monitor_load_test_tracking.py +440 -0
- platform_plugin_aspects/settings/__init__.py +0 -0
- platform_plugin_aspects/settings/common.py +147 -0
- platform_plugin_aspects/settings/production.py +38 -0
- platform_plugin_aspects/signals.py +305 -0
- platform_plugin_aspects/sinks/__init__.py +11 -0
- platform_plugin_aspects/sinks/base_sink.py +381 -0
- platform_plugin_aspects/sinks/course_enrollment_sink.py +20 -0
- platform_plugin_aspects/sinks/course_overview_sink.py +286 -0
- platform_plugin_aspects/sinks/external_id_sink.py +20 -0
- platform_plugin_aspects/sinks/serializers.py +274 -0
- platform_plugin_aspects/sinks/tag_sink.py +47 -0
- platform_plugin_aspects/sinks/user_profile_sink.py +20 -0
- platform_plugin_aspects/sinks/user_retire_sink.py +50 -0
- platform_plugin_aspects/static/css/superset.css +53 -0
- platform_plugin_aspects/static/html/superset.html +39 -0
- platform_plugin_aspects/static/html/superset_student.html +5 -0
- platform_plugin_aspects/static/js/embed_dashboard.js +94 -0
- platform_plugin_aspects/static/js/install_required.js +11 -0
- platform_plugin_aspects/static/js/superset.js +38 -0
- platform_plugin_aspects/tasks.py +64 -0
- platform_plugin_aspects/templates/instructor_dashboard/aspects.html +22 -0
- platform_plugin_aspects/urls.py +39 -0
- platform_plugin_aspects/utils.py +359 -0
- platform_plugin_aspects/views.py +296 -0
- platform_plugin_aspects/waffle.py +5 -0
- platform_plugin_aspects/xblock.py +239 -0
- platform_plugin_aspects-2.0.1.dist-info/METADATA +335 -0
- platform_plugin_aspects-2.0.1.dist-info/RECORD +51 -0
- platform_plugin_aspects-2.0.1.dist-info/WHEEL +5 -0
- platform_plugin_aspects-2.0.1.dist-info/entry_points.txt +8 -0
- platform_plugin_aspects-2.0.1.dist-info/licenses/LICENSE +201 -0
- platform_plugin_aspects-2.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"""XBlock to embed Superset dashboards in Open edX."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib.resources
|
|
6
|
+
import json
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
|
|
10
|
+
from django.core.exceptions import ImproperlyConfigured
|
|
11
|
+
from django.utils import translation
|
|
12
|
+
from web_fragments.fragment import Fragment
|
|
13
|
+
from webob import Response
|
|
14
|
+
from xblock.core import XBlock
|
|
15
|
+
from xblock.exceptions import JsonHandlerError
|
|
16
|
+
from xblock.fields import List, Scope, String
|
|
17
|
+
|
|
18
|
+
# These moved from xblockutils to xblock in Quince, these can be removed
|
|
19
|
+
# when we stop supporting earlier versions.
|
|
20
|
+
try: # pragma: no cover
|
|
21
|
+
from xblock.utils.resources import ResourceLoader
|
|
22
|
+
from xblock.utils.studio_editable import StudioEditableXBlockMixin
|
|
23
|
+
except ImportError: # pragma: no cover
|
|
24
|
+
from xblockutils.resources import ResourceLoader
|
|
25
|
+
from xblockutils.studio_editable import StudioEditableXBlockMixin
|
|
26
|
+
|
|
27
|
+
from .utils import (
|
|
28
|
+
DEFAULT_FILTERS_FORMAT,
|
|
29
|
+
_,
|
|
30
|
+
generate_guest_token,
|
|
31
|
+
generate_superset_context,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
log = logging.getLogger(__name__)
|
|
35
|
+
loader = ResourceLoader(__name__)
|
|
36
|
+
|
|
37
|
+
# Course roles, as reported by edx-platform, that may access Superset dashboards.
|
|
38
|
+
# Global staff are reported as "instructor".
|
|
39
|
+
COURSE_STAFF_ROLES = ("staff", "instructor")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@XBlock.needs("user")
|
|
43
|
+
@XBlock.needs("i18n")
|
|
44
|
+
class SupersetXBlock(StudioEditableXBlockMixin, XBlock):
|
|
45
|
+
"""
|
|
46
|
+
XBlock provides a way to embed dashboards from Superset in a course.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
editable_fields = ("display_name", "dashboard_uuid", "filters")
|
|
50
|
+
|
|
51
|
+
display_name = String(
|
|
52
|
+
display_name=_("Display name"),
|
|
53
|
+
help=_("Display name"),
|
|
54
|
+
default=_("Superset Dashboard"),
|
|
55
|
+
scope=Scope.settings,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
dashboard_uuid = String(
|
|
59
|
+
display_name=_("Dashboard UUID"),
|
|
60
|
+
help=_(
|
|
61
|
+
"The ID of the dashboard to embed. Available in the Superset embed dashboard UI."
|
|
62
|
+
),
|
|
63
|
+
default="",
|
|
64
|
+
scope=Scope.settings,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
filters = List(
|
|
68
|
+
display_name=_("Filters"),
|
|
69
|
+
help=_("""List of SQL filters to apply to the
|
|
70
|
+
dashboard. E.g: ["org='edX'", "country in ('us', 'co')"]
|
|
71
|
+
The fields used here must be available on every dataset used by the dashboard.
|
|
72
|
+
"""),
|
|
73
|
+
default=[],
|
|
74
|
+
scope=Scope.settings,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def dashboards(self):
|
|
78
|
+
"""
|
|
79
|
+
Return an array of dashboards configured for this XBlock.
|
|
80
|
+
"""
|
|
81
|
+
if self.dashboard_uuid:
|
|
82
|
+
return [{"name": self.display_name, "uuid": self.dashboard_uuid}]
|
|
83
|
+
else:
|
|
84
|
+
return []
|
|
85
|
+
|
|
86
|
+
def render_template(self, template_path, context=None) -> str:
|
|
87
|
+
"""
|
|
88
|
+
Render a template with the given context.
|
|
89
|
+
|
|
90
|
+
The template is translatedaccording to the user's language.
|
|
91
|
+
|
|
92
|
+
args:
|
|
93
|
+
template_path: The path to the template
|
|
94
|
+
context: The context to render in the template
|
|
95
|
+
|
|
96
|
+
returns:
|
|
97
|
+
The rendered template
|
|
98
|
+
"""
|
|
99
|
+
return loader.render_django_template(
|
|
100
|
+
template_path, context, i18n_service=self.runtime.service(self, "i18n")
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def user_is_student(self, user) -> bool:
|
|
104
|
+
"""
|
|
105
|
+
Check if the user is a student.
|
|
106
|
+
"""
|
|
107
|
+
return not user or user.opt_attrs.get("edx-platform.user_role") == "student"
|
|
108
|
+
|
|
109
|
+
def user_is_course_staff(self, user) -> bool:
|
|
110
|
+
"""
|
|
111
|
+
Check if the user is course staff or an instructor.
|
|
112
|
+
|
|
113
|
+
Unlike user_is_student, a user with no role (e.g. anonymous) is not
|
|
114
|
+
considered course staff.
|
|
115
|
+
"""
|
|
116
|
+
return bool(
|
|
117
|
+
user and user.opt_attrs.get("edx-platform.user_role") in COURSE_STAFF_ROLES
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
def student_view(self, context=None):
|
|
121
|
+
"""
|
|
122
|
+
Render the view shown to users of this XBlock.
|
|
123
|
+
"""
|
|
124
|
+
user_service = self.runtime.service(self, "user")
|
|
125
|
+
user = user_service.get_current_user()
|
|
126
|
+
|
|
127
|
+
context = context or {}
|
|
128
|
+
context.update(
|
|
129
|
+
{
|
|
130
|
+
"course_id": self.runtime.course_id,
|
|
131
|
+
"display_name": self.display_name,
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Hide Superset content from non-course staff.
|
|
136
|
+
if self.user_is_student(user):
|
|
137
|
+
frag = Fragment()
|
|
138
|
+
frag.add_content(
|
|
139
|
+
self.render_template("static/html/superset_student.html", context)
|
|
140
|
+
)
|
|
141
|
+
return frag
|
|
142
|
+
|
|
143
|
+
context = generate_superset_context(
|
|
144
|
+
context=context,
|
|
145
|
+
dashboards=self.dashboards(),
|
|
146
|
+
)
|
|
147
|
+
context["xblock_id"] = str(self.scope_ids.usage_id.block_id)
|
|
148
|
+
|
|
149
|
+
# Remove this URL from the context to avoid confusion.
|
|
150
|
+
# Our XBlock handler URL will be used instead, provided in superset.js
|
|
151
|
+
del context["superset_guest_token_url"]
|
|
152
|
+
|
|
153
|
+
frag = Fragment()
|
|
154
|
+
frag.add_content(self.render_template("static/html/superset.html", context))
|
|
155
|
+
frag.add_css(loader.load_unicode("static/css/superset.css"))
|
|
156
|
+
frag.add_javascript(loader.load_unicode("static/js/install_required.js"))
|
|
157
|
+
|
|
158
|
+
# Add i18n js
|
|
159
|
+
statici18n_js_url = self._get_statici18n_js_url()
|
|
160
|
+
if statici18n_js_url:
|
|
161
|
+
frag.add_javascript_url(
|
|
162
|
+
self.runtime.local_resource_url(self, statici18n_js_url)
|
|
163
|
+
)
|
|
164
|
+
frag.add_javascript(loader.load_unicode("static/js/embed_dashboard.js"))
|
|
165
|
+
frag.add_javascript(loader.load_unicode("static/js/superset.js"))
|
|
166
|
+
frag.initialize_js(
|
|
167
|
+
"SupersetXBlock",
|
|
168
|
+
json_args={
|
|
169
|
+
"dashboard_uuid": self.dashboard_uuid,
|
|
170
|
+
"superset_url": context.get("superset_url"),
|
|
171
|
+
"xblock_id": context.get("xblock_id"),
|
|
172
|
+
},
|
|
173
|
+
)
|
|
174
|
+
return frag
|
|
175
|
+
|
|
176
|
+
@staticmethod
|
|
177
|
+
def workbench_scenarios(): # pragma: no cover
|
|
178
|
+
"""Return a canned scenario for display in the workbench."""
|
|
179
|
+
return [
|
|
180
|
+
(
|
|
181
|
+
"SupersetXBlock",
|
|
182
|
+
"""<superset/>
|
|
183
|
+
""",
|
|
184
|
+
),
|
|
185
|
+
(
|
|
186
|
+
"Multiple SupersetXBlock",
|
|
187
|
+
"""<vertical_demo>
|
|
188
|
+
<superset/>
|
|
189
|
+
<superset/>
|
|
190
|
+
<superset/>
|
|
191
|
+
</vertical_demo>
|
|
192
|
+
""",
|
|
193
|
+
),
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
@staticmethod
|
|
197
|
+
def _get_statici18n_js_url():
|
|
198
|
+
"""
|
|
199
|
+
Return the Javascript translation file for the currently selected language, if any.
|
|
200
|
+
|
|
201
|
+
Defaults to English if available.
|
|
202
|
+
"""
|
|
203
|
+
locale_code = translation.get_language()
|
|
204
|
+
if locale_code is None:
|
|
205
|
+
return None
|
|
206
|
+
text_js = "public/js/translations/{locale_code}/text.js"
|
|
207
|
+
lang_code = locale_code.split("-")[0]
|
|
208
|
+
for code in (locale_code, lang_code, "en"):
|
|
209
|
+
path_names = os.path.split(text_js.format(locale_code=code))
|
|
210
|
+
if importlib.resources.files(__package__).joinpath(*path_names).is_file():
|
|
211
|
+
return text_js.format(locale_code=code)
|
|
212
|
+
return None
|
|
213
|
+
|
|
214
|
+
@XBlock.json_handler
|
|
215
|
+
def get_superset_guest_token(
|
|
216
|
+
self, request_body, suffix=""
|
|
217
|
+
): # pylint: disable=unused-argument
|
|
218
|
+
"""Return a guest token for Superset."""
|
|
219
|
+
user_service = self.runtime.service(self, "user")
|
|
220
|
+
user = user_service.get_current_user()
|
|
221
|
+
|
|
222
|
+
if not self.user_is_course_staff(user):
|
|
223
|
+
raise JsonHandlerError(403, _("Only course staff can access Superset."))
|
|
224
|
+
|
|
225
|
+
try:
|
|
226
|
+
guest_token = generate_guest_token(
|
|
227
|
+
user=user,
|
|
228
|
+
course=self.scope_ids.usage_id.context_key,
|
|
229
|
+
dashboards=self.dashboards(),
|
|
230
|
+
filters=DEFAULT_FILTERS_FORMAT + self.filters,
|
|
231
|
+
)
|
|
232
|
+
except ImproperlyConfigured as exc:
|
|
233
|
+
raise JsonHandlerError(500, str(exc)) from exc
|
|
234
|
+
|
|
235
|
+
return Response(
|
|
236
|
+
json.dumps({"guestToken": guest_token}),
|
|
237
|
+
content_type="application/json",
|
|
238
|
+
charset="UTF-8",
|
|
239
|
+
)
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: platform-plugin-aspects
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Aspects plugins for edx-platform
|
|
5
|
+
Author-email: Open edX Project <oscm@openedx.org>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/openedx/platform-plugin-aspects
|
|
8
|
+
Project-URL: Repository, https://github.com/openedx/platform-plugin-aspects
|
|
9
|
+
Keywords: Python,edx
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Framework :: Django :: 5.2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Description-Content-Type: text/x-rst
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: celery
|
|
21
|
+
Requires-Dist: Django
|
|
22
|
+
Requires-Dist: django_crum
|
|
23
|
+
Requires-Dist: djangorestframework
|
|
24
|
+
Requires-Dist: edx-django-utils
|
|
25
|
+
Requires-Dist: edx-opaque-keys
|
|
26
|
+
Requires-Dist: edx-toggles
|
|
27
|
+
Requires-Dist: openedx-atlas
|
|
28
|
+
Requires-Dist: openedx-filters
|
|
29
|
+
Requires-Dist: prison
|
|
30
|
+
Requires-Dist: redis
|
|
31
|
+
Requires-Dist: requests
|
|
32
|
+
Requires-Dist: superset-api-client
|
|
33
|
+
Requires-Dist: web_fragments
|
|
34
|
+
Requires-Dist: XBlock
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
Platform Plugin Aspects
|
|
38
|
+
#######################
|
|
39
|
+
|
|
40
|
+
Purpose
|
|
41
|
+
*******
|
|
42
|
+
|
|
43
|
+
This repository holds various Aspects plugins for the Open edX platform, including the
|
|
44
|
+
event sinks that move data from the LMS to ClickHouse and the embedding of Superset
|
|
45
|
+
dashboards back into the platform.
|
|
46
|
+
|
|
47
|
+
Version Compatibility
|
|
48
|
+
*********************
|
|
49
|
+
|
|
50
|
+
- ``platform-plugin-aspects`` version 1.x: Nutmeg to Sumac
|
|
51
|
+
- ``platform-plugin-aspects`` version 2.x: Redwood (with in-context metrics turned off), or Sumac and above
|
|
52
|
+
|
|
53
|
+
Sinks
|
|
54
|
+
*****
|
|
55
|
+
|
|
56
|
+
Sinks are components that listen for events and store them in ClickHouse. The
|
|
57
|
+
events are emitted by the Open edX platform via `Open edX events`_ or Django signals.
|
|
58
|
+
|
|
59
|
+
Available Sinks
|
|
60
|
+
===============
|
|
61
|
+
|
|
62
|
+
Below are the existing sink names and their corresponding object names (as needed for the
|
|
63
|
+
``dump_data_to_clickhouse`` command below.
|
|
64
|
+
|
|
65
|
+
- ``CourseOverviewSink`` - Listens for the ``COURSE_PUBLISHED`` event and stores the
|
|
66
|
+
course structure, including ordering data through ``XBlockSink`` in ClickHouse. Object name:
|
|
67
|
+
``course_overviews``
|
|
68
|
+
- ``ExternalIdSink`` - Listens for the ``post_save`` Django signal on the ``ExternalId``
|
|
69
|
+
model and stores the external id data in ClickHouse. This model stores the relationships
|
|
70
|
+
between users and their xAPI unique identifiers. Object name: ``external_id``
|
|
71
|
+
- ``UserProfile`` - Listens for the ``post_save`` Django signal on the ``UserProfile``
|
|
72
|
+
model and stores the user profile data in ClickHouse. Object name: ``user_profile``
|
|
73
|
+
- ``CourseEnrollmentSink`` - Listen for the ``ENROLL_STATUS_CHANGE`` event and stores
|
|
74
|
+
the course enrollment data. Object name: ``course_enrollment``
|
|
75
|
+
- ``UserRetirementSink`` - Listen for the ``USER_RETIRE_LMS_MISC`` Django signal and
|
|
76
|
+
remove the user PII information from ClickHouse. This is a special sink with no assigned object name.
|
|
77
|
+
|
|
78
|
+
Commands
|
|
79
|
+
========
|
|
80
|
+
|
|
81
|
+
In addition to being an event listener, this package provides the following commands:
|
|
82
|
+
|
|
83
|
+
- ``dump_data_to_clickhouse`` - This command allows bulk export of the data from the Sinks.
|
|
84
|
+
Allows bootstrapping a new data platform or backfilling lost or missing data. Each sink object
|
|
85
|
+
is dumped individually. For large dumps, you can use the ``--batch_size`` and ``--sleep_time`` to control
|
|
86
|
+
how much load is placed on your LMS / Studio servers. Examples:
|
|
87
|
+
|
|
88
|
+
Dump any courses that the system thinks are out of date (last publish time is newer than the
|
|
89
|
+
last dump time in ClickHouse):
|
|
90
|
+
|
|
91
|
+
.. code-block:: bash
|
|
92
|
+
|
|
93
|
+
python manage.py cms dump_data_to_clickhouse --object course_overviews
|
|
94
|
+
|
|
95
|
+
The ``force`` option will dump all objects, regardless of the data ClickHouse currently has
|
|
96
|
+
so this command will push all course data for all courses:
|
|
97
|
+
|
|
98
|
+
.. code-block:: bash
|
|
99
|
+
|
|
100
|
+
python manage.py cms dump_data_to_clickhouse --object course_overviews --force
|
|
101
|
+
|
|
102
|
+
These commands will dump the user data Aspects uses when PII is turned on:
|
|
103
|
+
|
|
104
|
+
.. code-block:: bash
|
|
105
|
+
|
|
106
|
+
python manage.py cms dump_data_to_clickhouse --object external_id
|
|
107
|
+
python manage.py cms dump_data_to_clickhouse --object user_profile
|
|
108
|
+
|
|
109
|
+
To reduce server load, this command will dump 1000 user profiles at a time, with a 5-second
|
|
110
|
+
sleep in between:
|
|
111
|
+
|
|
112
|
+
.. code-block:: bash
|
|
113
|
+
|
|
114
|
+
python manage.py cms dump_data_to_clickhouse --object user_profile --batch_size 1000 --sleep_time 5
|
|
115
|
+
|
|
116
|
+
There are many more options that can be used for different circumstances. Please refer to
|
|
117
|
+
the commands help for more information. There is also a Tutor command that wraps this, so
|
|
118
|
+
that you don't need to get shell on a container to execute this command. More information on
|
|
119
|
+
that can be found in the `Aspects backfill documentation`_.
|
|
120
|
+
|
|
121
|
+
- ``load_test_tracking_events`` - This command allows loading test tracking events into
|
|
122
|
+
ClickHouse. This is useful for testing the ClickHouse connection to measure the performance of the
|
|
123
|
+
different data pipelines, such as Vector, Event Bus (Redis and Kafka), and Celery.
|
|
124
|
+
|
|
125
|
+
**Do not use this command in production**, as it will generate a large amount of data
|
|
126
|
+
and will slow down the system.
|
|
127
|
+
|
|
128
|
+
.. code-block:: bash
|
|
129
|
+
|
|
130
|
+
python manage.py cms load_test_tracking_events
|
|
131
|
+
|
|
132
|
+
- ``monitor_load_test_tracking`` - Monitors the load test tracking script and saves
|
|
133
|
+
output for later analysis.
|
|
134
|
+
|
|
135
|
+
.. code-block:: bash
|
|
136
|
+
|
|
137
|
+
python manage.py cms monitor_load_test_tracking
|
|
138
|
+
|
|
139
|
+
Instructor Dashboard Integration
|
|
140
|
+
================================
|
|
141
|
+
|
|
142
|
+
Dashboards from `Aspects`_ are integrated into the Instructor Dashboard via `Superset Embedded SDK`_.
|
|
143
|
+
See `Configuration`_ for more details.
|
|
144
|
+
|
|
145
|
+
Getting Started with Development
|
|
146
|
+
********************************
|
|
147
|
+
|
|
148
|
+
Please see the Open edX documentation for `guidance on Python development <https://docs.openedx.org/en/latest/developers/how-tos/get-ready-for-python-dev.html>`_ in this repo.
|
|
149
|
+
|
|
150
|
+
Deploying
|
|
151
|
+
*********
|
|
152
|
+
|
|
153
|
+
The ``Platform Plugin Aspects`` component is a django plugin that doesn't
|
|
154
|
+
need independent deployment. Therefore, its setup is reasonably straightforward.
|
|
155
|
+
First, it needs to be added to your service requirements, and then it will be
|
|
156
|
+
installed alongside the requirements of the service.
|
|
157
|
+
|
|
158
|
+
Configuration
|
|
159
|
+
*************
|
|
160
|
+
|
|
161
|
+
Instructor Dashboard Configuration
|
|
162
|
+
==================================
|
|
163
|
+
|
|
164
|
+
The Instructor Dashboard integration uses the `Open edX Filters`_. To learn more about
|
|
165
|
+
the filters, see the `Open edX Filters`_ documentation. Make sure to configure the
|
|
166
|
+
superset pipeline into the filter as follows:
|
|
167
|
+
|
|
168
|
+
for legacy instructor dashboard:
|
|
169
|
+
|
|
170
|
+
.. code-block:: python
|
|
171
|
+
|
|
172
|
+
OPEN_EDX_FILTERS_CONFIG = {
|
|
173
|
+
"org.openedx.learning.instructor.dashboard.render.started.v1": {
|
|
174
|
+
"fail_silently": False,
|
|
175
|
+
"pipeline": [
|
|
176
|
+
"platform_plugin_superset.extensions.filters.AddSupersetTab",
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
for new instructor dashboard:
|
|
182
|
+
|
|
183
|
+
.. code-block:: python
|
|
184
|
+
|
|
185
|
+
OPEN_EDX_FILTERS_CONFIG = {
|
|
186
|
+
"org.openedx.learning.instructor.dashboard.tabs.requested.v1": {
|
|
187
|
+
"fail_silently": False,
|
|
188
|
+
"pipeline": [
|
|
189
|
+
"platform_plugin_superset.extensions.filters.AddSupersetTabToInstructorDashboard",
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
- ``SUPERSET_CONFIG`` - This setting is used to configure the Superset Embedded SDK.
|
|
195
|
+
The configuration is a dictionary that contains the following keys:
|
|
196
|
+
|
|
197
|
+
- ``internal_service_url`` - The URL of the Superset instance (useful in development, omit in production).
|
|
198
|
+
- ``service_url`` - The URL of the Superset instance.
|
|
199
|
+
- ``username`` - The username of the Superset user.
|
|
200
|
+
- ``password`` - The password of the Superset user.
|
|
201
|
+
|
|
202
|
+
- ``ASPECTS_INSTRUCTOR_DASHBOARDS`` - This setting is used to configure the dashboards
|
|
203
|
+
that will be displayed in the Instructor Dashboard. The configuration is a list of
|
|
204
|
+
dictionaries that contains the following keys:
|
|
205
|
+
|
|
206
|
+
- ``name`` - The name of the dashboard.
|
|
207
|
+
- ``slug`` - The slug of the dashboard.
|
|
208
|
+
- ``uuid`` - The UUID of the dashboard.
|
|
209
|
+
- ``allow_translations`` - A boolean value that determines if the dashboard is translated in `Aspects`_.
|
|
210
|
+
|
|
211
|
+
- ``SUPERSET_EXTRA_FILTERS_FORMAT`` - This setting is used to configure the extra filters
|
|
212
|
+
that will be applied to the dashboards. The configuration is a list of strings that
|
|
213
|
+
can be formatted with the following variables:
|
|
214
|
+
|
|
215
|
+
- ``user`` - The user object.
|
|
216
|
+
- ``course`` - The course object.
|
|
217
|
+
|
|
218
|
+
- ``SUPERSET_DASHBOARD_LOCALES`` - This setting is used to configure the available locales
|
|
219
|
+
for the dashboards. The configuration is a list of supported locales by `Aspects`_.
|
|
220
|
+
|
|
221
|
+
- ``ASPECTS_ENABLE_STUDIO_IN_CONTEXT_METRICS`` - This setting turns on and off the in-context
|
|
222
|
+
metrics feature. It must be turned off in Open edX releases before Sumac, and when using
|
|
223
|
+
``tutor-contrib-aspects`` before v2.2.0, as those dashboards will not exist, causing errors in
|
|
224
|
+
the embedded Instructor Dashboards.
|
|
225
|
+
|
|
226
|
+
- ``ASPECTS_IN_CONTEXT_DASHBOARDS`` - This setting mirrors the ``ASPECTS_INSTRUCTOR_DASHBOARDS``, but
|
|
227
|
+
with additional keys used for filtering the boards to specific courses and blocks.
|
|
228
|
+
|
|
229
|
+
Event Sink Configuration
|
|
230
|
+
========================
|
|
231
|
+
|
|
232
|
+
- ``EVENT_SINK_CLICKHOUSE_BACKEND_CONFIG`` - This setting is used to configure the ClickHouse
|
|
233
|
+
connection. The configuration is a dictionary that contains the following keys:
|
|
234
|
+
|
|
235
|
+
- ``url`` - The host of the ClickHouse instance.
|
|
236
|
+
- ``database`` - The database name.
|
|
237
|
+
- ``username`` - The username of the ClickHouse user.
|
|
238
|
+
- ``password`` - The password of the ClickHouse user.
|
|
239
|
+
- ``timeout_secs`` - The timeout in seconds for the ClickHouse connection.
|
|
240
|
+
|
|
241
|
+
- ``EVENT_SINK_CLICKHOUSE_PII_MODELS`` - This setting is used to configure the models that
|
|
242
|
+
contain PII information. The configuration is a list of strings that contain the
|
|
243
|
+
table names where the PII information is stored.
|
|
244
|
+
|
|
245
|
+
- ``EVENT_SINK_CLICKHOUSE_MODEL_CONFIG`` - This setting is used to provide compatibility
|
|
246
|
+
with multiple Open edX models. The configuration is a dictionary that contains the
|
|
247
|
+
following: a key per model that contains a dictionary with the following keys:
|
|
248
|
+
|
|
249
|
+
- ``module`` - The module path of the model.
|
|
250
|
+
- ``model`` - The model class name.
|
|
251
|
+
|
|
252
|
+
Event Sinks are disabled by default from this repository, but enabled in the Aspects Tutor
|
|
253
|
+
plugin (tutor-contrib-aspects). If not using the Tutor plugin you will need to enable the
|
|
254
|
+
following waffle flags: ``event_sink_clickhouse.{{model_name}}.enabled``, where model_name
|
|
255
|
+
is the name of the model that you want to enable. Or, you can enable them via settings by
|
|
256
|
+
setting ``EVENT_SINK_CLICKHOUSE_{{model_name}}_ENABLED`` to ``True``.
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
Getting Help
|
|
260
|
+
************
|
|
261
|
+
|
|
262
|
+
Documentation
|
|
263
|
+
=============
|
|
264
|
+
|
|
265
|
+
Start by going through `the documentation`_. If you need more help see below.
|
|
266
|
+
|
|
267
|
+
.. _the documentation: https://docs.openedx.org/projects/platform-plugin-aspects
|
|
268
|
+
|
|
269
|
+
More Help
|
|
270
|
+
=========
|
|
271
|
+
|
|
272
|
+
If you're having trouble, we have discussion forums at
|
|
273
|
+
https://discuss.openedx.org, where you can connect with others in the
|
|
274
|
+
community.
|
|
275
|
+
|
|
276
|
+
Our real-time conversations are on Slack. You can request a `Slack
|
|
277
|
+
invitation`_, then join our `community Slack workspace`_.
|
|
278
|
+
|
|
279
|
+
For anything non-trivial, the best path is to open an issue in this
|
|
280
|
+
repository with as many details about the issue you are facing as you
|
|
281
|
+
can provide.
|
|
282
|
+
|
|
283
|
+
https://github.com/openedx/platform-plugin-aspects/issues
|
|
284
|
+
|
|
285
|
+
For more information about these options, see the `Getting Help <https://openedx.org/getting-help>`__ page.
|
|
286
|
+
|
|
287
|
+
.. _Slack invitation: https://openedx.org/slack
|
|
288
|
+
.. _community Slack workspace: https://openedx.slack.com/
|
|
289
|
+
|
|
290
|
+
License
|
|
291
|
+
*******
|
|
292
|
+
|
|
293
|
+
Please see `LICENSE.txt <LICENSE.txt>`_ for details.
|
|
294
|
+
|
|
295
|
+
Contributing
|
|
296
|
+
************
|
|
297
|
+
|
|
298
|
+
Contributions are very welcome.
|
|
299
|
+
Please read `How To Contribute <https://openedx.org/r/how-to-contribute>`_ for details.
|
|
300
|
+
|
|
301
|
+
This project is currently accepting all types of contributions, bug fixes,
|
|
302
|
+
security fixes, maintenance work, or new features. However, please make sure
|
|
303
|
+
to have a discussion about your new feature idea with the maintainers prior to
|
|
304
|
+
beginning development to maximize the chances of your change being accepted.
|
|
305
|
+
You can start a conversation by creating a new issue on this repo summarizing
|
|
306
|
+
your idea.
|
|
307
|
+
|
|
308
|
+
The Open edX Code of Conduct
|
|
309
|
+
****************************
|
|
310
|
+
|
|
311
|
+
All community members are expected to follow the `Open edX Code of Conduct`_.
|
|
312
|
+
|
|
313
|
+
.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/
|
|
314
|
+
|
|
315
|
+
People
|
|
316
|
+
******
|
|
317
|
+
|
|
318
|
+
The assigned maintainers for this component and other project details may be
|
|
319
|
+
found in `Backstage`_. Backstage pulls this data from the ``catalog-info.yaml``
|
|
320
|
+
file in this repo.
|
|
321
|
+
|
|
322
|
+
.. _Backstage: https://backstage.openedx.org/catalog/default/component/platform-plugin-aspects
|
|
323
|
+
|
|
324
|
+
Reporting Security Issues
|
|
325
|
+
*************************
|
|
326
|
+
|
|
327
|
+
Please do not report security issues in public. Please email security@openedx.org.
|
|
328
|
+
|
|
329
|
+
.. _Open edX events: https://github.com/openedx/openedx-events
|
|
330
|
+
.. _Edx Platform: https://github.com/openedx/edx-platform
|
|
331
|
+
.. _ClickHouse: https://clickhouse.com
|
|
332
|
+
.. _Aspects: https://docs.openedx.org/projects/openedx-aspects/en/latest/index.html
|
|
333
|
+
.. _Superset Embedded SDK: https://www.npmjs.com/package/@superset-ui/embedded-sdk
|
|
334
|
+
.. _Open edX Filters: https://docs.openedx.org/projects/openedx-filters/en/latest/
|
|
335
|
+
.. _Aspects backfill documentation: https://docs.openedx.org/projects/openedx-aspects/en/latest/technical_documentation/how-tos/backfill.html
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
platform_plugin_aspects/__init__.py,sha256=B7VgWJzpDlcMCbOvhr5uYIHgVqleju8YKh4uLcj1jKo,234
|
|
2
|
+
platform_plugin_aspects/apps.py,sha256=PA6NeXLj6Jo9_g_Of_aLVlnOiXJ9R47JJjqzBzZUvzM,3006
|
|
3
|
+
platform_plugin_aspects/signals.py,sha256=PDY6LmgK0W5YoOYXH-RwL5UCyk9OhXxZuInkyrWEaKw,11023
|
|
4
|
+
platform_plugin_aspects/tasks.py,sha256=WEBESWdyUMmmwUNiTP72sl-kOQ3iVN6tJjL42tiNBD0,2018
|
|
5
|
+
platform_plugin_aspects/urls.py,sha256=hC-9bNDnb7uAyF5DtrgLNAx98nlJn1yQGJajljCzzas,1064
|
|
6
|
+
platform_plugin_aspects/utils.py,sha256=I8UYNySW-jxuf7b-uytrBlbW668pcDjyV6K3zUR8Us4,10626
|
|
7
|
+
platform_plugin_aspects/views.py,sha256=uU1bcmPaC8tW0pjAbO6PFJXhf_1OAb2yUcodCaPJsaM,9732
|
|
8
|
+
platform_plugin_aspects/waffle.py,sha256=dCWmDt9XBWNCLvY-otRKCDv2cyK66UH4ayfsfZRgB70,98
|
|
9
|
+
platform_plugin_aspects/xblock.py,sha256=0G-gNOZqZCM56t8qm5oFL62Y22l-slqxQ_ZS6-vpiXw,7867
|
|
10
|
+
platform_plugin_aspects/conf/locale/babel_mako.cfg,sha256=czL7DvWxDLI4CPWIXh_gppFhDsxr5LtliKkOCYNbXGw,277
|
|
11
|
+
platform_plugin_aspects/conf/locale/config.yaml,sha256=jPen2DmckNDKK30axCKEd2Q2ha9oOG3IBxrJ63Pvznk,2280
|
|
12
|
+
platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.mo,sha256=WWh4FzZYxNN3cman5GIExONoVBww9tSnu50h4SK12Kw,420
|
|
13
|
+
platform_plugin_aspects/conf/locale/en/LC_MESSAGES/django.po,sha256=1lS1355xdTR9MGIhTUW9PQaaN3IbAkne9d_w20_zL_Q,2200
|
|
14
|
+
platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.mo,sha256=2Tx1pV6zSPsXIiA6H9b9CgqDM6WiR41XNEPcUWqis34,366
|
|
15
|
+
platform_plugin_aspects/conf/locale/en/LC_MESSAGES/mako.po,sha256=bgJ0MtbapG6uVmBE_9Krw18DMgEUGQ_MGF34RsArKQM,687
|
|
16
|
+
platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.mo,sha256=71eRqwG481tr-udNjo2ZXch5hflN3KE8s6oRMwVBr8w,2811
|
|
17
|
+
platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/django.po,sha256=EONq9sKuPrdOGzoeiLflFbFI6vux4m_R8IOPesNg3-Y,3217
|
|
18
|
+
platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.mo,sha256=GzKLLoJkOdiOlqYcIdIrTpka8XvAHenlJ22LFRuqKCQ,525
|
|
19
|
+
platform_plugin_aspects/conf/locale/eo/LC_MESSAGES/mako.po,sha256=VFwamuC69qs9kIYoeSMm6sHFRdK5jNyD9trEcFhK2Yo,801
|
|
20
|
+
platform_plugin_aspects/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
platform_plugin_aspects/extensions/filters.py,sha256=AKSZSWS7omrDlvfmiDfWBmCx-S_zSLC-lLNhI4Hj8AM,3449
|
|
22
|
+
platform_plugin_aspects/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
platform_plugin_aspects/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
platform_plugin_aspects/management/commands/dump_data_to_clickhouse.py,sha256=1XddfDz8DEgavnKwswteRJWN7ELkxJwWuvBQLxa7Il0,6770
|
|
25
|
+
platform_plugin_aspects/management/commands/load_test_tracking_events.py,sha256=3MFuaVjThCPWxQXYplL2e6OQrrYEgkbf_atj1z50bG4,10106
|
|
26
|
+
platform_plugin_aspects/management/commands/monitor_load_test_tracking.py,sha256=eI0EQY-DE5ST67QGvGDFTR8OTzHctkxpnaom3DM2Ae0,14312
|
|
27
|
+
platform_plugin_aspects/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
platform_plugin_aspects/settings/common.py,sha256=sk1IWjPvuP6zzn_8dpeeIbU1ZjOnEQ_Xk6waXDWODFE,5410
|
|
29
|
+
platform_plugin_aspects/settings/production.py,sha256=BfrSMYNIhxwx4ojeu8nSSax7jhd3r7zlUN6LNE4S1hc,1629
|
|
30
|
+
platform_plugin_aspects/sinks/__init__.py,sha256=ZynUluZLMda9OP8CAze1WU5OWJJU_UfVUknlIBUWsD0,442
|
|
31
|
+
platform_plugin_aspects/sinks/base_sink.py,sha256=hZ21psnmXzjqp5dxDaVXSo9XuQnB5Fax2_uBKIKdcmQ,13111
|
|
32
|
+
platform_plugin_aspects/sinks/course_enrollment_sink.py,sha256=AGuFEg7wElf2DcN3dRgsJwKqXB4ttXleL_FTlYxjHwk,647
|
|
33
|
+
platform_plugin_aspects/sinks/course_overview_sink.py,sha256=O2F6Ny529hnWhCNSC3cL_Xucx06oE1MxPAm5uGrDQ1g,10459
|
|
34
|
+
platform_plugin_aspects/sinks/external_id_sink.py,sha256=X5L9BVtj9tFJisJKOyJ2ga7CjWhtdHhQIvbW9ZVz5KA,639
|
|
35
|
+
platform_plugin_aspects/sinks/serializers.py,sha256=qJGVWVlUPqF_ef_MPI6_32gW92J4S5aeOSfwgFePSIc,7998
|
|
36
|
+
platform_plugin_aspects/sinks/tag_sink.py,sha256=8ldsuvtChEbFcoQaIsCpL6rFy00O5p-hm_KLzg7bRdU,1108
|
|
37
|
+
platform_plugin_aspects/sinks/user_profile_sink.py,sha256=KOCv2sq_T662a34OhB5yJGBYvkGYYjGDzRDJKC4hME8,609
|
|
38
|
+
platform_plugin_aspects/sinks/user_retire_sink.py,sha256=wQhFP0IQX55tp7GjrKMnmsvu0mxpwXfx25QW3uoUhwo,1635
|
|
39
|
+
platform_plugin_aspects/static/css/superset.css,sha256=1RTY7Z3FfjNI4e9Px7FAhA_N_WmytlWo6fd70z1DJNk,841
|
|
40
|
+
platform_plugin_aspects/static/html/superset.html,sha256=yJejNWrbvutoB9dlT-w2pYpUXQEZN9wjNMo9m11lSsE,1635
|
|
41
|
+
platform_plugin_aspects/static/html/superset_student.html,sha256=JPUvAZQf1ZAWEsU9O43XgPHwFXKrwTcsMn_qon3sV78,240
|
|
42
|
+
platform_plugin_aspects/static/js/embed_dashboard.js,sha256=u6CIRsABMDwPmwjDxeRNY02yHHIjy4DA2wfg8GMBvWY,2750
|
|
43
|
+
platform_plugin_aspects/static/js/install_required.js,sha256=kp0pBVRh5heNOMjsPz80yCub87HoqCmlGSdnUqVmYfs,325
|
|
44
|
+
platform_plugin_aspects/static/js/superset.js,sha256=PyWBxgAG00xu2FAVlnAicD4In1eN70wSA15AdwYg3Eo,1087
|
|
45
|
+
platform_plugin_aspects/templates/instructor_dashboard/aspects.html,sha256=y4D1tIoqd32OIeWD6e4aLCmCS9FePuXOOUYlXlNjP98,609
|
|
46
|
+
platform_plugin_aspects-2.0.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
47
|
+
platform_plugin_aspects-2.0.1.dist-info/METADATA,sha256=3s5-0evbKBNC02dktcoPvPgWu2XhCdxvo6lzwt0cSxM,13237
|
|
48
|
+
platform_plugin_aspects-2.0.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
49
|
+
platform_plugin_aspects-2.0.1.dist-info/entry_points.txt,sha256=Omh5NpLa92k8Osj8zLeINcEpCfFP8IIzSfbjMcUnb7Y,269
|
|
50
|
+
platform_plugin_aspects-2.0.1.dist-info/top_level.txt,sha256=hpD1nnL1T1Lkuf0ccrDQ_x1bK1QNPiZswEdRHyGImjY,24
|
|
51
|
+
platform_plugin_aspects-2.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[cms.djangoapp]
|
|
2
|
+
platform_plugin_aspects = platform_plugin_aspects.apps:PlatformPluginAspectsConfig
|
|
3
|
+
|
|
4
|
+
[lms.djangoapp]
|
|
5
|
+
platform_plugin_aspects = platform_plugin_aspects.apps:PlatformPluginAspectsConfig
|
|
6
|
+
|
|
7
|
+
[xblock.v1]
|
|
8
|
+
superset = platform_plugin_aspects.xblock:SupersetXBlock
|