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

Specify input data type for CustomParticipantAttribute instead of generating one #462

Open
Whathecode opened this issue Mar 2, 2024 · 0 comments
Labels
feature New functionality.

Comments

@Whathecode
Copy link
Member

When creating a CustomParticipantAttribute, an input data type is generated since the assumption was there is no benefit to specifying it yourself. The caller would have to guarantee uniqueness, so instead uniqueness is guaranteed by generating a GUID. In addition, it protects type namespaces.

... the Kotlin API currently doesn't allow to specify the InputDataType for CustomParticipantAttribute; it generates a unique ID in the format of dk.cachet.carp.input.custom.9004a473ce624c49bcec34a238174118. This is by design to protect the dk.cachet.carp.input namespace, but maybe is overly strict. The main goal here is to not pollute dk.cachet.carp.input with types for which support may be added later on, which would cause conflicts when comparing/handling data. E.g., if you use dk.cachet.carp.ssn now, but support gets added at with a stricter/different format. I think a suitable compromise is to allow you to set your own InputDataType, but restricting access to dk.cachet.carp sub-namespaces.

There was also an assumption knowing the type ID is irrelevant, since you wouldn't want to show it; instead, you would want to show the prompt of the matching InputElement. However, for extending study platforms which hardcode particular custom types, as opposed to them being created by the end user/researcher, setting a custom ID could help identify it in case modifications are needed, such as rendering a custom input form.

And, while the CustomParticipantAttribute doesn't allow setting a custom input data type, nothing prevents you from doing so in JSON payloads when calling CARP endpoints.

All in all, it does seem to make sense to allow users in the API to set their own input type id. In regards to protecting namespaces, consider this may be out of scope and a centralized solution may be preferred: #461.

@Whathecode Whathecode added the feature New functionality. label Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality.
Projects
None yet
Development

No branches or pull requests

1 participant