-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions in database #946
Conversation
backend/experiment/rules/gold_msi.py
Outdated
{ | ||
"name": "MSI_F3_MUSICAL_TRAINING", | ||
"keys": QUESTION_GROUPS["MSI_F3_MUSICAL_TRAINING"], | ||
"randomize": False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These questions should be randomized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't had the chance to test this yet, but here's my two cents:
- in the interest of not bloating the
experiment
app even further, I'd be strongly in favour of moving the question logic (including thequestions
directory withinexperiment
) to its own app, which we may creatively callquestion
. I know it's a rather painful change to request (sorry), but I think it's less painful to refactor now than later. - there is no unit test for the
createquestions
command, or for any of the admin views - right now (since I've only had a superficial look really) I cannot fully understand why
questionseries_admin
and the views it calls are needed, i.e., why this is not possible in vanilla Django admin. Docstrings would be appreciated, also docstrings explaining what the different question models (Question / QuestioInSeries / QuestionInSeries / QuestionGroup) are for
backend/experiment/models.py
Outdated
class QuestionGroup(models.Model): | ||
|
||
key = models.CharField(primary_key=True, max_length=128) | ||
questions = models.ManyToManyField(Question) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand the distinction of this model vs. QuestionSeries
. Why do both have a ManyToManyField
to Question
? And why does QuestionInSeries
have a ForeignKey
to QuestionSeries
on top of that? It seems to me as if we're now defining relationships multiple ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping that people test it first, so that code is much clearer, because I think the interface is quite intuitive. QuestionGroup
is just a collection of questions for convenience to easier add to the QuestionSeries
, which belongs to Experiment
and describes the question sequence in experiment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstrings would still be a good idea.
backend/experiment/models.py
Outdated
class QuestionInSeries(models.Model): | ||
|
||
question_series = models.ForeignKey(QuestionSeries, on_delete=models.CASCADE) | ||
question = models.ForeignKey(Question, on_delete=models.CASCADE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a OneToOneField
, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OneToOneField
to a Question
? The same Question
can participate in multiple experiments, so this would require making multiple copies of the same Question
in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, of course!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the naming of the Experiment
, ExperimentCollection
and ExperimentGroup
is probably just as hard to follow for outsiders, the principles behind this are (in my mind) rather similar, so I think we'd benefit from following the same naming conventions, as much as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I started working on this, there was still ExperimentSeries
, so I tried to follow that convention. To me, "Series" is clearer because it implies ordering. But of course it can be renamed. What would you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to call this QuestionSeries
, that's fine. ExperimentCollection
will be renamed anyway, so it's not necessary to keep consistency there. But perhaps Question
-> GroupedQuestion
-> QuestionGroup
-> QuestionSeries
?
I tried running this branch but run into these migration problems: Operations to perform: |
@Evert-R Fixed, please try again |
…ootstrapped experiment
The commit messages of the changes made since the last review speak for themselves. I would just like to comment on the changes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a situation where you would want to run the bootstrap
command and not the createquestions
command, or vice versa? If the answer is "no", it would be nicer to not have to call this extra command from the docker startup, and rather include this utility in bootstrap.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! The createquestions
command looks as if it might be included in the bootstrap
command, but perhaps there's arguments against it? Does retrieval of a single question from the question series work now, or is this left for later?
Implements questions in a database.
Don't forget to backup your database before testing!
Closes #679