Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
insights
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
insights
Commits
d154a7eb
Commit
d154a7eb
authored
Nov 26, 2013
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datajam: capture answers to problems
parent
51fb6572
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
example/src/datajam/datajam/settings.py
+1
-0
example/src/datajam/ipython/Answer Histograms.ipynb
+0
-0
example/src/datajam/modules/problem_answers.py
+49
-0
No files found.
example/src/datajam/datajam/settings.py
View file @
d154a7eb
...
@@ -33,6 +33,7 @@ TIME_BETWEEN_DATA_REGENERATION = datetime.timedelta(minutes=1)
...
@@ -33,6 +33,7 @@ TIME_BETWEEN_DATA_REGENERATION = datetime.timedelta(minutes=1)
INSTALLED_ANALYTICS_MODULES
=
[
INSTALLED_ANALYTICS_MODULES
=
[
'modules.dump_to_db'
,
'modules.dump_to_db'
,
'modules.instructor_dash'
,
'modules.instructor_dash'
,
'modules.problem_answers'
,
]
]
print
INSTALLED_ANALYTICS_MODULES
print
INSTALLED_ANALYTICS_MODULES
...
...
example/src/datajam/ipython/Answer Histograms.ipynb
0 → 100644
View file @
d154a7eb
This diff is collapsed.
Click to expand it.
example/src/datajam/modules/problem_answers.py
0 → 100644
View file @
d154a7eb
from
bson.json_util
import
dumps
from
edinsights.core.decorators
import
event_handler
from
edinsights.core.decorators
import
query
@query
()
def
all_problem_answers
(
mongodb
):
"""
Returns a list of records each containing the problem, the student response
and the number of times that response has been seen for that problem.
Example::
[
{
"question": "i4x-edX-E101-problem-a0effb954cca4759994f1ac9e9434bf4_3_1",
"answer": "choice_0",
"count": 5
},
{
"question": "i4x-edX-E101-problem-a0effb954cca4759994f1ac9e9434bf4_3_1",
"answer": "blue",
"count": 30
},
]
"""
return
dumps
(
mongodb
[
'problem_answers'
]
.
find
())
@event_handler
()
def
handle_problem_checks
(
mongodb
,
events
):
collection
=
mongodb
[
'problem_answers'
]
answers
=
[]
for
event_wrapper
in
events
:
event
=
event_wrapper
.
event
has_event_field
=
'event'
in
event
is_problem_check
=
event
.
get
(
'event_type'
)
==
'problem_check'
is_from_server
=
event
.
get
(
'event_source'
)
==
'server'
if
is_problem_check
and
is_from_server
and
has_event_field
:
for
question
,
answer
in
event
.
get
(
'event'
,
{})
.
get
(
'answers'
,
{})
.
iteritems
():
collection
.
update
(
{
'question'
:
question
,
'answer'
:
answer
},
{
'$inc'
:
{
'count'
:
1
}
},
upsert
=
True
)
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