Designing a NoSQL Format for Quiz Creation

Introduction

For my capstone project, I’m responsible for the React webpage to create a quiz, sending the quiz into a NoSQL database for storage, and sending the quiz out to students via URL. Today I’d like to discuss how I will be formatting the NoSQL entities in order to save quizzes generated by employees.

Question Entity

First, each quiz can have as many questions as it wants. It must support the four following types of questions.

  • true/false
  • open response
  • multiple choice
  • check all that apply

In designing an entity for questions, I have one of two choices. I could either have a unique entity for each type of question, or I could have one question entity that can hold each type of question. I’ve decided to go with the single question entity. I believe this will make it easier to code and easier for my teammates to work with when they query the quiz.

Question Design

PropertyTypeNotes
idStringThe unique id of the question
typeIntCan be a value 1 – 4
1) true/false
2)multiple choice
3) check all that apply
4) free form
pointsIntNumber of possible points for the question
questionStringThe question typed out
answerVariableThis portion will vary based on the question type. For true/false it will be true or false. For check all that apply and multiple choice, it will hold an array with answer options and if this answer is correct. For free form, this will be None as the employee will have to grade this by reading the response.
selfStringThis will not be stored in the datastore but will be generated. This is the unique URL to this question entity.
Question Entity

As can be seen by this, each question type can be distinguished by the type value. The question will always be a string, and the type of response will change based on the type value. Working around this structure will make it easy for programmers to write logic for evaluating each question stored. Once the questions have been stored into datastore, then it will be possible to generate the quiz entity.

Quiz Design

PropertyTypeNotes
idStringThe unique id of the question
employeeStringThe unique id of the employee who created the quiz.
time-limitIntThe length the candidate will be able to take the quiz in minutes.
questionArrayThis will hold and array of all the questions in the quiz. These will be of the design previously mentioned.
selfStringThis will not be stored in the datastore but will be generated. This is the unique URL to this quiz entity.
Quiz Entity

Each quiz will belong to a single employee. My group has decided that once a quiz has been generated, we will not update or change the quiz. This is because once students have taken the quiz, it would be difficult to compare a quiz that has been updated with its previous version in the stats page. The question array could have two possible formats at this point. It will either have the question self URL, or it will have all the information for each question in the array to make it easier to work with. I have not decided which format yet.

Conclusion

Using this simple design, I will be able to save each quiz in the google cloud datastore. This design will also make it easy for my teammate who has to retrieve this information to create the actual quiz page. We have included this design in our project plan so we know how the data will be formatted.

Print Friendly, PDF & Email

Leave a comment

Your email address will not be published. Required fields are marked *