Skip to content

Reliability (version 5)

Bengfort requested to merge reliability-5 into main

Based on !1905 (merged)

OK, this is getting out of hand. Version 5!?

This implements the approach proposed by @hayat in !1889 (comment 20537): Once a subject is invited to a study, a separate ReliabilityEntry is created. It only has a single boolean field was_reliable. In contrast to Participation, instances of this model are never removed when the subject finishes, but only if the study or subject is deleted.

This approach behaves very similar to the one from !1889 (closed), but some important properties are more explicit (and therefore avoids implementation errors):

  • positive and negative entries are deleted under the same conditions
  • for the total number we count all studies a subject has ever been invited to, even if they were later removed

On the flip side, we now have to make sure that a ReliabilityEntry is created whenever a Participation is set to invited. I did this using the Participation.save() method, which does not cover bulk operations. AFAIK this is not relevant in this case. I also had to decide what happens if an invited Participation does not have a ReliabilityEntry. I chose to raise an exception in that case instead of trying to deal with the situation, as that would hide bugs.

Another change compared to !1889 (closed) is the handling of subjects that were reliable and dropped out of a study for other reasons. In !1889 (closed) those were counted in the total but were also deleted on study finish, breaking the "under the same conditions" rule. This is fixed in this version. But this also means that we store study association for even more subjects.

Edited by Bengfort

Merge request reports