Designing the schema for storing, editing and customizing a list

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am not very experienced in db design, and have not built something like this before, where it involved creating and managing lists, so any advice is much appreciated. Performance can be tuned later on, much more concerned about maintainablity and extendsability.

I am using mongodb, and I allow teachers to create their personal educational syllabus that is made up of individual reusable modules. A teacher can in turn customize the syllabus for different students.

Option 1: Store numerical sequence in the "joint" table:

Syllabus
- has_many SyllabusModuleRecords

SyllabusModuleRecord
- belongs to Syllabus
- belongs to Module
- int Sequence

Module
- has_many SyllabusModuleRecords

s = Syllabus.new
SyllabusModuleRecord.create(:syllabus => s, :module => module1, :sequence =>1 )        
SyllabusModuleRecord.create(:syllabus => s, :module => module2 , :sequence =>2 )
.. and so on

To edit it, I pretty much s://forum.tuteehub.com/tag/need">need to reset all the sequences everytime a modification to the program is made.

Option 2: Store records with a pointer to a before and after

s = Syllabus.new
s1 = SyllabusModuleRecord.create(:syllabus => s, :module => module1, :before =>nil )        
s2 = SyllabusModuleRecord.create(:syllabus => s, :module => module2 , :before => s1 )

Option 3: Store module ids as an array inside Syllabus

Syllabus
- array of module_ids

This is obviously the simplest, but I would not be able to store program/module specific information. also, i s://forum.tuteehub.com/tag/need">need to do my own validation checks

Another consideration is that I would s://forum.tuteehub.com/tag/need">need to allow teachers to in turn customize the syllabus for students too, something like this...

Student
- has_one Syllabus
- has_many SyllabusPersonalizations

SyllabusPersonalizations
- has_one Student
- has_one Syallabus
- .... customization information...

Any help will be much appreciated!

profilepic.png
manpreet 2 years ago

Foreword: assumptions forthcoming :)

The relationship you are describing is perfect for the JSON document structure. Forget the has_manyand belongs_to for this scenario. Use JSON's ability to nest objects in a arrays. I would recommend you to quit using a ODM in the short-run while you get your head around MongoDB's expressive documents.

Add the modules as needed to a nested array on a syllabus. Then, allow the teacher to modify the content for that syllabus only. You would have something like the following for the syllabus:

{
  course_id: ObjectId(),
  modules: [
    {
      module_template_id: ObjectId(),
      name: "bla bla bla",
      description: "bla bla bla",
      due_date: "2013-09-28",
      modified_from_template: false
    },
    {
      module_template_id: ObjectId(),
      name: "bla bla",
      description: "bla bla customized",
      due_date: "2013-10-05",
      modified_from_template: true
    }
  ]
}

You would have another module_templates collection that is the parent


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.