Hi Samuel,
The most straightforward way to get the exam name is by using the
modulestore interface in Python code. If you create a Django management
command, you can do something like this:
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import UsageKey
key = UsageKey.from_string("block-v1:edX+DemoX+Demo_Course+type@problem
+block@d2e35c1d294b4ba0b3b1048615605d2a")
ms = modulestore()
seq = ms.get_item(key)
seq.display_name
Please note that this has to run in the context of Django and the
virtualenv you run edx-platform with, or it will fail because it's missing
libraries and configuration.
If you need to get all the sequences in a course, you can do:
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.keys import CourseKey, UsageKey
course_key = CourseKey.from_string("course-v1:edX+DemoX+Demo_Course")
ms = modulestore()
sequences = ms.get_items(course_key, qualifiers={'category': 'sequential'})
for seq in sequences:
print seq.location, seq.display_name
That will print both the location (the module_id used in the
courseware_studentmodule table) and the display name for all sequences.
There are a lot of attributes on SequenceDescriptor objects, so you can
inspect them to see what else might be useful to you.
There were also recent additions that put this data in a more easily
digestible form in MySQL (introduced in Ficus, but more stable in Ginkgo).
Documenting the migration process is on the todo-list for Hawthorn, but the
data model is documented here:
https://openedx.atlassian.net/wiki/spaces/AC/pages/125927634/Grades+Data+Model
This is part of the larger re-working of how grades are calculated and
stored:
https://openedx.atlassian.net/wiki/spaces/AC/pages/159458764/Grades+Architecture
Hope that helps a little. Take care.
Dave
On Wed, Nov 15, 2017 at 12:05 AM, Samuel Marks <[email protected]>
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/5637ceae-dbe0-488b-b166-c414243a3078%40googlegroups.com
> <https://groups.google.com/d/msgid/edx-code/5637ceae-dbe0-488b-b166-c414243a3078%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CAO_oFPyWn4RWk8M%3D%2B5RZ9HjDH3v1CgruCWKk1aO80ZqhHJWF%2Bg%40mail.gmail.com.