Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3bb3cf3c
Commit
3bb3cf3c
authored
Mar 09, 2013
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate some of the analytic fetching logic in the instructor dashboard.
parent
c43d4b34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
119 deletions
+61
-119
lms/djangoapps/instructor/views.py
+26
-73
lms/envs/dev.py
+1
-1
lms/templates/courseware/instructor_dashboard.html
+34
-45
No files found.
lms/djangoapps/instructor/views.py
View file @
3bb3cf3c
...
...
@@ -594,72 +594,34 @@ def instructor_dashboard(request, course_id):
#----------------------------------------
# analytics
def
get_analytics_result
(
analytics_name
):
url
=
settings
.
ANALYTICS_SERVER_URL
+
\
"get?aname={}&course_id={}"
.
format
(
analytics_name
,
course_id
)
res
=
requests
.
get
(
url
)
if
res
.
status_code
==
codes
.
OK
:
# WARNING: do not use req.json because the preloaded json doesn't
# preserve the order of the original record use instead:
# json.loads(req.content, object_pairs_hook=OrderedDict)
return
json
.
loads
(
res
.
content
,
object_pairs_hook
=
OrderedDict
)
else
:
log
.
error
(
"Error fetching
%
s, code:
%
s, msg:
%
s"
,
(
url
,
res
.
status_code
,
res
.
content
))
return
None
attempted_problems
=
None
students_enrolled_json
=
None
students_active_json
=
None
daily_activity_json
=
None
students_per_problem_correct_json
=
None
overall_grade_distribution
=
None
dropoff_per_day
=
None
analytics_results
=
{}
if
idash_mode
==
'Analytics'
:
# get current day
to_day
=
datetime
.
today
()
.
date
()
from_day
=
to_day
-
timedelta
(
days
=
7
)
# WARNING: do not use req.json because the preloaded json doesn't preserve the order of the original record
# use instead: json.loads(req.content, object_pairs_hook=OrderedDict)
# number of students enrolled in this course
res
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get?aname=StudentsEnrolled&course_id=
%
s"
%
course_id
)
if
res
.
status_code
==
codes
.
OK
:
students_enrolled_json
=
json
.
loads
(
res
.
content
,
object_pairs_hook
=
OrderedDict
)
else
:
students_enrolled_json
=
None
# # number of students active in the past 7 days (including current day), i.e. with at least one activity for the period
# #req = requests.get(settings.ANALYTICS_SERVER_URL + "get_analytics?aname=StudentsActive&course_id=%s&from=%s" % (course_id,from_day))
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsActive&course_id=%s" % (course_id,)) # default is active past 7 days
# if req.content != 'None':
# students_active_json = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# number of students per problem who have problem graded correct
res
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get?aname=StudentsPerProblemCorrect&course_id=
%
s"
%
(
course_id
,))
if
res
.
status_code
==
codes
.
OK
:
students_per_problem_correct_json
=
json
.
loads
(
res
.
content
,
object_pairs_hook
=
OrderedDict
)
else
:
students_per_problem_correct_json
=
None
# # number of students per problem who have problem graded correct <<< THIS IS FOR ACTIVE STUDENTS
# # req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsPerProblemCorrect&course_id=%s&from=%s" % (course_id,from_day))
# # if req.content != 'None':
# # students_per_problem_correct_json = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# # grade distribution for the course +++ this is not the desired distribution +++
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=OverallGradeDistribution&course_id=%s" % (course_id,))
# if req.content != 'None':
# overall_grade_distribution = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# # number of students distribution drop off per day
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsDropoffPerDay&course_id=%s&from=%s" % (course_id,from_day))
# if req.content != 'None':
# dropoff_per_day = json.loads(req.content, object_pairs_hook=OrderedDict)
#
# # number of students per problem who attempted this problem at least once
# req = requests.get(settings.ANALYTICS_SERVER_URL + "get?aname=StudentsAttemptedProblems&course_id=%s" % course_id)
# if req.content != 'None':
# attempted_problems = json.loads(req.content, object_pairs_hook=OrderedDict)
# number of students active in the past 7 days (including current day) --- online version! experimental
to_day
=
datetime
.
today
()
.
date
()
from_day
=
to_day
-
timedelta
(
days
=
7
)
req
=
requests
.
get
(
settings
.
ANALYTICS_SERVER_URL
+
"get_analytics?aname=DailyActivityAnalyzer&course_id=
%
s&from=
%
s&to=
%
s"
%
(
course_id
,
from_day
,
to_day
))
daily_activity_json
=
req
.
json
DASHBOARD_ANALYTICS
=
[
"StudentsAttemptedProblems"
,
# num students who tried given problem
"StudentsDailyActivity"
,
# active students by day
"StudentsDropoffPerDay"
,
# active students dropoff by day
"OverallGradeDistribution"
,
# overall point distribution for course
"StudentsActive"
,
# num students active in time period (default = 1wk)
"StudentsEnrolled"
,
# num students enrolled
"StudentsPerProblemCorrect"
,
# foreach problem, num students correct
]
for
analytic_name
in
DASHBOARD_ANALYTICS
:
analytics_results
[
analytic_name
]
=
get_analytics_result
(
analytic_name
)
#----------------------------------------
# offline grades?
...
...
@@ -687,16 +649,7 @@ def instructor_dashboard(request, course_id):
'offline_grade_log'
:
offline_grades_available
(
course_id
),
'cohorts_ajax_url'
:
reverse
(
'cohorts'
,
kwargs
=
{
'course_id'
:
course_id
}),
# The following are specific analytics metrics that should be
# put in their own space...
'students_enrolled_json'
:
students_enrolled_json
,
# 'students_active_json' : students_active_json,
# 'daily_activity_json' : daily_activity_json,
'students_per_problem_correct_json'
:
students_per_problem_correct_json
,
# 'overall_grade_distribution' : overall_grade_distribution,
# 'dropoff_per_day' : dropoff_per_day,
# 'attempted_problems' : attempted_problems
'analytics_results'
:
analytics_results
,
}
return
render_to_response
(
'courseware/instructor_dashboard.html'
,
context
)
...
...
lms/envs/dev.py
View file @
3bb3cf3c
...
...
@@ -220,5 +220,5 @@ PEARSON_TEST_PASSWORD = "12345"
########################## ANALYTICS TESTING ########################
ANALYTICS_SERVER_URL
=
"http://127.0.0.1:
14141
/"
ANALYTICS_SERVER_URL
=
"http://127.0.0.1:
9000
/"
lms/templates/courseware/instructor_dashboard.html
View file @
3bb3cf3c
...
...
@@ -371,57 +371,46 @@ function goto( mode)
%if modeflag.get('Analytics'):
<p>
Students enrolled:
% if students_enrolled_json and "data" in students_enrolled_json:
${students_enrolled_json['data'][0]['students']}
<!-- ${students_enrolled_json['time']} -->
% endif
</p>
%if analytics_results.get("StudentsEnrolled"):
<p>
Students enrolled:
${analytics_results["StudentsEnrolled"]['data'][0]['students']}
</p>
%endif
%if analytics_results.get("StudentsActive"):
<p>
Students active in the last week:
${analytics_results["StudentsActive"]['data'][0]['active']}
</p>
%endif
##This is not as helpful as it could be -- let's give full point distribution
##instead.
%if analytics_results.get("StudentsPerProblemCorrect"):
<p>
Students answering correctly
</p>
<div
class=
"divScroll"
>
<table
class=
"stat_table"
>
<tr>
<th>
Problem
</th>
<th>
Number of students
</th>
</tr>
%for row in analytics_results['StudentsPerProblemCorrect']['data']:
<tr>
<td>
${row['module_id'].split('/')[-1]}
</td>
<td>
${row['count']}
</td>
</tr>
%endfor
</table>
</div>
%endif
<p>
<p>
Students answering correctly
</p>
% if students_per_problem_correct_json and "data" in students_per_problem_correct_json:
<div
class=
"divScroll"
>
<table
class=
"stat_table"
>
<tr><th>
Problem
</th><th>
Number of students
</th></tr>
% for row in students_per_problem_correct_json['data']:
<tr>
<td>
${row['module_id']}
</td>
<td>
${row['count']}
</td>
</tr>
% endfor
</table>
</div>
% endif
</p>
%endif
%if modeflag.get('Analytics In Progress'):
<p>
Number of students enrolled for ${students_enrolled_json['data'][0]['course_id']}:
% if students_enrolled_json is not None:
% if students_enrolled_json['status'] == 'success':
${students_enrolled_json['data'][0]['count']} as of ${students_enrolled_json['time']}
% else:
<i>
${students_enrolled_json['error']}
</i>
% endif
% else:
<i>
null data
</i>
% endif
</p>
<p>
Number of students active for ${students_active_json['data'][0]['course_id']} for the past 7 days:
% if students_active_json is not None:
% if students_active_json['status'] == 'success':
${students_active_json['data'][0]['count']} as of ${students_active_json['time']}
% else:
<i>
${students_active_json['error']}
</i>
% endif
% else:
<i>
null data
</i>
% endif
</p>
<p>
Student distribution per country, all courses, Sep-12 to Oct-17, 1 server (shown here as an example):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment