Skip to content

add attributes API for general domains

Bengfort requested to merge api-subject-attr into main

based on !2181 (merged)

Use case: You maintain a database of blood samples. The entries in this database are connected to subjects in castellum via pseudonyms from a general domain. The database needs to track blood type for samples. Blood type is also used as a recruitment attribute in castellum. You want the recruiters to enter the blood type into castellum and then automatically sync it to the external database.

Currently, API access to attributes is only possible for study domains via the execution API. This has two issues:

  • The database operates on the level of the subject rather than the participation.
  • The database should not have to rely on study coordinators to select "blood type" as an exportable attribute in their study.

To solve these issues I added another API endpoint that is very similar to the existing one, but does not require a study context:

  • Admins can define exportable attributes for a general domain
  • An API client with access to that domain and the subjects.view_subject permission can access those exportable attributes

So far we require that both study and user have access to a general domain. This new view would allow access to a general domain without going through a study. Still this is very restrictive: it requires that admins allow the user to access the general domain and the general domain to export a specific attribute. By default, both of these are blocked.

Edited by Bengfort

Merge request reports