edx-enterprise-data 10.17.0__py3-none-any.whl → 10.17.2__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-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/METADATA +1 -1
- {edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/RECORD +11 -11
- enterprise_data/__init__.py +1 -1
- enterprise_data/admin_analytics/constants.py +6 -0
- enterprise_data/admin_analytics/database/queries/skills_daily_rollup_admin_dash.py +46 -40
- enterprise_data/admin_analytics/database/tables/skills_daily_rollup_admin_dash.py +101 -59
- enterprise_data/api/v1/serializers.py +7 -1
- enterprise_data/api/v1/views/enterprise_admin.py +11 -3
- {edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/WHEEL +0 -0
- {edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/licenses/LICENSE +0 -0
- {edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
|
-
edx_enterprise_data-10.17.
|
2
|
-
enterprise_data/__init__.py,sha256=
|
1
|
+
edx_enterprise_data-10.17.2.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
|
2
|
+
enterprise_data/__init__.py,sha256=WTl8qungY2hzq3ezeyHVcn_buyGBWVbvFpx_x6sgUJA,125
|
3
3
|
enterprise_data/apps.py,sha256=aF6hZwDfI2oWj95tUTm_2ikHueQj-jLj-u0GrgzpsQI,414
|
4
4
|
enterprise_data/clients.py,sha256=glw-fXu3V7rKEpiUBF056gZEdNK4KnWcP9tNYELimRQ,6566
|
5
5
|
enterprise_data/constants.py,sha256=uCKjfpdlMYFZJsAj3n9RMw4Cmg5_6s3NuwocO-fch3s,238
|
@@ -12,7 +12,7 @@ enterprise_data/signals.py,sha256=8eqNPnlvmfsKf19lGWv5xTIuBgQIqR8EZSp9UYzC8Rc,10
|
|
12
12
|
enterprise_data/urls.py,sha256=bqtKF5OEWEwrNmHG3os-pZNuNsmjlhxEqp7yM4TbPf4,243
|
13
13
|
enterprise_data/utils.py,sha256=djGuQUnvT8HJMMV60CzcD5BWerPIwiK9uG26bhkpWMg,3518
|
14
14
|
enterprise_data/admin_analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
enterprise_data/admin_analytics/constants.py,sha256
|
15
|
+
enterprise_data/admin_analytics/constants.py,sha256=lSu4LMFvq0RDvLj2XCI6Ttu1wE1gg3CpOYhlqKLcyM0,280
|
16
16
|
enterprise_data/admin_analytics/data_loaders.py,sha256=kCynCqHr5wuKC7JipfQS_kfKAo7Qtajxtr-q7MODz0s,746
|
17
17
|
enterprise_data/admin_analytics/database/__init__.py,sha256=vNSWKf2VV5xMegN7htJJtxtQEb0ASLC6frE2w0ZpYpE,104
|
18
18
|
enterprise_data/admin_analytics/database/utils.py,sha256=5u-d6ZQW95mF_r4bH8Xdi7DgpYAuDFOG_q0P-bjKXHU,1712
|
@@ -25,7 +25,7 @@ enterprise_data/admin_analytics/database/filters/mixins.py,sha256=FOtOKvcugQC8eo
|
|
25
25
|
enterprise_data/admin_analytics/database/queries/__init__.py,sha256=IC5TLOr_GnydbrVbl2mWhwO3aUbYeHuDmfPTLmwGhZA,218
|
26
26
|
enterprise_data/admin_analytics/database/queries/fact_engagement_admin_dash.py,sha256=RejAfiNGr0i3wyNe5bsqFOcdRKCGp-tbqS04ibgLi5I,10393
|
27
27
|
enterprise_data/admin_analytics/database/queries/fact_enrollment_admin_dash.py,sha256=n_RiqraVzYvCsgLaPmpSBUX3cyNEHjSnkNH7n35gC80,10609
|
28
|
-
enterprise_data/admin_analytics/database/queries/skills_daily_rollup_admin_dash.py,sha256=
|
28
|
+
enterprise_data/admin_analytics/database/queries/skills_daily_rollup_admin_dash.py,sha256=wg0SaVxYgt8w8Xg0EGSblypgR3VC5kV_gYrCtYnysxs,4989
|
29
29
|
enterprise_data/admin_analytics/database/query_filters/__init__.py,sha256=xW9cf5KGpMs33tTlil5gzKq4RxcZVCJZESsrHo2X0E4,182
|
30
30
|
enterprise_data/admin_analytics/database/query_filters/base.py,sha256=XZUC1AIaDPBq0cwh2Xn5wp_DZfsD3HnMMvqFUt7iM2E,2205
|
31
31
|
enterprise_data/admin_analytics/database/query_filters/between.py,sha256=YvAM4WSJSCHb1nCzeJLwku4zkJKHrqnSrEnl7-xMOoA,924
|
@@ -35,7 +35,7 @@ enterprise_data/admin_analytics/database/tables/__init__.py,sha256=Z-c3P9hqR-dC9
|
|
35
35
|
enterprise_data/admin_analytics/database/tables/base.py,sha256=1KyKsC18pW3m-5U-T6pdt5rIwsz6Wp3QFFbD3r6L6YQ,395
|
36
36
|
enterprise_data/admin_analytics/database/tables/fact_engagement_admin_dash.py,sha256=wAnpNgh1USAQKi86JdEy4KJ_d_IL2fbKKu3ypqi5BCs,15434
|
37
37
|
enterprise_data/admin_analytics/database/tables/fact_enrollment_admin_dash.py,sha256=BwchyH1VJy8Ie-m_ma3bXiKKkNtJhb8A0u37hjocyiU,17049
|
38
|
-
enterprise_data/admin_analytics/database/tables/skills_daily_rollup_admin_dash.py,sha256=
|
38
|
+
enterprise_data/admin_analytics/database/tables/skills_daily_rollup_admin_dash.py,sha256=fvSbo_xDizEI-rXl3S9pv-T33fGsWYbceeU7biRshIw,7367
|
39
39
|
enterprise_data/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
40
|
enterprise_data/api/urls.py,sha256=POqc_KATHdnpMf9zHtpO46pKD5KAlAExtx7G6iylLcU,273
|
41
41
|
enterprise_data/api/v0/__init__.py,sha256=1aAzAYU5hk-RW6cKUxa1645cbZMxn7GIZ7OMjWc9MKI,46
|
@@ -43,7 +43,7 @@ enterprise_data/api/v0/serializers.py,sha256=dngZTk6DhRxApchQKCMp1B_c8aVnQtH0NCq
|
|
43
43
|
enterprise_data/api/v0/urls.py,sha256=vzJjqIo_S3AXWs9Us8XTaJc3FnxLbYzAkmLyuDQqum0,699
|
44
44
|
enterprise_data/api/v0/views.py,sha256=4RslZ4NZOU-844bnebEQ71ji2utRY7jEijqC45oQQD0,14380
|
45
45
|
enterprise_data/api/v1/__init__.py,sha256=1aAzAYU5hk-RW6cKUxa1645cbZMxn7GIZ7OMjWc9MKI,46
|
46
|
-
enterprise_data/api/v1/serializers.py,sha256=
|
46
|
+
enterprise_data/api/v1/serializers.py,sha256=2JG4XuY938g8w5SWUdMRn07pndEgJQ9D975PLHoympI,14103
|
47
47
|
enterprise_data/api/v1/urls.py,sha256=Wl1xLboPg-Lq1ZvjAWf51JKYkHlmx02Kpq1nwfDyS8s,4372
|
48
48
|
enterprise_data/api/v1/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
enterprise_data/api/v1/views/analytics_completions.py,sha256=ALkoUTgvaqCxpjnf3rkvwBT7-Hv7eM1RnCdRboCQgR8,6540
|
@@ -51,7 +51,7 @@ enterprise_data/api/v1/views/analytics_engagements.py,sha256=XHJ_sfGyeamCW4krEaz
|
|
51
51
|
enterprise_data/api/v1/views/analytics_enrollments.py,sha256=_KBo4RhEmfQXcCOgvowD28WCVJwlc4APuCnRDbAYK9E,6563
|
52
52
|
enterprise_data/api/v1/views/analytics_leaderboard.py,sha256=3dyo7_OhyGEEeibemBrRsUOo0jbM4LbDgV5gw3YnVig,4186
|
53
53
|
enterprise_data/api/v1/views/base.py,sha256=Kkmd5zgEBAhvwS_GoGXSK6lgbDNwSPioYn-QbnizI3w,3416
|
54
|
-
enterprise_data/api/v1/views/enterprise_admin.py,sha256=
|
54
|
+
enterprise_data/api/v1/views/enterprise_admin.py,sha256=2tmn_1XPHlVW1WJ5H120bNqMkykBCij4i5TSHrLahkk,9923
|
55
55
|
enterprise_data/api/v1/views/enterprise_learner.py,sha256=vRzfaQCEoeq_tEY7KsNZJVzgn7XEWZ1l-n0oUoSVGyU,20093
|
56
56
|
enterprise_data/api/v1/views/enterprise_offers.py,sha256=VifxgqTLFLVw4extYPlHcN1N_yjXcsYsAlYEnAbpb10,1266
|
57
57
|
enterprise_data/cache/__init__.py,sha256=fiBUploll1kmDy2vCmnNpeZVTD4ewsgtRF14vVs0Rb4,1850
|
@@ -189,7 +189,7 @@ enterprise_reporting/tests/test_send_enterprise_reports.py,sha256=zBj7sDvRLJQbRs
|
|
189
189
|
enterprise_reporting/tests/test_utils.py,sha256=y4t6w9aKra-ftqtUeHvPwOhje-1npz7auV5o74ya8fE,9523
|
190
190
|
enterprise_reporting/tests/test_vertica_client.py,sha256=-R2yNCGUjRtoXwLMBloVFQkFYrJoo613VCr61gwI3kQ,140
|
191
191
|
enterprise_reporting/tests/utils.py,sha256=xms2LM7DV3wczXEfctOK1ddel1EE0J_YSr17UzbCDy4,1401
|
192
|
-
edx_enterprise_data-10.17.
|
193
|
-
edx_enterprise_data-10.17.
|
194
|
-
edx_enterprise_data-10.17.
|
195
|
-
edx_enterprise_data-10.17.
|
192
|
+
edx_enterprise_data-10.17.2.dist-info/METADATA,sha256=4xDHbwZ3eS2mE0oX0TAqzl3D68anT6WKLqc7Kd9mlv0,1703
|
193
|
+
edx_enterprise_data-10.17.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
194
|
+
edx_enterprise_data-10.17.2.dist-info/top_level.txt,sha256=f5F2kU-dob6MqiHJpgZkFzoCD5VMhsdpkTV5n9Tvq3I,59
|
195
|
+
edx_enterprise_data-10.17.2.dist-info/RECORD,,
|
enterprise_data/__init__.py
CHANGED
@@ -5,6 +5,12 @@ Constants for admin analytics app.
|
|
5
5
|
from enum import Enum
|
6
6
|
|
7
7
|
|
8
|
+
class CourseType(Enum):
|
9
|
+
"""Course type choices"""
|
10
|
+
OCM = "OCM"
|
11
|
+
EXECUTIVE_EDUCATION = "Executive Education"
|
12
|
+
|
13
|
+
|
8
14
|
class ResponseType(Enum):
|
9
15
|
"""Response type choices"""
|
10
16
|
JSON = 'json'
|
@@ -9,11 +9,11 @@ class SkillsDailyRollupAdminDashQueries:
|
|
9
9
|
Queries related to the skills_daily_rollup_admin_dash table.
|
10
10
|
"""
|
11
11
|
@staticmethod
|
12
|
-
def get_top_skills():
|
12
|
+
def get_top_skills(query_filters: QueryFilters):
|
13
13
|
"""
|
14
14
|
Get the query to fetch the top skills for an enterprise customer.
|
15
15
|
"""
|
16
|
-
return """
|
16
|
+
return f"""
|
17
17
|
SELECT
|
18
18
|
skill_name,
|
19
19
|
skill_type,
|
@@ -22,8 +22,7 @@ class SkillsDailyRollupAdminDashQueries:
|
|
22
22
|
FROM
|
23
23
|
skills_daily_rollup_admin_dash
|
24
24
|
WHERE
|
25
|
-
|
26
|
-
date BETWEEN %(start_date)s AND %(end_date)s
|
25
|
+
{query_filters.to_sql()}
|
27
26
|
GROUP BY
|
28
27
|
skill_name, skill_type
|
29
28
|
ORDER BY
|
@@ -31,21 +30,27 @@ class SkillsDailyRollupAdminDashQueries:
|
|
31
30
|
"""
|
32
31
|
|
33
32
|
@staticmethod
|
34
|
-
def get_top_skills_by_enrollment():
|
33
|
+
def get_top_skills_by_enrollment(query_filters: QueryFilters):
|
35
34
|
"""
|
36
35
|
Get the query to fetch the top skills by enrollment for an enterprise customer.
|
37
36
|
"""
|
38
|
-
return """
|
39
|
-
WITH
|
40
|
-
-- Get top 10 skills by total enrollments
|
37
|
+
return f"""
|
38
|
+
WITH FilteredData AS (
|
41
39
|
SELECT
|
42
40
|
skill_name,
|
43
|
-
|
41
|
+
primary_subject_name,
|
42
|
+
enrolls
|
44
43
|
FROM
|
45
44
|
skills_daily_rollup_admin_dash
|
46
45
|
WHERE
|
47
|
-
|
48
|
-
|
46
|
+
{query_filters.to_sql()}
|
47
|
+
),
|
48
|
+
TopSkills AS (
|
49
|
+
SELECT
|
50
|
+
skill_name,
|
51
|
+
SUM(enrolls) AS total_enrollment_count
|
52
|
+
FROM
|
53
|
+
FilteredData
|
49
54
|
GROUP BY
|
50
55
|
skill_name
|
51
56
|
ORDER BY
|
@@ -53,44 +58,48 @@ class SkillsDailyRollupAdminDashQueries:
|
|
53
58
|
LIMIT 10
|
54
59
|
)
|
55
60
|
SELECT
|
56
|
-
|
61
|
+
fd.skill_name,
|
57
62
|
CASE
|
58
|
-
WHEN
|
63
|
+
WHEN fd.primary_subject_name IN (
|
59
64
|
'business-management', 'computer-science',
|
60
65
|
'data-analysis-statistics', 'engineering', 'communication'
|
61
|
-
) THEN
|
66
|
+
) THEN fd.primary_subject_name
|
62
67
|
ELSE 'other'
|
63
68
|
END AS subject_name,
|
64
|
-
SUM(
|
69
|
+
SUM(fd.enrolls) AS count
|
65
70
|
FROM
|
66
|
-
|
71
|
+
FilteredData fd
|
67
72
|
JOIN
|
68
|
-
TopSkills
|
69
|
-
WHERE
|
70
|
-
sd.enterprise_customer_uuid=%(enterprise_customer_uuid)s
|
71
|
-
AND date BETWEEN %(start_date)s AND %(end_date)s
|
73
|
+
TopSkills ts ON fd.skill_name = ts.skill_name
|
72
74
|
GROUP BY
|
73
|
-
|
75
|
+
fd.skill_name, subject_name
|
74
76
|
ORDER BY
|
75
|
-
total_enrollment_count DESC;
|
77
|
+
ts.total_enrollment_count DESC;
|
76
78
|
"""
|
77
79
|
|
78
80
|
@staticmethod
|
79
|
-
def get_top_skills_by_completion():
|
81
|
+
def get_top_skills_by_completion(query_filters: QueryFilters):
|
80
82
|
"""
|
81
83
|
Get the query to fetch the top skills by completion for an enterprise customer.
|
82
84
|
"""
|
83
|
-
return """
|
84
|
-
WITH
|
85
|
-
-- Get top 10 skills by total completions
|
85
|
+
return f"""
|
86
|
+
WITH FilteredData AS (
|
86
87
|
SELECT
|
87
88
|
skill_name,
|
88
|
-
|
89
|
+
primary_subject_name,
|
90
|
+
completions
|
89
91
|
FROM
|
90
92
|
skills_daily_rollup_admin_dash
|
91
93
|
WHERE
|
92
|
-
|
93
|
-
|
94
|
+
{query_filters.to_sql()}
|
95
|
+
),
|
96
|
+
TopSkills AS (
|
97
|
+
-- Get top 10 skills by total completions
|
98
|
+
SELECT
|
99
|
+
skill_name,
|
100
|
+
SUM(completions) AS total_completion_count
|
101
|
+
FROM
|
102
|
+
FilteredData
|
94
103
|
GROUP BY
|
95
104
|
skill_name
|
96
105
|
ORDER BY
|
@@ -98,26 +107,23 @@ class SkillsDailyRollupAdminDashQueries:
|
|
98
107
|
LIMIT 10
|
99
108
|
)
|
100
109
|
SELECT
|
101
|
-
|
110
|
+
fd.skill_name,
|
102
111
|
CASE
|
103
|
-
WHEN
|
112
|
+
WHEN fd.primary_subject_name IN (
|
104
113
|
'business-management', 'computer-science',
|
105
114
|
'data-analysis-statistics', 'engineering', 'communication'
|
106
|
-
) THEN
|
115
|
+
) THEN fd.primary_subject_name
|
107
116
|
ELSE 'other'
|
108
117
|
END AS subject_name,
|
109
|
-
SUM(
|
118
|
+
SUM(fd.completions) AS count
|
110
119
|
FROM
|
111
|
-
|
120
|
+
FilteredData AS fd
|
112
121
|
JOIN
|
113
|
-
TopSkills AS ts ON
|
114
|
-
WHERE
|
115
|
-
sd.enterprise_customer_uuid=%(enterprise_customer_uuid)s
|
116
|
-
AND date BETWEEN %(start_date)s AND %(end_date)s
|
122
|
+
TopSkills AS ts ON fd.skill_name = ts.skill_name
|
117
123
|
GROUP BY
|
118
|
-
|
124
|
+
fd.skill_name, subject_name
|
119
125
|
ORDER BY
|
120
|
-
total_completion_count DESC;
|
126
|
+
ts.total_completion_count DESC;
|
121
127
|
"""
|
122
128
|
|
123
129
|
@staticmethod
|
@@ -22,8 +22,70 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
22
22
|
"""
|
23
23
|
queries = SkillsDailyRollupAdminDashQueries()
|
24
24
|
|
25
|
+
def build_query_filters(
|
26
|
+
self,
|
27
|
+
enterprise_customer_uuid: UUID,
|
28
|
+
start_date: date,
|
29
|
+
end_date: date,
|
30
|
+
course_type: str = None,
|
31
|
+
course_key: str = None,
|
32
|
+
):
|
33
|
+
"""
|
34
|
+
Build query filters and parameters for enterprise analytics queries.
|
35
|
+
|
36
|
+
Arguments:
|
37
|
+
enterprise_customer_uuid (UUID): The UUID of the enterprise customer.
|
38
|
+
start_date (date): The start date for the query.
|
39
|
+
end_date (date): The end date for the query.
|
40
|
+
course_type (str, optional): The course type to filter by (e.g., 'OCM', 'Executive Education').
|
41
|
+
course_key (str, optional): The course key to filter by.
|
42
|
+
|
43
|
+
Returns:
|
44
|
+
tuple: A tuple containing:
|
45
|
+
- QueryFilters: The filters to apply to the query.
|
46
|
+
- dict: The parameters to use in the query.
|
47
|
+
"""
|
48
|
+
optional_params = {}
|
49
|
+
default_params = {
|
50
|
+
'enterprise_customer_uuid': enterprise_customer_uuid,
|
51
|
+
'start_date': start_date,
|
52
|
+
'end_date': end_date,
|
53
|
+
}
|
54
|
+
|
55
|
+
query_filters = QueryFilters([
|
56
|
+
self.enterprise_customer_uuid_filter('enterprise_customer_uuid'),
|
57
|
+
self.date_range_filter(
|
58
|
+
column='date',
|
59
|
+
start_date_params_key='start_date',
|
60
|
+
end_date_params_key='end_date',
|
61
|
+
),
|
62
|
+
])
|
63
|
+
|
64
|
+
if course_key:
|
65
|
+
query_filters.append(EqualQueryFilter(
|
66
|
+
column='course_key',
|
67
|
+
value_placeholder='course_key',
|
68
|
+
))
|
69
|
+
optional_params['course_key'] = course_key
|
70
|
+
|
71
|
+
if course_type:
|
72
|
+
query_filters.append(EqualQueryFilter(
|
73
|
+
column='course_product_line',
|
74
|
+
value_placeholder='course_type',
|
75
|
+
))
|
76
|
+
optional_params['course_type'] = course_type
|
77
|
+
|
78
|
+
params = {**default_params, **optional_params}
|
79
|
+
return query_filters, params
|
80
|
+
|
25
81
|
@cache_it()
|
26
|
-
def get_top_skills(
|
82
|
+
def get_top_skills(
|
83
|
+
self,
|
84
|
+
enterprise_customer_uuid: UUID,
|
85
|
+
start_date: date,
|
86
|
+
end_date: date,
|
87
|
+
course_type: str = None,
|
88
|
+
):
|
27
89
|
"""
|
28
90
|
Get the top skills for the given enterprise customer.
|
29
91
|
|
@@ -31,17 +93,20 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
31
93
|
enterprise_customer_uuid (UUID): The UUID of the enterprise customer.
|
32
94
|
start_date (date): The start date.
|
33
95
|
end_date (date): The end date.
|
96
|
+
course_type (str): The course type (OCM or Executive Education) to filter by (optional).
|
34
97
|
|
35
98
|
Returns:
|
36
99
|
list<dict>: A list of dictionaries containing the skill_name, skill_type, enrolls and completions.
|
37
100
|
"""
|
101
|
+
query_filters, params = self.build_query_filters(
|
102
|
+
enterprise_customer_uuid=enterprise_customer_uuid,
|
103
|
+
start_date=start_date,
|
104
|
+
end_date=end_date,
|
105
|
+
course_type=course_type,
|
106
|
+
)
|
38
107
|
return run_query(
|
39
|
-
query=self.queries.get_top_skills(),
|
40
|
-
params=
|
41
|
-
'enterprise_customer_uuid': enterprise_customer_uuid,
|
42
|
-
'start_date': start_date,
|
43
|
-
'end_date': end_date,
|
44
|
-
},
|
108
|
+
query=self.queries.get_top_skills(query_filters),
|
109
|
+
params=params,
|
45
110
|
as_dict=True,
|
46
111
|
)
|
47
112
|
|
@@ -50,7 +115,8 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
50
115
|
self,
|
51
116
|
enterprise_customer_uuid: UUID,
|
52
117
|
start_date: date,
|
53
|
-
end_date: date
|
118
|
+
end_date: date,
|
119
|
+
course_type: str = None,
|
54
120
|
):
|
55
121
|
"""
|
56
122
|
Get the top skills by enrollments for the given enterprise customer.
|
@@ -59,17 +125,20 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
59
125
|
enterprise_customer_uuid (UUID): The UUID of the enterprise customer.
|
60
126
|
start_date (date): The start date.
|
61
127
|
end_date (date): The end date.
|
128
|
+
course_type (str): The course type (OCM or Executive Education) to filter by (optional).
|
62
129
|
|
63
130
|
Returns:
|
64
131
|
list<dict>: A list of dictionaries containing the skill_name, subject_name, count.
|
65
132
|
"""
|
133
|
+
query_filters, params = self.build_query_filters(
|
134
|
+
enterprise_customer_uuid=enterprise_customer_uuid,
|
135
|
+
start_date=start_date,
|
136
|
+
end_date=end_date,
|
137
|
+
course_type=course_type,
|
138
|
+
)
|
66
139
|
return run_query(
|
67
|
-
query=self.queries.get_top_skills_by_enrollment(),
|
68
|
-
params=
|
69
|
-
'enterprise_customer_uuid': enterprise_customer_uuid,
|
70
|
-
'start_date': start_date,
|
71
|
-
'end_date': end_date,
|
72
|
-
},
|
140
|
+
query=self.queries.get_top_skills_by_enrollment(query_filters),
|
141
|
+
params=params,
|
73
142
|
as_dict=True,
|
74
143
|
)
|
75
144
|
|
@@ -78,7 +147,8 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
78
147
|
self,
|
79
148
|
enterprise_customer_uuid: UUID,
|
80
149
|
start_date: date,
|
81
|
-
end_date: date
|
150
|
+
end_date: date,
|
151
|
+
course_type: str = None,
|
82
152
|
):
|
83
153
|
"""
|
84
154
|
Get the top skills by completion for the given enterprise customer.
|
@@ -87,17 +157,20 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
87
157
|
enterprise_customer_uuid (UUID): The UUID of the enterprise customer.
|
88
158
|
start_date (date): The start date.
|
89
159
|
end_date (date): The end date.
|
160
|
+
course_type (str): The course type (OCM or Executive Education) to filter by (optional).
|
90
161
|
|
91
162
|
Returns:
|
92
163
|
list<dict>: A list of dictionaries containing the skill_name, subject_name, count.
|
93
164
|
"""
|
165
|
+
query_filters, params = self.build_query_filters(
|
166
|
+
enterprise_customer_uuid=enterprise_customer_uuid,
|
167
|
+
start_date=start_date,
|
168
|
+
end_date=end_date,
|
169
|
+
course_type=course_type,
|
170
|
+
)
|
94
171
|
return run_query(
|
95
|
-
query=self.queries.get_top_skills_by_completion(),
|
96
|
-
params=
|
97
|
-
'enterprise_customer_uuid': enterprise_customer_uuid,
|
98
|
-
'start_date': start_date,
|
99
|
-
'end_date': end_date,
|
100
|
-
},
|
172
|
+
query=self.queries.get_top_skills_by_completion(query_filters),
|
173
|
+
params=params,
|
101
174
|
as_dict=True,
|
102
175
|
)
|
103
176
|
|
@@ -122,44 +195,13 @@ class SkillsDailyRollupAdminDashTable(CommonFiltersMixin, BaseTable):
|
|
122
195
|
Returns:
|
123
196
|
list<dict>: A list of dictionaries containing the skill_name, subject_name, count.
|
124
197
|
"""
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
'end_date': end_date,
|
133
|
-
}
|
134
|
-
query_filters = QueryFilters([
|
135
|
-
self.enterprise_customer_uuid_filter('enterprise_customer_uuid'),
|
136
|
-
self.date_range_filter(
|
137
|
-
column='date',
|
138
|
-
start_date_params_key='start_date',
|
139
|
-
end_date_params_key='end_date',
|
140
|
-
),
|
141
|
-
])
|
142
|
-
|
143
|
-
if course_key:
|
144
|
-
course_key_filter = EqualQueryFilter(
|
145
|
-
column='course_key',
|
146
|
-
value_placeholder='course_key',
|
147
|
-
)
|
148
|
-
|
149
|
-
optional_params['course_key'] = course_key
|
150
|
-
query_filters.append(course_key_filter)
|
151
|
-
|
152
|
-
if course_type:
|
153
|
-
course_type_filter = EqualQueryFilter(
|
154
|
-
column='course_product_line',
|
155
|
-
value_placeholder='course_type',
|
156
|
-
)
|
157
|
-
|
158
|
-
optional_params['course_type'] = course_type
|
159
|
-
query_filters.append(course_type_filter)
|
160
|
-
|
161
|
-
params = {**default_params, **optional_params}
|
162
|
-
|
198
|
+
query_filters, params = self.build_query_filters(
|
199
|
+
enterprise_customer_uuid=enterprise_customer_uuid,
|
200
|
+
start_date=start_date,
|
201
|
+
end_date=end_date,
|
202
|
+
course_key=course_key,
|
203
|
+
course_type=course_type,
|
204
|
+
)
|
163
205
|
return run_query(
|
164
206
|
query=self.queries.get_skills_by_learning_hours(query_filters),
|
165
207
|
params=params,
|
@@ -5,7 +5,7 @@ from uuid import UUID
|
|
5
5
|
|
6
6
|
from rest_framework import serializers
|
7
7
|
|
8
|
-
from enterprise_data.admin_analytics.constants import ResponseType
|
8
|
+
from enterprise_data.admin_analytics.constants import CourseType, ResponseType
|
9
9
|
from enterprise_data.cache.decorators import cache_it
|
10
10
|
from enterprise_data.models import (
|
11
11
|
EnterpriseAdminLearnerProgress,
|
@@ -343,6 +343,12 @@ class AdvanceAnalyticsQueryParamSerializer(serializers.Serializer): # pylint: d
|
|
343
343
|
page = serializers.IntegerField(required=False, min_value=1)
|
344
344
|
page_size = serializers.IntegerField(required=False, min_value=2)
|
345
345
|
group_uuid = serializers.UUIDField(required=False)
|
346
|
+
course_type = serializers.ChoiceField(
|
347
|
+
choices=[course_type.value for course_type in CourseType],
|
348
|
+
required=False,
|
349
|
+
allow_blank=False,
|
350
|
+
allow_null=False,
|
351
|
+
)
|
346
352
|
|
347
353
|
def validate(self, attrs):
|
348
354
|
"""
|
@@ -163,21 +163,29 @@ class EnterpriseAdminAnalyticsSkillsView(APIView):
|
|
163
163
|
start_date, _ = FactEnrollmentAdminDashTable().get_enrollment_date_range(enterprise_id)
|
164
164
|
|
165
165
|
end_date = serializer.data.get('end_date', date.today())
|
166
|
+
course_type = serializer.data.get('course_type')
|
166
167
|
|
167
168
|
with timer('top_skills'):
|
168
|
-
skills = SkillsDailyRollupAdminDashTable().get_top_skills(
|
169
|
+
skills = SkillsDailyRollupAdminDashTable().get_top_skills(
|
170
|
+
enterprise_id,
|
171
|
+
start_date,
|
172
|
+
end_date,
|
173
|
+
course_type
|
174
|
+
)
|
169
175
|
|
170
176
|
with timer('top_skills_by_enrollments'):
|
171
177
|
top_skills_by_enrollments = SkillsDailyRollupAdminDashTable().get_top_skills_by_enrollment(
|
172
178
|
enterprise_id,
|
173
179
|
start_date,
|
174
|
-
end_date
|
180
|
+
end_date,
|
181
|
+
course_type
|
175
182
|
)
|
176
183
|
with timer('top_skills_by_completions'):
|
177
184
|
top_skills_by_completions = SkillsDailyRollupAdminDashTable().get_top_skills_by_completion(
|
178
185
|
enterprise_id,
|
179
186
|
start_date,
|
180
|
-
end_date
|
187
|
+
end_date,
|
188
|
+
course_type
|
181
189
|
)
|
182
190
|
|
183
191
|
# TODO: Handle course_key and course_type when they are provided in the request.
|
File without changes
|
{edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{edx_enterprise_data-10.17.0.dist-info → edx_enterprise_data-10.17.2.dist-info}/top_level.txt
RENAMED
File without changes
|