-
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
Fixed addition of attributes when creating new user #475
Conversation
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 spot! LGTM, thanks.
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.
LGTM, thanks!
Could you please clarify if this behavior is intentional? |
@this-Aditya I think the keys should be unique since the attributes keys from MP would be unique. Did you run into an instance where this is not the case? |
To set these attributes when creating a new subject, we are using them to fetch the protocols from RADAR-aRMT-protocols. The attributes for the user are used to navigate to the correct protocol.json file. Can a user have exactly one protocol? If not, how can we use both protocol.json files (e.g., from both STAGING_PROJECT/arm/test_audio/protocol.json and STAGING_PROJECT/arm/test_health/protocol.json)? I am not entirely sure about this. Please correct any assumptions I may have wrong. |
A user will have only one active protocol, which will be used to schedule the questionnaires. The attribute key has to be unique so the correct protocol can be selected (with the attribute value). |
Okay, now I understand. |
When making a POST request to the user endpoint, the user's attributes are not saved, failing the following code from GithubProtocolFetcherStrategy to retrieve user attributes:
Map<String, String> attributes = u.getAttributes() != null ? u.getAttributes() : Map.of();
This approach is effective only when updating an existing user.
Additionally, when setting attributes as shown below:
"attributes": { "arm": "test_audio", "arm": "test_kcl", "arm": "test_health" }
Only the last key-value pair is obtained due to the internal implementation using HashMap, which allows unique keys.
If this behavior is intentional and no updates are necessary, please feel free to close this PR.