home api list

Hexostore API Documentation

csvstudysubjects

/api/csvstudysubjects/

List methods: post

Detail methods: options, post, patch

Allow to import many subjects for a study at once using a CSV file.

Example usage

Header of the CSV file

The first line of the CSV file should be the header of the columns. Those columns are obligatory when creating new subjects. When updating existing subjects with a patch, the password column should not be there.

Column Description
Group The study group the user will be part of
ID The unique identifier of the user. Could be a string of anything.
Password The password of the user. Must be strong enough or else the server will reject it.

The following columns are optional but can be included in the CSV file to modify or set those properties in the subject.

Column Description
Sex Sex of the subject
Date of birth date of birth of the subject
Height Height of the subject in meters
Height(ft) Feet part of the height of the subject when using the imperial system
Height(in) Inches part of the height of the subject when using the imperial system
Weight Weight of the subject
Start date Start date
Status Subject status

It is possible to specify the height and weight of the subject using imperial units. In order to do so, the resource should be called that way: /api/csvstudysubjects/<study_id>/?unit_system=imperial. When using the imperial system, Height(ft) and Height(in) must be used when specifying the height of the subjects.

Content of the CSV file

Here is an example of a CSV file that could be imported into the system. We assume that a study exists and that study contains groups named "Group 1" and "Group 2" and those subject ids are unique and doesn't exist yet:

Group ID Password
Group 1 Subject #1 77T@C*2dqRVT
Group 1 Subject #2 d%X9S8o2ShQi
Group 1 Subject #3 kL26$BIOd3lE
Group 2 Subject #4 Q%h1TqenL4Ka

And the content of the file would look like this:

Group,ID,Password
"Group 1","Subject #1","77T@C*2dqRVT"
"Group 1","Subject #2","d%X9S8o2ShQi"
"Group 1","Subject #3","kL26$BIOd3lE"
"Group 2","Subject #4","Q%h1TqenL4Ka"

Calling the API

Now that our file is ready, we can submit it to the server. To do so we must be authenticated and make a call to /api/csvstudysubjects/. The Content-Type of the http header must be test/csv and the file is submitted as an attachment. If all goes well, the subjects will be inserted in the database. If there is a problem in the CSV file, for example a subject doesn't have a password strong enough, the entirety of the file will be rejected. Which means that all subjects will be inserted or none of them will.

Fields

study_subjects: ListSerializer

This field will default to: '' (empty string)

Filtering Options

No filtering supported

Sorting Options

No sorting supported

© 2024 by CarrĂ© Technologies Inc.