Courseware StudentModule (CSM) Call Catalog
Below I'm cataloging each and every read/write access to the courseware StudentModule (CSM) Django model. It's essential to know of each access due to our pending work to encapsulate all CSM access behind an interface. The interface backend will support both the present Django ORM and a Cassandra backend to better handle student traffic at scale. Dave Ormsbee has authored this page to capture existing CSM query patterns - the catalog below looks at all code in edx-platform and catalogs access in each file therein.
lms/djangoapps/courseware/model_data.py
FieldDataCache is defined in this file - it's a cache of Django ORM objects from CSM. The object are read into the cache and then modified / written from the cache.
Reads
Call Chain | Query | R/W? | Maps To New Query |
---|---|---|---|
| return self._chunked_query( | R | 001 / 002 |
Writes
Call Chain | Query | R/W? | Maps To New Query |
---|---|---|---|
FieldDataCache.find_or_create() |
| W | 001 / 002 |
DjangoKeyValueStore.set_many() | StudentModule.save() | W | 001 / 002 |
|
| W | 001 / 002 |
lms/djangoapps/class_dashboard/dashboard_data.py
Reads
Call Chain | Query | R/W? | Maps To New Query |
---|---|---|---|
|
| R | 010 |
|
| R | 015 |
|
| R | 012 |
|
| R | 013 |
|
| R | 011 |
lms/djangoapps/courseware/grades.py
Reads
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
|
...which is:
| R | 006 |
_grade(student, request, course, keep_raw_scores) |
| R | --- |
|
| R | 008 |
common/djangoapps/xmodule_modifiers.py
This access behaves poorly - it accesses the CSM table via direct SQL!
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
grade_histogram() |
| R | ---
|
lms/djangoapps/courseware/entrance_exams.py
Determines a user's entrance exam score via direct CSM access.
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
|
| R | 002 / 009 |
lms/djangoapps/courseware/views.py
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
|
| R/W | 003 BUT CSMH will likely become just another column family. Possibly one like:
Row key <course|student|module> => Column Name Column Value <timestamp> : <JSON with version|created|state|grade|max_grade> |
lms/djangoapps/courseware/management/commands/clean_history.py
Django management command that clears CSM history for a particular student module.
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
get_last_student_module_id() | SELECT max(student_module_id) FROM courseware_studentmodulehistory | R | If TTL used, this isn't necessary. |
get_history_for_student_modules() |
| R | (course, student, module, timestamp) |
delete_history() |
| W | We'll use TTL instead of explicit delete? |
lms/djangoapps/courseware/management/commands/regrade_partial.py
One-off Django management command.
Call Chain | Query | Maps to New Query |
---|---|---|
fix_studentmodules() |
| None - will be deleted. |
lms/djangoapps/courseware/management/commands/remove_input_state.py
One-off Django management command.
Call Chain | Query | Maps to New Query |
---|---|---|
fix_studentmodules_in_list() |
| None - will be deleted. |
lms/djangoapps/courseware/management/commands/tests/test_clean_history.py
Call Chain | Query | Maps to New Query |
---|---|---|
From many tests: write_history() |
| --- |
From many tests: read_history() |
| --- |
lms/djangoapps/courseware/tests/test_model_data.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/courseware/tests/test_module_render.py
Two tests - test_xmodule_runtime_publish() & test_xmodule_runtime_publish_delete() -
use direct StudentModule.objects()
access.
lms/djangoapps/courseware/tests/test_submitting_problems.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/instructor/enrollment.py
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
reset_student_attempts() |
| RW | 001 |
lms/djangoapps/instructor/management/commands/openended_stats.py
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
calculate_task_statistics() |
| R | 007 (course, module, students) |
lms/djangoapps/instructor/tests/test_api.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/instructor/tests/test_enrollment.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/instructor/tests/test_tools.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/instructor/views/legacy.py
Dumps CSV of problem reponses.
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
instructor_dashboard() |
| R | None - who needs this? Provide another inteface for it. |
lms/djangoapps/instructor_task/tasks_helper.py
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
perform_module_state_update() |
Also supports a further | RW | 001 / 004 BUT - support of generic filter_fcn() probably not possible. |
lms/djangoapps/instructor_task/tests/test_base.py
A test performs direct StudentModule.object()
access.
lms/djangoapps/instructor_task/tests/test_tasks.py
Several tests perform direct StudentModule.object()
access.
lms/djangoapps/psychometrics/models.py
Creates a model that joins with every single row in CSM. This functionality will likely not be possible with the CSM behind an interface!
Other associated files:
lms/djangoapps/psychometrics/psychoanalyze.py
lms/djangoapps/psychometrics/management/commands/init_psychometrics.py
src/edx-sga/edx_sga/sga.py
Staff-graded assignments XBlock.
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
staff_grading_data() |
| RW | --- |
staff_upload_annotated() |
| RW | --- |
staff_download_annotated() |
| RW | --- |
enter_grade() |
| RW | --- |
remove_grade() |
| RW | --- |
src/edx-sga/edx_sga/tests.py
Tests of staff-graded assignments XBlock.
Several tests perform direct StudentModule.object()
access.
src/edx-sga/edx_sga/management/commands/sga_migrate_submissions.py
Django management command that migrates existing SGA submissions for a course from old SGA implementation to newer version that uses the 'submissions' application.
Call Chain | Query | R/W? | Maps to New Query |
---|---|---|---|
| R | --- |