edx-enterprise-data 9.0.1__py3-none-any.whl → 9.1.0__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.
Files changed (24) hide show
  1. {edx_enterprise_data-9.0.1.dist-info → edx_enterprise_data-9.1.0.dist-info}/METADATA +1 -1
  2. {edx_enterprise_data-9.0.1.dist-info → edx_enterprise_data-9.1.0.dist-info}/RECORD +22 -23
  3. enterprise_data/__init__.py +1 -1
  4. enterprise_data/admin_analytics/constants.py +0 -16
  5. enterprise_data/admin_analytics/database/queries/fact_engagement_admin_dash.py +90 -0
  6. enterprise_data/admin_analytics/database/queries/fact_enrollment_admin_dash.py +83 -4
  7. enterprise_data/admin_analytics/database/tables/fact_engagement_admin_dash.py +116 -0
  8. enterprise_data/admin_analytics/database/tables/fact_enrollment_admin_dash.py +97 -3
  9. enterprise_data/api/v1/serializers.py +1 -55
  10. enterprise_data/api/v1/urls.py +14 -17
  11. enterprise_data/api/v1/views/analytics_completions.py +150 -0
  12. enterprise_data/api/v1/views/analytics_engagements.py +106 -351
  13. enterprise_data/api/v1/views/analytics_enrollments.py +3 -6
  14. enterprise_data/renderers.py +22 -7
  15. enterprise_data/tests/admin_analytics/mock_analytics_data.py +12 -90
  16. enterprise_data/tests/admin_analytics/mock_enrollments.py +0 -66
  17. enterprise_data/tests/admin_analytics/test_analytics_engagements.py +120 -240
  18. enterprise_data/tests/admin_analytics/test_analytics_enrollments.py +12 -81
  19. enterprise_data/tests/admin_analytics/test_enterprise_completions.py +105 -120
  20. enterprise_data/admin_analytics/completions_utils.py +0 -261
  21. enterprise_data/api/v1/views/enterprise_completions.py +0 -200
  22. {edx_enterprise_data-9.0.1.dist-info → edx_enterprise_data-9.1.0.dist-info}/LICENSE +0 -0
  23. {edx_enterprise_data-9.0.1.dist-info → edx_enterprise_data-9.1.0.dist-info}/WHEEL +0 -0
  24. {edx_enterprise_data-9.0.1.dist-info → edx_enterprise_data-9.1.0.dist-info}/top_level.txt +0 -0
@@ -2,9 +2,6 @@
2
2
 
3
3
  import pandas as pd
4
4
 
5
- from enterprise_data.admin_analytics.constants import EngagementChart, EnrollmentChart
6
- from enterprise_data.admin_analytics.utils import ChartType
7
-
8
5
  ENROLLMENTS = [
9
6
  {
10
7
  "enterprise_customer_name": "Hill Ltd",
@@ -138,6 +135,7 @@ ENGAGEMENTS = [
138
135
  "is_engaged_forum": 0,
139
136
  "is_engaged_problem": 1,
140
137
  "is_active": 1,
138
+ "learning_time_hours": 3724/3600,
141
139
  "learning_time_seconds": 3724,
142
140
  },
143
141
  {
@@ -154,6 +152,7 @@ ENGAGEMENTS = [
154
152
  "is_engaged_forum": 0,
155
153
  "is_engaged_problem": 1,
156
154
  "is_active": 1,
155
+ "learning_time_hours": 4335/3600,
157
156
  "learning_time_seconds": 4335,
158
157
  },
159
158
  {
@@ -170,6 +169,7 @@ ENGAGEMENTS = [
170
169
  "is_engaged_forum": 0,
171
170
  "is_engaged_problem": 1,
172
171
  "is_active": 1,
172
+ "learning_time_hours": 9441/3600,
173
173
  "learning_time_seconds": 9441,
174
174
  },
175
175
  {
@@ -186,6 +186,7 @@ ENGAGEMENTS = [
186
186
  "is_engaged_forum": 1,
187
187
  "is_engaged_problem": 1,
188
188
  "is_active": 1,
189
+ "learning_time_hours": 9898/3600,
189
190
  "learning_time_seconds": 9898,
190
191
  },
191
192
  {
@@ -202,6 +203,7 @@ ENGAGEMENTS = [
202
203
  "is_engaged_forum": 0,
203
204
  "is_engaged_problem": 0,
204
205
  "is_active": 1,
206
+ "learning_time_hours": 0,
205
207
  "learning_time_seconds": 0,
206
208
  },
207
209
  {
@@ -218,6 +220,7 @@ ENGAGEMENTS = [
218
220
  "is_engaged_forum": 0,
219
221
  "is_engaged_problem": 0,
220
222
  "is_active": 1,
223
+ "learning_time_hours": 21/3600,
221
224
  "learning_time_seconds": 21,
222
225
  },
223
226
  {
@@ -234,6 +237,7 @@ ENGAGEMENTS = [
234
237
  "is_engaged_forum": 0,
235
238
  "is_engaged_problem": 1,
236
239
  "is_active": 1,
240
+ "learning_time_hours": 4747/3600,
237
241
  "learning_time_seconds": 4747,
238
242
  },
239
243
  {
@@ -250,6 +254,7 @@ ENGAGEMENTS = [
250
254
  "is_engaged_forum": 0,
251
255
  "is_engaged_problem": 0,
252
256
  "is_active": 1,
257
+ "learning_time_hours": 0,
253
258
  "learning_time_seconds": 0,
254
259
  },
255
260
  {
@@ -266,6 +271,7 @@ ENGAGEMENTS = [
266
271
  "is_engaged_forum": 1,
267
272
  "is_engaged_problem": 1,
268
273
  "is_active": 1,
274
+ "learning_time_hours": 5285/3600,
269
275
  "learning_time_seconds": 5285,
270
276
  },
271
277
  {
@@ -282,6 +288,7 @@ ENGAGEMENTS = [
282
288
  "is_engaged_forum": 0,
283
289
  "is_engaged_problem": 0,
284
290
  "is_active": 1,
291
+ "learning_time_hours": 0,
285
292
  "learning_time_seconds": 0,
286
293
  },
287
294
  {
@@ -298,6 +305,7 @@ ENGAGEMENTS = [
298
305
  "is_engaged_forum": 1,
299
306
  "is_engaged_problem": 1,
300
307
  "is_active": 1,
308
+ "learning_time_hours": 15753/3600,
301
309
  "learning_time_seconds": 15753,
302
310
  },
303
311
  {
@@ -314,55 +322,11 @@ ENGAGEMENTS = [
314
322
  "is_engaged_forum": 0,
315
323
  "is_engaged_problem": 0,
316
324
  "is_active": 1,
325
+ "learning_time_hours": 29/3600,
317
326
  "learning_time_seconds": 29,
318
327
  }
319
328
  ]
320
329
 
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
- ENGAGEMENT_STATS_CSVS = {
343
- EngagementChart.ENGAGEMENTS_OVER_TIME.value: (
344
- b'activity_date,certificate\n'
345
- b'2021-07-19,0.0\n'
346
- b'2021-07-26,4.4\n'
347
- b'2021-07-27,1.2\n'
348
- b'2021-08-05,3.6\n'
349
- b'2021-08-21,2.7\n'
350
- b'2021-09-02,1.3\n'
351
- b'2021-09-21,1.5\n'
352
- b'2022-05-17,0.0\n'
353
- ),
354
- EngagementChart.TOP_COURSES_BY_ENGAGEMENTS.value: (
355
- b'course_key,course_title,certificate\n'
356
- b'Kcpr+XoR30,Assimilated even-keeled focus group,0.0\n'
357
- b'luGg+KNt30,Synergized reciprocal encoding,14.786944444444444\n'
358
- ),
359
- EngagementChart.TOP_SUBJECTS_BY_ENGAGEMENTS.value: (
360
- b'course_subject,certificate\n'
361
- b'business-management,14.786944444444444\n'
362
- b'engineering,0.0\n'
363
- )
364
- }
365
-
366
330
 
367
331
  def enrollments_dataframe():
368
332
  """Return a DataFrame of enrollments."""
@@ -386,16 +350,6 @@ def engagements_dataframe():
386
350
 
387
351
  def leaderboard_csv_content():
388
352
  """Return the CSV content of leaderboard."""
389
- # return (
390
- # b'email,learning_time_hours,daily_sessions,average_session_length,course_completions\r\n'
391
- # b'paul77@example.org,4.4,1,4.4,\r\nseth57@example.org,2.7,1,2.7,\r\n'
392
- # b'weaverpatricia@example.net,2.6,1,2.6,\r\nwebertodd@example.com,1.5,1,1.5,\r\n'
393
- # b'yferguson@example.net,1.3,1,1.3,\r\nyallison@example.org,1.2,1,1.2,\r\n'
394
- # b'padillamichelle@example.org,1.0,1,1.0,\r\ncaseyjohnny@example.com,0.0,0,,\r\n'
395
- # b'crystal86@example.net,0.0,0,,\r\ngraceperez@example.com,0.0,0,,\r\n'
396
- # b'mackwilliam@example.com,0.0,0,,\r\nsamanthaclarke@example.org,0.0,0,,\r\n'
397
- # )
398
-
399
353
  return (
400
354
  b'email,learning_time_hours,daily_sessions,average_session_length,course_completions\r\n'
401
355
  b'paul77@example.org,4.4,1,4.4,\r\nseth57@example.org,2.7,1,2.7,\r\n'
@@ -506,38 +460,6 @@ LEADERBOARD_RESPONSE = [
506
460
  },
507
461
  ]
508
462
 
509
- COMPLETIONS_STATS_CSVS = {
510
- ChartType.COMPLETIONS_OVER_TIME.value: (
511
- b'passed_date,certificate\n'
512
- b'2021-08-25,1\n'
513
- b'2021-09-01,2\n'
514
- ),
515
- ChartType.TOP_COURSES_BY_COMPLETIONS.value: (
516
- b'course_key,course_title,certificate\n'
517
- b'hEmW+tvk03,Re-engineered tangible approach,2\n'
518
- ),
519
- ChartType.TOP_SUBJECTS_BY_COMPLETIONS.value: (
520
- b'course_subject,certificate\n'
521
- b'business-management,2\n'
522
- )
523
- }
524
-
525
-
526
- def engagements_csv_content():
527
- """Return the CSV content of engagements."""
528
- return (
529
- b'email,course_title,activity_date,course_subject,learning_time_hours\r\n'
530
- b'graceperez@example.com,Synergized reciprocal encoding,2022-05-17,business-management,0.0\r\n'
531
- b'webertodd@example.com,Synergized reciprocal encoding,2021-09-21,business-management,1.5\r\n'
532
- b'yferguson@example.net,Synergized reciprocal encoding,2021-09-02,business-management,1.3\r\n'
533
- b'seth57@example.org,Synergized reciprocal encoding,2021-08-21,business-management,2.7\r\n'
534
- b'padillamichelle@example.org,Synergized reciprocal encoding,2021-08-05,business-management,1.0\r\n'
535
- b'weaverpatricia@example.net,Synergized reciprocal encoding,2021-08-05,business-management,2.6\r\n'
536
- b'yallison@example.org,Synergized reciprocal encoding,2021-07-27,business-management,1.2\r\n'
537
- b'paul77@example.org,Synergized reciprocal encoding,2021-07-26,business-management,4.4\r\n'
538
- b'samanthaclarke@example.org,Synergized reciprocal encoding,2021-07-19,business-management,0.0\r\n'
539
- )
540
-
541
463
 
542
464
  TOP_SKILLS = [
543
465
  {
@@ -1,10 +1,5 @@
1
1
  """Mock data for enrollments"""
2
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
3
  ENROLLMENTS = [
9
4
  {
10
5
  "enterprise_customer_name": "Hill Ltd",
@@ -122,64 +117,3 @@ ENROLLMENTS = [
122
117
  "has_passed": 0,
123
118
  },
124
119
  ]
125
-
126
- ENROLLMENT_STATS_CSVS = {
127
- EnrollmentChart.ENROLLMENTS_OVER_TIME.value: (
128
- b'enterprise_enrollment_date,certificate\n'
129
- b'2020-04-03,1\n'
130
- b'2020-04-08,1\n'
131
- b'2021-05-11,1\n'
132
- b'2021-07-03,1\n'
133
- b'2021-07-04,1\n'
134
- ),
135
- EnrollmentChart.TOP_COURSES_BY_ENROLLMENTS.value: (
136
- b'course_key,course_title,certificate\n'
137
- b'NOGk+UVD31,Streamlined zero-defect attitude,1\n'
138
- b'QWXx+Jqz64,Horizontal solution-oriented hub,1\n'
139
- b'hEmW+tvk03,Re-engineered tangible approach,2\n'
140
- b'qZJC+KFX86,Secured static capability,1\n'
141
- ),
142
- EnrollmentChart.TOP_SUBJECTS_BY_ENROLLMENTS.value: (
143
- b'course_subject,certificate\nbusiness-management,2\ncommunication,1\nmedicine,1\nsocial-sciences,1\n'
144
- )
145
- }
146
- COMPLETIONS_STATS_CSVS = {
147
- ChartType.COMPLETIONS_OVER_TIME.value: (
148
- b'passed_date,certificate\n'
149
- b'2021-08-25,1\n'
150
- b'2021-09-01,2\n'
151
- ),
152
- ChartType.TOP_COURSES_BY_COMPLETIONS.value: (
153
- b'course_key,course_title,certificate\n'
154
- b'hEmW+tvk03,Re-engineered tangible approach,2\n'
155
- ),
156
- ChartType.TOP_SUBJECTS_BY_COMPLETIONS.value: (
157
- b'course_subject,certificate\n'
158
- b'business-management,2\n'
159
- )
160
- }
161
-
162
-
163
- def enrollments_dataframe():
164
- """Return a DataFrame of enrollments."""
165
- enrollments = pd.DataFrame(ENROLLMENTS)
166
-
167
- enrollments['enterprise_enrollment_date'] = enrollments['enterprise_enrollment_date'].astype('datetime64[ns]')
168
- enrollments['date_certificate_awarded'] = enrollments['date_certificate_awarded'].astype('datetime64[ns]')
169
- enrollments['date_certificate_created_raw'] = enrollments['date_certificate_created_raw'].astype('datetime64[ns]')
170
- enrollments['passed_date_raw'] = enrollments['passed_date_raw'].astype('datetime64[ns]')
171
- enrollments['passed_date'] = enrollments['passed_date'].astype('datetime64[ns]')
172
-
173
- return enrollments
174
-
175
-
176
- def enrollments_csv_content():
177
- """Return the CSV content of enrollments."""
178
- return (
179
- b'email,course_title,course_subject,enroll_type,enterprise_enrollment_date\r\n'
180
- b'rebeccanelson@example.com,Re-engineered tangible approach,business-management,certificate,2021-07-04\r\n'
181
- b'taylorjames@example.com,Re-engineered tangible approach,business-management,certificate,2021-07-03\r\n'
182
- b'ssmith@example.com,Secured static capability,medicine,certificate,2021-05-11\r\n'
183
- b'amber79@example.com,Streamlined zero-defect attitude,communication,certificate,2020-04-08\r\n'
184
- b'kathleenmartin@example.com,Horizontal solution-oriented hub,social-sciences,certificate,2020-04-03\r\n'
185
- )