edx-enterprise-data 8.7.0__py3-none-any.whl → 8.8.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.
- {edx_enterprise_data-8.7.0.dist-info → edx_enterprise_data-8.8.1.dist-info}/METADATA +1 -1
- {edx_enterprise_data-8.7.0.dist-info → edx_enterprise_data-8.8.1.dist-info}/RECORD +23 -20
- enterprise_data/__init__.py +1 -1
- enterprise_data/admin_analytics/constants.py +9 -3
- enterprise_data/admin_analytics/data_loaders.py +7 -3
- enterprise_data/admin_analytics/utils.py +52 -10
- enterprise_data/api/v1/paginators.py +1 -1
- enterprise_data/api/v1/serializers.py +39 -30
- enterprise_data/api/v1/urls.py +12 -6
- enterprise_data/api/v1/views/analytics_enrollments.py +85 -73
- enterprise_data/api/v1/views/analytics_leaderboard.py +141 -0
- enterprise_data/api/v1/views/enterprise_admin.py +20 -19
- enterprise_data/api/v1/views/enterprise_completions.py +49 -28
- enterprise_data/renderers.py +14 -0
- enterprise_data/tests/admin_analytics/mock_analytics_data.py +511 -0
- enterprise_data/tests/admin_analytics/mock_enrollments.py +4 -4
- enterprise_data/tests/admin_analytics/test_analytics_enrollments.py +23 -22
- enterprise_data/tests/admin_analytics/test_analytics_leaderboard.py +163 -0
- enterprise_data/tests/admin_analytics/test_enterprise_completions.py +1 -1
- enterprise_data/utils.py +16 -0
- {edx_enterprise_data-8.7.0.dist-info → edx_enterprise_data-8.8.1.dist-info}/LICENSE +0 -0
- {edx_enterprise_data-8.7.0.dist-info → edx_enterprise_data-8.8.1.dist-info}/WHEEL +0 -0
- {edx_enterprise_data-8.7.0.dist-info → edx_enterprise_data-8.8.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,511 @@
|
|
1
|
+
"""Mock data for enrollments"""
|
2
|
+
|
3
|
+
import pandas as pd
|
4
|
+
|
5
|
+
from enterprise_data.admin_analytics.constants import EnrollmentChart
|
6
|
+
from enterprise_data.admin_analytics.utils import ChartType
|
7
|
+
|
8
|
+
ENROLLMENTS = [
|
9
|
+
{
|
10
|
+
"enterprise_customer_name": "Hill Ltd",
|
11
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
12
|
+
"lms_enrollment_id": 1013,
|
13
|
+
"user_id": 8907,
|
14
|
+
"email": "rebeccanelson@example.com",
|
15
|
+
"course_key": "hEmW+tvk03",
|
16
|
+
"courserun_key": "course-v1:hEmW+tvk03+1T9889",
|
17
|
+
"course_id": "1681",
|
18
|
+
"course_subject": "business-management",
|
19
|
+
"course_title": "Re-engineered tangible approach",
|
20
|
+
"enterprise_enrollment_date": "2021-07-04",
|
21
|
+
"lms_enrollment_mode": "verified",
|
22
|
+
"enroll_type": "certificate",
|
23
|
+
"program_title": "Non-Program",
|
24
|
+
"date_certificate_awarded": "2021-08-25",
|
25
|
+
"grade_percent": 0.99,
|
26
|
+
"cert_awarded": 1,
|
27
|
+
"date_certificate_created_raw": "2021-08-25",
|
28
|
+
"passed_date_raw": "2021-08-25",
|
29
|
+
"passed_date": "2021-08-25",
|
30
|
+
"has_passed": 1,
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"enterprise_customer_name": "Hill Ltd",
|
34
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
35
|
+
"lms_enrollment_id": 9172,
|
36
|
+
"user_id": 8369,
|
37
|
+
"email": "taylorjames@example.com",
|
38
|
+
"course_key": "hEmW+tvk03",
|
39
|
+
"courserun_key": "course-v1:hEmW+tvk03+1T9889",
|
40
|
+
"course_id": "1681",
|
41
|
+
"course_subject": "business-management",
|
42
|
+
"course_title": "Re-engineered tangible approach",
|
43
|
+
"enterprise_enrollment_date": "2021-07-03",
|
44
|
+
"lms_enrollment_mode": "verified",
|
45
|
+
"enroll_type": "certificate",
|
46
|
+
"program_title": "Non-Program",
|
47
|
+
"date_certificate_awarded": "2021-09-01",
|
48
|
+
"grade_percent": 0.93,
|
49
|
+
"cert_awarded": 1,
|
50
|
+
"date_certificate_created_raw": "2021-09-01",
|
51
|
+
"passed_date_raw": "2021-09-01",
|
52
|
+
"passed_date": "2021-09-01",
|
53
|
+
"has_passed": 1,
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"enterprise_customer_name": "Hill Ltd",
|
57
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
58
|
+
"lms_enrollment_id": 9552,
|
59
|
+
"user_id": 8719,
|
60
|
+
"email": "ssmith@example.com",
|
61
|
+
"course_key": "qZJC+KFX86",
|
62
|
+
"courserun_key": "course-v1:qZJC+KFX86+1T8918",
|
63
|
+
"course_id": "1725",
|
64
|
+
"course_subject": "medicine",
|
65
|
+
"course_title": "Secured static capability",
|
66
|
+
"enterprise_enrollment_date": "2021-05-11",
|
67
|
+
"lms_enrollment_mode": "verified",
|
68
|
+
"enroll_type": "certificate",
|
69
|
+
"program_title": "Non-Program",
|
70
|
+
"date_certificate_awarded": None,
|
71
|
+
"grade_percent": 0.0,
|
72
|
+
"cert_awarded": 0,
|
73
|
+
"date_certificate_created_raw": None,
|
74
|
+
"passed_date_raw": None,
|
75
|
+
"passed_date": None,
|
76
|
+
"has_passed": 0,
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"enterprise_customer_name": "Hill Ltd",
|
80
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
81
|
+
"lms_enrollment_id": 3436,
|
82
|
+
"user_id": 3125,
|
83
|
+
"email": "kathleenmartin@example.com",
|
84
|
+
"course_key": "QWXx+Jqz64",
|
85
|
+
"courserun_key": "course-v1:QWXx+Jqz64+1T9449",
|
86
|
+
"course_id": "4878",
|
87
|
+
"course_subject": "social-sciences",
|
88
|
+
"course_title": "Horizontal solution-oriented hub",
|
89
|
+
"enterprise_enrollment_date": "2020-04-03",
|
90
|
+
"lms_enrollment_mode": "verified",
|
91
|
+
"enroll_type": "certificate",
|
92
|
+
"program_title": "Non-Program",
|
93
|
+
"date_certificate_awarded": None,
|
94
|
+
"grade_percent": 0.0,
|
95
|
+
"cert_awarded": 0,
|
96
|
+
"date_certificate_created_raw": None,
|
97
|
+
"passed_date_raw": None,
|
98
|
+
"passed_date": None,
|
99
|
+
"has_passed": 0,
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"enterprise_customer_name": "Hill Ltd",
|
103
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
104
|
+
"lms_enrollment_id": 5934,
|
105
|
+
"user_id": 4853,
|
106
|
+
"email": "amber79@example.com",
|
107
|
+
"course_key": "NOGk+UVD31",
|
108
|
+
"courserun_key": "course-v1:NOGk+UVD31+1T4956",
|
109
|
+
"course_id": "4141",
|
110
|
+
"course_subject": "communication",
|
111
|
+
"course_title": "Streamlined zero-defect attitude",
|
112
|
+
"enterprise_enrollment_date": "2020-04-08",
|
113
|
+
"lms_enrollment_mode": "verified",
|
114
|
+
"enroll_type": "certificate",
|
115
|
+
"program_title": "Non-Program",
|
116
|
+
"date_certificate_awarded": None,
|
117
|
+
"grade_percent": 0.0,
|
118
|
+
"cert_awarded": 0,
|
119
|
+
"date_certificate_created_raw": None,
|
120
|
+
"passed_date_raw": None,
|
121
|
+
"passed_date": None,
|
122
|
+
"has_passed": 0,
|
123
|
+
},
|
124
|
+
]
|
125
|
+
|
126
|
+
ENGAGEMENTS = [
|
127
|
+
{
|
128
|
+
"user_id": 2340,
|
129
|
+
"email": "padillamichelle@example.org",
|
130
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
131
|
+
"course_key": "luGg+KNt30",
|
132
|
+
"enroll_type": "certificate",
|
133
|
+
"activity_date": "2021-08-05",
|
134
|
+
"course_title": "Synergized reciprocal encoding",
|
135
|
+
"course_subject": "business-management",
|
136
|
+
"is_engaged": 1,
|
137
|
+
"is_engaged_video": 1,
|
138
|
+
"is_engaged_forum": 0,
|
139
|
+
"is_engaged_problem": 1,
|
140
|
+
"is_active": 1,
|
141
|
+
"learning_time_seconds": 3724,
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"user_id": 1869,
|
145
|
+
"email": "yallison@example.org",
|
146
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
147
|
+
"course_key": "luGg+KNt30",
|
148
|
+
"enroll_type": "certificate",
|
149
|
+
"activity_date": "2021-07-27",
|
150
|
+
"course_title": "Synergized reciprocal encoding",
|
151
|
+
"course_subject": "business-management",
|
152
|
+
"is_engaged": 1,
|
153
|
+
"is_engaged_video": 1,
|
154
|
+
"is_engaged_forum": 0,
|
155
|
+
"is_engaged_problem": 1,
|
156
|
+
"is_active": 1,
|
157
|
+
"learning_time_seconds": 4335,
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"user_id": 6962,
|
161
|
+
"email": "weaverpatricia@example.net",
|
162
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
163
|
+
"course_key": "luGg+KNt30",
|
164
|
+
"enroll_type": "certificate",
|
165
|
+
"activity_date": "2021-08-05",
|
166
|
+
"course_title": "Synergized reciprocal encoding",
|
167
|
+
"course_subject": "business-management",
|
168
|
+
"is_engaged": 1,
|
169
|
+
"is_engaged_video": 1,
|
170
|
+
"is_engaged_forum": 0,
|
171
|
+
"is_engaged_problem": 1,
|
172
|
+
"is_active": 1,
|
173
|
+
"learning_time_seconds": 9441,
|
174
|
+
},
|
175
|
+
{
|
176
|
+
"user_id": 6798,
|
177
|
+
"email": "seth57@example.org",
|
178
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
179
|
+
"course_key": "luGg+KNt30",
|
180
|
+
"enroll_type": "certificate",
|
181
|
+
"activity_date": "2021-08-21",
|
182
|
+
"course_title": "Synergized reciprocal encoding",
|
183
|
+
"course_subject": "business-management",
|
184
|
+
"is_engaged": 1,
|
185
|
+
"is_engaged_video": 1,
|
186
|
+
"is_engaged_forum": 1,
|
187
|
+
"is_engaged_problem": 1,
|
188
|
+
"is_active": 1,
|
189
|
+
"learning_time_seconds": 9898,
|
190
|
+
},
|
191
|
+
{
|
192
|
+
"user_id": 8530,
|
193
|
+
"email": "mackwilliam@example.com",
|
194
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
195
|
+
"course_key": "luGg+KNt30",
|
196
|
+
"enroll_type": "certificate",
|
197
|
+
"activity_date": "2021-10-24",
|
198
|
+
"course_title": "Synergized reciprocal encoding",
|
199
|
+
"course_subject": "business-management",
|
200
|
+
"is_engaged": 0,
|
201
|
+
"is_engaged_video": 0,
|
202
|
+
"is_engaged_forum": 0,
|
203
|
+
"is_engaged_problem": 0,
|
204
|
+
"is_active": 1,
|
205
|
+
"learning_time_seconds": 0,
|
206
|
+
},
|
207
|
+
{
|
208
|
+
"user_id": 7584,
|
209
|
+
"email": "graceperez@example.com",
|
210
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
211
|
+
"course_key": "luGg+KNt30",
|
212
|
+
"enroll_type": "certificate",
|
213
|
+
"activity_date": "2022-05-17",
|
214
|
+
"course_title": "Synergized reciprocal encoding",
|
215
|
+
"course_subject": "business-management",
|
216
|
+
"is_engaged": 0,
|
217
|
+
"is_engaged_video": 0,
|
218
|
+
"is_engaged_forum": 0,
|
219
|
+
"is_engaged_problem": 0,
|
220
|
+
"is_active": 1,
|
221
|
+
"learning_time_seconds": 21,
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"user_id": 68,
|
225
|
+
"email": "yferguson@example.net",
|
226
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
227
|
+
"course_key": "luGg+KNt30",
|
228
|
+
"enroll_type": "certificate",
|
229
|
+
"activity_date": "2021-09-02",
|
230
|
+
"course_title": "Synergized reciprocal encoding",
|
231
|
+
"course_subject": "business-management",
|
232
|
+
"is_engaged": 1,
|
233
|
+
"is_engaged_video": 1,
|
234
|
+
"is_engaged_forum": 0,
|
235
|
+
"is_engaged_problem": 1,
|
236
|
+
"is_active": 1,
|
237
|
+
"learning_time_seconds": 4747,
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"user_id": 4278,
|
241
|
+
"email": "caseyjohnny@example.com",
|
242
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
243
|
+
"course_key": "Kcpr+XoR30",
|
244
|
+
"enroll_type": "certificate",
|
245
|
+
"activity_date": "2022-05-20",
|
246
|
+
"course_title": "Assimilated even-keeled focus group",
|
247
|
+
"course_subject": "engineering",
|
248
|
+
"is_engaged": 0,
|
249
|
+
"is_engaged_video": 0,
|
250
|
+
"is_engaged_forum": 0,
|
251
|
+
"is_engaged_problem": 0,
|
252
|
+
"is_active": 1,
|
253
|
+
"learning_time_seconds": 0,
|
254
|
+
},
|
255
|
+
{
|
256
|
+
"user_id": 8726,
|
257
|
+
"email": "webertodd@example.com",
|
258
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
259
|
+
"course_key": "luGg+KNt30",
|
260
|
+
"enroll_type": "certificate",
|
261
|
+
"activity_date": "2021-09-21",
|
262
|
+
"course_title": "Synergized reciprocal encoding",
|
263
|
+
"course_subject": "business-management",
|
264
|
+
"is_engaged": 1,
|
265
|
+
"is_engaged_video": 1,
|
266
|
+
"is_engaged_forum": 1,
|
267
|
+
"is_engaged_problem": 1,
|
268
|
+
"is_active": 1,
|
269
|
+
"learning_time_seconds": 5285,
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"user_id": 282,
|
273
|
+
"email": "crystal86@example.net",
|
274
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
275
|
+
"course_key": "luGg+KNt30",
|
276
|
+
"enroll_type": "certificate",
|
277
|
+
"activity_date": "2021-07-11",
|
278
|
+
"course_title": "Synergized reciprocal encoding",
|
279
|
+
"course_subject": "business-management",
|
280
|
+
"is_engaged": 0,
|
281
|
+
"is_engaged_video": 0,
|
282
|
+
"is_engaged_forum": 0,
|
283
|
+
"is_engaged_problem": 0,
|
284
|
+
"is_active": 1,
|
285
|
+
"learning_time_seconds": 0,
|
286
|
+
},
|
287
|
+
{
|
288
|
+
"user_id": 2731,
|
289
|
+
"email": "paul77@example.org",
|
290
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
291
|
+
"course_key": "luGg+KNt30",
|
292
|
+
"enroll_type": "certificate",
|
293
|
+
"activity_date": "2021-07-26",
|
294
|
+
"course_title": "Synergized reciprocal encoding",
|
295
|
+
"course_subject": "business-management",
|
296
|
+
"is_engaged": 1,
|
297
|
+
"is_engaged_video": 1,
|
298
|
+
"is_engaged_forum": 1,
|
299
|
+
"is_engaged_problem": 1,
|
300
|
+
"is_active": 1,
|
301
|
+
"learning_time_seconds": 15753,
|
302
|
+
},
|
303
|
+
{
|
304
|
+
"user_id": 4038,
|
305
|
+
"email": "samanthaclarke@example.org",
|
306
|
+
"enterprise_customer_uuid": "33ce656295e04ecfa2a77d407eb96f69",
|
307
|
+
"course_key": "luGg+KNt30",
|
308
|
+
"enroll_type": "certificate",
|
309
|
+
"activity_date": "2021-07-19",
|
310
|
+
"course_title": "Synergized reciprocal encoding",
|
311
|
+
"course_subject": "business-management",
|
312
|
+
"is_engaged": 0,
|
313
|
+
"is_engaged_video": 0,
|
314
|
+
"is_engaged_forum": 0,
|
315
|
+
"is_engaged_problem": 0,
|
316
|
+
"is_active": 1,
|
317
|
+
"learning_time_seconds": 29,
|
318
|
+
}
|
319
|
+
]
|
320
|
+
|
321
|
+
ENROLLMENT_STATS_CSVS = {
|
322
|
+
EnrollmentChart.ENROLLMENTS_OVER_TIME.value: (
|
323
|
+
b'enterprise_enrollment_date,certificate\n'
|
324
|
+
b'2020-04-03,1\n'
|
325
|
+
b'2020-04-08,1\n'
|
326
|
+
b'2021-05-11,1\n'
|
327
|
+
b'2021-07-03,1\n'
|
328
|
+
b'2021-07-04,1\n'
|
329
|
+
),
|
330
|
+
EnrollmentChart.TOP_COURSES_BY_ENROLLMENTS.value: (
|
331
|
+
b'course_key,course_title,certificate\n'
|
332
|
+
b'NOGk+UVD31,Streamlined zero-defect attitude,1\n'
|
333
|
+
b'QWXx+Jqz64,Horizontal solution-oriented hub,1\n'
|
334
|
+
b'hEmW+tvk03,Re-engineered tangible approach,2\n'
|
335
|
+
b'qZJC+KFX86,Secured static capability,1\n'
|
336
|
+
),
|
337
|
+
EnrollmentChart.TOP_SUBJECTS_BY_ENROLLMENTS.value: (
|
338
|
+
b'course_subject,certificate\nbusiness-management,2\ncommunication,1\nmedicine,1\nsocial-sciences,1\n'
|
339
|
+
)
|
340
|
+
}
|
341
|
+
|
342
|
+
|
343
|
+
def enrollments_dataframe():
|
344
|
+
"""Return a DataFrame of enrollments."""
|
345
|
+
enrollments = pd.DataFrame(ENROLLMENTS)
|
346
|
+
|
347
|
+
enrollments['enterprise_enrollment_date'] = enrollments['enterprise_enrollment_date'].astype('datetime64[ns]')
|
348
|
+
enrollments['date_certificate_awarded'] = enrollments['date_certificate_awarded'].astype('datetime64[ns]')
|
349
|
+
enrollments['date_certificate_created_raw'] = enrollments['date_certificate_created_raw'].astype('datetime64[ns]')
|
350
|
+
enrollments['passed_date_raw'] = enrollments['passed_date_raw'].astype('datetime64[ns]')
|
351
|
+
enrollments['passed_date'] = enrollments['passed_date'].astype('datetime64[ns]')
|
352
|
+
|
353
|
+
return enrollments
|
354
|
+
|
355
|
+
|
356
|
+
def engagements_dataframe():
|
357
|
+
"""Return a DataFrame of engagements."""
|
358
|
+
engagements = pd.DataFrame(ENGAGEMENTS)
|
359
|
+
engagements['activity_date'] = engagements['activity_date'].astype('datetime64[ns]')
|
360
|
+
return engagements
|
361
|
+
|
362
|
+
|
363
|
+
def enrollments_csv_content():
|
364
|
+
"""Return the CSV content of enrollments."""
|
365
|
+
return (
|
366
|
+
b'email,course_title,course_subject,enroll_type,enterprise_enrollment_date\r\n'
|
367
|
+
b'rebeccanelson@example.com,Re-engineered tangible approach,business-management,certificate,2021-07-04\r\n'
|
368
|
+
b'taylorjames@example.com,Re-engineered tangible approach,business-management,certificate,2021-07-03\r\n'
|
369
|
+
b'ssmith@example.com,Secured static capability,medicine,certificate,2021-05-11\r\n'
|
370
|
+
b'amber79@example.com,Streamlined zero-defect attitude,communication,certificate,2020-04-08\r\n'
|
371
|
+
b'kathleenmartin@example.com,Horizontal solution-oriented hub,social-sciences,certificate,2020-04-03\r\n'
|
372
|
+
)
|
373
|
+
|
374
|
+
|
375
|
+
def leaderboard_csv_content():
|
376
|
+
"""Return the CSV content of leaderboard."""
|
377
|
+
# return (
|
378
|
+
# b'email,learning_time_hours,daily_sessions,average_session_length,course_completions\r\n'
|
379
|
+
# b'paul77@example.org,4.4,1,4.4,\r\nseth57@example.org,2.7,1,2.7,\r\n'
|
380
|
+
# b'weaverpatricia@example.net,2.6,1,2.6,\r\nwebertodd@example.com,1.5,1,1.5,\r\n'
|
381
|
+
# b'yferguson@example.net,1.3,1,1.3,\r\nyallison@example.org,1.2,1,1.2,\r\n'
|
382
|
+
# b'padillamichelle@example.org,1.0,1,1.0,\r\ncaseyjohnny@example.com,0.0,0,,\r\n'
|
383
|
+
# b'crystal86@example.net,0.0,0,,\r\ngraceperez@example.com,0.0,0,,\r\n'
|
384
|
+
# b'mackwilliam@example.com,0.0,0,,\r\nsamanthaclarke@example.org,0.0,0,,\r\n'
|
385
|
+
# )
|
386
|
+
|
387
|
+
return (
|
388
|
+
b'email,learning_time_hours,daily_sessions,average_session_length,course_completions\r\n'
|
389
|
+
b'paul77@example.org,4.4,1,4.4,\r\nseth57@example.org,2.7,1,2.7,\r\n'
|
390
|
+
b'weaverpatricia@example.net,2.6,1,2.6,\r\nwebertodd@example.com,1.5,1,1.5,\r\n'
|
391
|
+
b'yferguson@example.net,1.3,1,1.3,\r\nyallison@example.org,1.2,1,1.2,\r\n'
|
392
|
+
b'padillamichelle@example.org,1.0,1,1.0,\r\ncaseyjohnny@example.com,0.0,0,0.0,\r\n'
|
393
|
+
b'crystal86@example.net,0.0,0,0.0,\r\ngraceperez@example.com,0.0,0,0.0,\r\n'
|
394
|
+
b'mackwilliam@example.com,0.0,0,0.0,\r\nsamanthaclarke@example.org,0.0,0,0.0,\r\n'
|
395
|
+
)
|
396
|
+
|
397
|
+
|
398
|
+
LEADERBOARD_RESPONSE = [
|
399
|
+
{
|
400
|
+
"email": "paul77@example.org",
|
401
|
+
"daily_sessions": 1,
|
402
|
+
"learning_time_seconds": 15753,
|
403
|
+
"learning_time_hours": 4.4,
|
404
|
+
"average_session_length": 4.4,
|
405
|
+
"course_completions": None,
|
406
|
+
},
|
407
|
+
{
|
408
|
+
"email": "seth57@example.org",
|
409
|
+
"daily_sessions": 1,
|
410
|
+
"learning_time_seconds": 9898,
|
411
|
+
"learning_time_hours": 2.7,
|
412
|
+
"average_session_length": 2.7,
|
413
|
+
"course_completions": None,
|
414
|
+
},
|
415
|
+
{
|
416
|
+
"email": "weaverpatricia@example.net",
|
417
|
+
"daily_sessions": 1,
|
418
|
+
"learning_time_seconds": 9441,
|
419
|
+
"learning_time_hours": 2.6,
|
420
|
+
"average_session_length": 2.6,
|
421
|
+
"course_completions": None,
|
422
|
+
},
|
423
|
+
{
|
424
|
+
"email": "webertodd@example.com",
|
425
|
+
"daily_sessions": 1,
|
426
|
+
"learning_time_seconds": 5285,
|
427
|
+
"learning_time_hours": 1.5,
|
428
|
+
"average_session_length": 1.5,
|
429
|
+
"course_completions": None,
|
430
|
+
},
|
431
|
+
{
|
432
|
+
"email": "yferguson@example.net",
|
433
|
+
"daily_sessions": 1,
|
434
|
+
"learning_time_seconds": 4747,
|
435
|
+
"learning_time_hours": 1.3,
|
436
|
+
"average_session_length": 1.3,
|
437
|
+
"course_completions": None,
|
438
|
+
},
|
439
|
+
{
|
440
|
+
"email": "yallison@example.org",
|
441
|
+
"daily_sessions": 1,
|
442
|
+
"learning_time_seconds": 4335,
|
443
|
+
"learning_time_hours": 1.2,
|
444
|
+
"average_session_length": 1.2,
|
445
|
+
"course_completions": None,
|
446
|
+
},
|
447
|
+
{
|
448
|
+
"email": "padillamichelle@example.org",
|
449
|
+
"daily_sessions": 1,
|
450
|
+
"learning_time_seconds": 3724,
|
451
|
+
"learning_time_hours": 1.0,
|
452
|
+
"average_session_length": 1.0,
|
453
|
+
"course_completions": None,
|
454
|
+
},
|
455
|
+
{
|
456
|
+
"email": "caseyjohnny@example.com",
|
457
|
+
"daily_sessions": 0,
|
458
|
+
"learning_time_seconds": 0,
|
459
|
+
"learning_time_hours": 0.0,
|
460
|
+
"average_session_length": 0.0,
|
461
|
+
"course_completions": None,
|
462
|
+
},
|
463
|
+
{
|
464
|
+
"email": "crystal86@example.net",
|
465
|
+
"daily_sessions": 0,
|
466
|
+
"learning_time_seconds": 0,
|
467
|
+
"learning_time_hours": 0.0,
|
468
|
+
"average_session_length": 0.0,
|
469
|
+
"course_completions": None,
|
470
|
+
},
|
471
|
+
{
|
472
|
+
"email": "graceperez@example.com",
|
473
|
+
"daily_sessions": 0,
|
474
|
+
"learning_time_seconds": 21,
|
475
|
+
"learning_time_hours": 0.0,
|
476
|
+
"average_session_length": 0.0,
|
477
|
+
"course_completions": None,
|
478
|
+
},
|
479
|
+
{
|
480
|
+
"email": "mackwilliam@example.com",
|
481
|
+
"daily_sessions": 0,
|
482
|
+
"learning_time_seconds": 0,
|
483
|
+
"learning_time_hours": 0.0,
|
484
|
+
"average_session_length": 0.0,
|
485
|
+
"course_completions": None,
|
486
|
+
},
|
487
|
+
{
|
488
|
+
"email": "samanthaclarke@example.org",
|
489
|
+
"daily_sessions": 0,
|
490
|
+
"learning_time_seconds": 29,
|
491
|
+
"learning_time_hours": 0.0,
|
492
|
+
"average_session_length": 0.0,
|
493
|
+
"course_completions": None,
|
494
|
+
},
|
495
|
+
]
|
496
|
+
|
497
|
+
COMPLETIONS_STATS_CSVS = {
|
498
|
+
ChartType.COMPLETIONS_OVER_TIME.value: (
|
499
|
+
b'passed_date,certificate\n'
|
500
|
+
b'2021-08-25,1\n'
|
501
|
+
b'2021-09-01,2\n'
|
502
|
+
),
|
503
|
+
ChartType.TOP_COURSES_BY_COMPLETIONS.value: (
|
504
|
+
b'course_key,course_title,certificate\n'
|
505
|
+
b'hEmW+tvk03,Re-engineered tangible approach,2\n'
|
506
|
+
),
|
507
|
+
ChartType.TOP_SUBJECTS_BY_COMPLETIONS.value: (
|
508
|
+
b'course_subject,certificate\n'
|
509
|
+
b'business-management,2\n'
|
510
|
+
)
|
511
|
+
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import pandas as pd
|
4
4
|
|
5
|
-
from enterprise_data.admin_analytics.constants import
|
5
|
+
from enterprise_data.admin_analytics.constants import EnrollmentChart
|
6
6
|
from enterprise_data.admin_analytics.utils import ChartType
|
7
7
|
|
8
8
|
ENROLLMENTS = [
|
@@ -124,7 +124,7 @@ ENROLLMENTS = [
|
|
124
124
|
]
|
125
125
|
|
126
126
|
ENROLLMENT_STATS_CSVS = {
|
127
|
-
|
127
|
+
EnrollmentChart.ENROLLMENTS_OVER_TIME.value: (
|
128
128
|
b'enterprise_enrollment_date,certificate\n'
|
129
129
|
b'2020-04-03,1\n'
|
130
130
|
b'2020-04-08,1\n'
|
@@ -132,14 +132,14 @@ ENROLLMENT_STATS_CSVS = {
|
|
132
132
|
b'2021-07-03,1\n'
|
133
133
|
b'2021-07-04,1\n'
|
134
134
|
),
|
135
|
-
|
135
|
+
EnrollmentChart.TOP_COURSES_BY_ENROLLMENTS.value: (
|
136
136
|
b'course_key,course_title,certificate\n'
|
137
137
|
b'NOGk+UVD31,Streamlined zero-defect attitude,1\n'
|
138
138
|
b'QWXx+Jqz64,Horizontal solution-oriented hub,1\n'
|
139
139
|
b'hEmW+tvk03,Re-engineered tangible approach,2\n'
|
140
140
|
b'qZJC+KFX86,Secured static capability,1\n'
|
141
141
|
),
|
142
|
-
|
142
|
+
EnrollmentChart.TOP_SUBJECTS_BY_ENROLLMENTS.value: (
|
143
143
|
b'course_subject,certificate\nbusiness-management,2\ncommunication,1\nmedicine,1\nsocial-sciences,1\n'
|
144
144
|
)
|
145
145
|
}
|