Warning
This is a draft. Comments are welcomed!
Updating data objects¶
Brainlife data-objects are immutable. Although you can not modify the content of the data, you can still update the metadata, tags, and description using bl data update
CLI.
1 2 3 4 |
|
To find the data object ID, please see the previous tutorials for querying data objects.
You can easily add/remove tags like so.
1 2 |
|
You can combine various update requests.
1 |
|
Some users might be more familiar with the terminology "sidecar". On BIDS, what we call "metadata" is stored in a separate .json file called "sidecar". In sidecar, you can store any number of key/values pairs associated with the actual data (dwi, fmri/bold, eeg/fif, etc). You can upload the whole sidecar information to brainlife by using -m <filepath to .json>
option like..
1 |
|
Bulk Update Tags¶
By combining with other CLIs and a bit of bash scripting, you can bulk update tags on multiple data.
Let's say you have a file with a list of subject names to update.
[S500.txt]
1 2 3 4 5 6 7 8 9 10 11 |
|
The following script will then iterate through this list and set "S500" tag on all data with matching subjects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
If you want to update tags on specific objects, you can update the bl data query
parameters (on datatype, existing tags, etc..) to be more selective of which objects to update.
Bulk Update subject names¶
Sometimes, you need to "fix" the subject naming for your project. For example, let's say you have subject names set to something like "sub-123" and you want to update this to just "123" (dropping "sub-"). You could start by querying for object from your project just like we did earlier.
1 2 |
|
Then, you can iterate over each object and use bl data update --subject
CLI to update the subject name. Since this requires a bit of coding, I will use python.
1 2 3 4 5 6 7 8 9 10 11 |
|
1 2 3 |
|
Updating sidecar/metadata¶
You can update specific sidecar/medata fields by doing something like the following.
1 2 3 4 5 6 |
|
--meta
option will read specified JSON file and update key/value specified in the append.json in this sample.
Note
At the moment, there is no way to remove an existing field. You could set it to null
value, or you will have to edit it via brainlife UI.