Skip to content

Importing CSV Data

dbeasley1 edited this page Jun 27, 2023 · 9 revisions

The script generates a directory /data containing .csv files for each form with the appropriate column headers required to upload bulk non-imaging data into XNAT. You can then paste your data into the csv files and upload into XNAT via the UI.

Create Subjects

If the subjects do not already exist in XNAT they will have to be created before uploading subject assessors. The headers below are required, but not all the values - Only ID and label are required, for example:

ID,group,label,src,initials
s1,,s1,,
s2,,s2,,
s3,,s3,,

IDs need to be unique across the XNAT site, while labels must be unique within a project.

Upload CSV Data for Forms

  • Log into XNAT and select Spreadsheet from the Upload menu.
  • You must select the form you wish to upload data, or select a previously used form. You may have to click on Show All.
  • Label the template - give it a recognizable name.
  • click on Submit
non-imaging_wiki_image1

On the next screen, you must select the columns corresponding to data you wish to upload. For example:

selecting columns spreadsheet

Click on all the columns that appear in the corresponding csv file template:

  • (subject-level forms) select every field up to subject_ID (as per the example above). The rest are not required.
  • (session-level forms) select every field up to the imageSession_ID. The rest are not required.
  • click on Submit at the bottom.

At the next screen, click on Browse, select your filled in csv file, and click on Upload. Select your project from the dropdown menu at the bottom of the screen.

non-imaging_wiki_image2

Subject-level forms:

For forms use the format:

ID, [data type names..], subject_ID

ID are the form label. Subject_id is the subject the form belongs to. The subject must exist beforehand.

Ensure the data types match (for example, int, boolean, string). This is especially true for Dropdown menus etc.

Session-level forms:

For forms use the format:

ID, [data type names..], imageSession_ID

ID are the form label. imageSession_ID is the session the form belongs to. The session must exist beforehand.

Ensure the data types match (for example, int, boolean, string). This is especially true for Dropdown menus etc.

Clone this wiki locally