Conversation
…e forms, and database
…x_responses, and pausing if needed (stub/WIP); check/pause study whenever a complete response is received
…d when the study is external
…_responses input box, and clear max_responses value if checkbox is unchecked
…None: does not work in clean because django does not update a field that was not there in original POST, so it needs to be added in save method
… progress bar with other study details
…hat its optional), move to bottom of form after ppt criteria
|
Only comment is on handling the "too many respondents" cases - when we get extra people sneaking in the door, OR I guess if someone sets a max response level to under the current # of responses. Thoughts:
|
Yes, sounds great. I'll write up a draft of this in the docs so that I have a link to work with.
Agree, I'll think about it. Would a different color be too much? And/or I could update the text underneath the progress bar to "Response limit exceeded".
I wasn't planning on automatically re-starting the study - just automatically pausing. If the study is paused and then drops below the response limit because the researcher has un-validated some responses, then we could show a banner message at the top of the page (e.g. "The valid response count is below the limit for this study. Re-start the study if you want to collect more responses."). But I don't think we should automatically re-start the study for data collection without some kind of action by the researcher. In the opposite case - if the study reaches the limit because the researcher marks some previously invalid responses as valid - then this WILL automatically pause the study, with a banner message at the top of the page (e.g. "Your study has reached the valid response limit and has been paused. If you want to collect more responses, increase the limit for this study, and then re-start it."). Let me know if this sounds ok to you and if you have suggestions for wording. And we should definitely walk through these user stories to make sure everything feels clear and predictable. |
|
Oh and the two scenarios above would occur on the Individual Responses page, when the researcher is changing the valid/invalid status of any responses. But I think the exact same things should happen on the Study Edit page if the researcher changes the 'max responses' value to be higher/lower than the current valid response count. |
…response limit reached/exceeded text, add msg that study has been paused
|
@mekline I just made the following changes to this PR - can you let me know what you think?
The other things discussed above (related to automatic pausing behavior) are going in the next PR. |
…ax responses value, is active, and has reached limit; update pause trigger to make caller/user arg optional
…date or treated as changed because of None vs empty string comparison
…ause due to reaching max responses
… email if study has been automatically paused
…r sending researcher email and displaying banner message
…otherwise show a different banner message about reaching limit (no email)
…s value has changed, then check if this has been exceeded and handle (pause, banner message)
… has reached max responses, and if so, pause and email researchers
…f at max responses
…nd consent status must not be rejected
… test cases for no consent frame and rejected consent
| def valid_response_count(self) -> int: | ||
| """Return the count of valid responses for max_responses limit. | ||
|
|
||
| A response is counted as valid if: | ||
| - is_preview is False | ||
| - eligibility is "Eligible" or blank/empty (backwards compatibility) | ||
|
|
||
| And for internal studies, responses must also meet the following conditions: | ||
| - completed is True | ||
| - completed_consent_frame is True | ||
| - the consent has not been rejected (must be either pending or accepted) | ||
|
|
||
| For external studies, the completed, completed_consent_frame, and consent requirements are ignored. |
There was a problem hiding this comment.
@mekline FYI, I've updated the valid response count so that, for internal studies, the response must have a consent frame, and consent must not be rejected.
…s sonarqube issue)
…ompiled file and into scss
…g non-numeric characters
…s sonarqube issue)
…addresses sonarqube issue)" This reverts commit 8ffd76c.
Pause study when max responses limit is reached
|








Addresses part of #1829 but should not close the issue.
This PR does the following:
Changes to Study model:
max_responsesfield. Default is None.valid_response_count. For all study types, a valid response must:And for internal studies, the response must also:
has_reached_max_responses. This returnsTrueif the valid response count has reached/exceeded the limit, otherwise it returnsFalse. If the study does not have are response limit, then this returnsFalse.check_and_pause_if_at_max_responsesto the Study model, which is called when a response object is saved/updated and the response is completed.Changes to Study create/edit form - see screenshots below:
max_responsesfield to the study create/edit form. This field is disabled by default, and becomes enabled if the "Set a response limit" checkbox is checked. Default is None.Adds tests for the new Study model properties
valid_response_countandhas_reached_max_responses.To do (in separate PRs):
check_and_pause_if_at_max_responsesmethod.check_and_pause_if_at_max_responseswhen the response is first created.Screenshots for UI updates
"Set a response limit" checkbox (default: unchecked) and "Maximum responses" text box (default: none) on study create/edit pages, below the participant eligibility criteria section.
Valid response counts, response limits, and progress bars on the study details page.