Add automatic Enrollment Date intervention for new studies#462
Open
tillahoffmann wants to merge 1 commit into
Open
Conversation
Member
|
(December 18? I completely missed this when it came in) |
Member
|
Likely minor conflicts with bug fix code I'm working on on the file-processing-updates. |
Member
|
Need to think about a migration that will add the existing first registration date as a new first-registration intervention date. @hydawo we/I need to think about that in the context of the open source support. Do we need to not have that occur for our own users? |
When a new study is created, an "Enrollment Date" intervention is automatically created. When a participant first registers via the mobile app, their enrollment date is set to the current date in the study's timezone. This provides researchers with a built-in intervention date that can be used for relative scheduling of surveys without manual data entry. Key changes: - Add create_enrollment_date_intervention_for_study() and set_enrollment_date() helper functions in libs/intervention_utils.py - Call intervention creation on study creation in study_endpoints.py - Set enrollment date on first mobile registration in mobile_endpoints.py - Add tests for both study creation and mobile registration scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: hydawo <hydawo@gmail.com> Co-Authored-By: Claude <noreply@anthropic.com>
87b796a to
f9def4f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
libs/intervention_utils.pyENROLLMENT_DATE_INTERVENTION_NAMEconstant,create_enrollment_date_intervention_for_study(), andset_enrollment_date()functionsendpoints/study_endpoints.pyendpoints/mobile_endpoints.pytests/test_study_endpoints.pytests/test_mobile_endpoints.pyBehavior
Test plan
test_create_study_creates_enrollment_date_intervention- Verify intervention created on study creationtest_first_registration_sets_enrollment_date- Verify date set on first registrationtest_subsequent_registration_does_not_change_enrollment_date- Verify re-registration doesn't change datetest_registration_without_intervention_does_nothing- Verify existing studies unaffected🤖 Generated with Claude Code