Skip to content
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

Add participantTags and add sequence block tags when navigating through the sequence #490

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

JackWilb
Copy link
Contributor

@JackWilb JackWilb commented Nov 4, 2024

Does this PR close any open issues?

Closes #474
Closes #475
Closes #485

Give a longer description of what this PR addresses and why it's needed

This pull request introduces participantTags. Participant tags exist to allow tagging whole participants based on some criteria. The initial, automatic tagging that I've added is to tag when a participant enters into a sequence block with an ID. This could be useful if there is branching logic, to quickly find participants that took path A vs path B.

The code changes are as follows:

  • Updated ParticipantData interface to include participantTags property.
  • Added methods to get, add, and remove participant tags in the storage engines.
  • Updated the ComponentController to fetch the block for the current step and add it as a participant tag automatically.
  • Modified the skip logic test to verify the correct handling of participant tags, ensuring tags are added and removed appropriately.

Provide pictures/videos of the behavior before and after these changes (optional)

Screenshot 2024-11-04 at 1 41 21 PM

Are there any additional TODOs before this PR is ready to go?

TODOs:

  • Update relevant documentation (typedoc)
  • Add the tags to the analysis table
  • Add the tags to the tidy data download

@JackWilb JackWilb marked this pull request as ready for review November 4, 2024 20:40
Copy link
Contributor

@bbollen23 bbollen23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment I made. Doesn't need to be handled right now.

participantData.participantTags = participantData.participantTags.filter((tag) => !tags.includes(tag));
await this.studyDatabase.setItem(this.currentParticipantId as string, participantData);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment for future: Is there a way to automatically wrap these functions in something that checks for participant data and study database being initialized? I'm not sure how we would go about this, but it seems tedious to have to write this over and over again. At the very least, maybe we should just create a separate function that abstracts this.

@JackWilb JackWilb merged commit 57ba35b into dev Nov 5, 2024
4 checks passed
@JackWilb JackWilb deleted the block-tagging branch November 5, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants