datahipy.bids.dataset module

Utility functions to retrieve BIDS dataset content to be indexed by the Elasticsearch engine of the HIP.

datahipy.bids.dataset.create_bids_layout(bids_dir=None, **kwargs)[source]

Create a pybids representation of a BIDS dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

kwargsdict

Dictionary of arguments key/value to pass to the pybids BIDSLayout function.

Returns

layoutpybids.BIDSLayout

Pybids representation of the BIDS dataset.

datahipy.bids.dataset.create_empty_bids_dataset(bids_dir=None, dataset_desc=None, project_dir=None)[source]

Create an empty BIDS dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

dataset_descdict

Dictionary with the content of the dataset_description.json file.

project_dirstr

Path to the project directory in which the BIDS dataset will be nested.

datahipy.bids.dataset.create_initial_bids_changes(bids_dir, content_lines=None)[source]

Create an initial CHANGES file for a BIDS dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

datahipy.bids.dataset.create_initial_bids_readme(bids_dir, dataset_desc)[source]

Create an initial README file for a BIDS dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

dataset_descdict

Dictionary with the content of the dataset_description.json file.

datahipy.bids.dataset.create_initial_participants_tsv(bids_dir)[source]

Create an initial participants.tsv file for a BIDS dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

datahipy.bids.dataset.dataset_clone(input_data, output_file)[source]

Clone a dataset from the public space of the HIP.

Parameters

input_datastr

Path to the input_data JSON file in the following format:

{
    "sourceDatasetPath": "/path/to/public/dataset",
    "targetDatasetPath": "/path/of/dataset/to/be/cloned/in/private/space",
}
output_filestr

Path to the output cloned dataset summary in JSON format to be indexed by the Data Search Engine of the HIP.

datahipy.bids.dataset.dataset_publish(input_data, output_file)[source]

Publish a dataset to the public space of the HIP.

Parameters

input_datastr

Path to the input_data JSON file in the following format:

{
    "sourceDatasetPath": "/path/to/private/or/collab/dataset",
    "targetDatasetPath": "/path/of/dataset/to/be/published/to/public/space",
}
output_filestr

Path to the output published dataset summary in JSON format to be indexed by the Data Search Engine of the HIP.

datahipy.bids.dataset.get_all_datasets_content(input_data=None, output_file=None)[source]

Return a JSON file containing a list of dataset dictionaries as response to HIP request.

Parameters

input_datastr

Path to the HIP json request.

output_filestr

Path to the output JSON file.

datahipy.bids.dataset.get_bids_layout_info(bids_dir)[source]

Return a dictionary with information retrieved via the PyBIDS BIDSLayout object representation of the dataset.

Parameters

bids_dirstr

Path to the BIDS dataset.

Returns

bids_layout_infodict

Dictionary with information retrieved via the PyBIDS BIDSLayout object representation of the dataset.

datahipy.bids.dataset.get_bidsdataset_content(bids_dir=None)[source]

Create a dictionary storing dataset information indexed by the HIP platform.

Parameters

bids_dirstr

Path to the BIDS dataset.

Returns

dataset_descdict

Dictionary storing dataset information indexed by the HIP platform.

datahipy.bids.dataset.get_dataset_size(bids_dir=None)[source]

Return the size of the BIDS dataset in megabytes.

Parameters

bids_dirstr

Path to the BIDS dataset.

Returns

total_size_megabytesstr

Size of the BIDS dataset in megabytes.