Finally got around to solving this problem - the secret was the 
dump_course_structure function (from edx-platform 
<https://github.com/edx/edx-platform/blob/master/lms/djangoapps/courseware/management/commands/dump_course_structure.py>
).

Wrote some parsers and docs for it: 
https://github.com/SamuelMarks/openedx-modulestore-utils

Now finding number of minutes taken per problem per exam is as easy as:

SELECT
  T0.*, T1.exam, T1.display_name,
  TIMESTAMPDIFF(MINUTE, T0.created, T0.modified)  minutes_taken
FROM edxapp.courseware_studentmodule T0
JOIN parsed_ms T1
ON T0.module_id = T1.block_id
WHERE T1.exam IS NOT NULL AND T0.module_type = 'problem';

:D

On Monday, December 11, 2017 at 1:05:13 AM UTC+11, Samuel Marks wrote:
>
> Thanks, I've added a little command for this: edx-platform$ ./manage.py 
> cms --info-for-course-id '<course_id>'
>
>  https://github.com/SamuelMarks/edx-platform/tree/SamuelMarks/ginkgo
>
> Getting this output though, will debug in the morning:
> Traceback (most recent call last):
>   File "./manage.py", line 132, in <module>
>     main()
>   File "./manage.py", line 115, in main
>     dump_course_info(edx_args.info_for_course_id)
>   File "/opt/openedx/edx-platform/hacks.py", line 25, in dump_course_info
>     ms = modulestore()
>   File 
> "/opt/openedx/edx-platform/common/lib/xmodule/xmodule/modulestore/django.py"
> , line 330, in modulestore
>     settings.MODULESTORE['default']['ENGINE'],
>   File 
> "/opt/openedx/venv/local/lib/python2.7/site-packages/django/conf/__init__.py"
> , line 49, in __getattr__
>     return getattr(self._wrapped, name)
>   File 
> "/opt/openedx/venv/local/lib/python2.7/site-packages/django/conf/__init__.py"
> , line 160, in __getattr__
>     return getattr(self.default_settings, name)
> AttributeError: 'module' object has no attribute 'MODULESTORE
>
> (done on my Open edX install, from my Fabric script: 
> https://github.com/offscale/offregister-openedx based off 
> https://github.com/regisb/openedx-install )
>
> On Wednesday, November 15, 2017 at 4:05:26 PM UTC+11, Samuel Marks wrote:
>>
>> How do I get the exam name?
>>
>> I've been doing my head in exporting from MongoDB modulestore.structures 
>> to import to MySQL so that I can JOIN across the fields; but I've been 
>> having difficulty acquiring the full hierarchy.
>>
>> From my understanding MongoDB stores the course structure—including exam 
>> name—and MySQL stores the student_id, grade, max_grade and timing (how 
>> long each question took to answer).
>>
>> In MongoDB modulestore.structures is a collection of documents like so:
>>
>>    - _id: ObjectId, original_version: ObjectId, blocks: Array<{}>
>>    - [opening up and enumerating block fields within block objects 
>>    within blocks array]:
>>       - block_id, block_type, fields
>>          - fields.format contains exam name
>>          - The only fields.format with exam name have block_type = 
>>          'sequential'
>>          - But not all have. E.g.: out of my 10883 sequential blocks I 
>>          have 262 non null fields.format
>>          
>> The block_type is a single one of these options, which I believe to be in 
>> this hierarchy:
>>
>>    1. course
>>    2. chapter
>>    3. sequential
>>    4. survey || video || problem
>>    
>> In MySQL edxapp.courseware_studentmodule the field is called module_type 
>> (whereas MongoDB calls it block_type).
>>
>> My many attempts at solving this problem: 
>> https://gist.github.com/SamuelMarks/b284c5fc4c6699cdfd603f6b9065c513
>>
>> Help would be most appreciated.
>>
>> Thanks
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"General Open edX discussion" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/edx-code/5c2d7475-9bce-47c3-8bb3-c1157a64cf7d%40googlegroups.com.

Reply via email to