RPC API example with the LEMON dataset

This example illustrates the use of sovabids on the LEMON dataset using the RPC API.

Warning

To run this example, you need to install sovabids in ‘advanced-usage’ mode ( see here ).

Sovabids uses an action-oriented API. Here we will illustrate each of the available functionalities.

Imports

First we import some functions we will need:

import os # For path manipulation
import shutil # File manipulation
from mne_bids import print_dir_tree # To show the input/output directories structures inside this example
from sovabids.datasets import lemon_prepare # Download the dataset
from sovabids.settings import REPO_PATH
from sovabids.sovarpc import app as sovapp # The RPC API application
import sovabids.sovarpc as sovarpc
from fastapi.testclient import TestClient # This will be for simulating ourselves as a client of the RPC API
import json # for making json-based requests
import copy # just to make deep copies of variables

Getting and preparing the dataset

We have to download and decompress the dataset. We also need to fix a filename inconsistency (without this correction the file won’t be able to be opened in mne). Luckily all of that is encapsulated in the lemon_prepare function since these issues are not properly of sovabids.

By default the files are saved in the ‘_data’ directory of the sovabids project.

Out:

Downloading sub-032301.tar.gz at /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon
WARNING: File already existed. Skipping...
Downloading sub-032302.tar.gz at /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon
WARNING: File already existed. Skipping...
Downloading sub-032303.tar.gz at /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon
WARNING: File already existed. Skipping...
Downloading name_match.csv at /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon
WARNING: File already existed. Skipping...

Setting up the paths

Now we will set up four paths. Because this example is intended to run relative to the repository directory we use relative path but for real use-cases it is easier to just input the absolute-path. We will print these paths for more clarity.

source_path = os.path.abspath(os.path.join(REPO_PATH,'_data','lemon')) # For the input data we will convert
bids_path= os.path.abspath(os.path.join(REPO_PATH,'_data','lemon_bids_rpc')) # The output directory that will have the converted data
rules_path = os.path.abspath(os.path.join(REPO_PATH,'examples','lemon_example_rules.yml')) # The rules file that setups the rule for conversion
mapping_path = os.path.abspath(os.path.join(bids_path,'code','sovabids','mappings.yml')) # The mapping file that will hold the results of applying the rules to each file

print('source_path:',source_path.replace(REPO_PATH,''))
print('bids_path:', bids_path.replace(REPO_PATH,''))
print('rules_path:',rules_path.replace(REPO_PATH,''))
print('mapping_path:',mapping_path.replace(REPO_PATH,''))

Out:

source_path: /_data/lemon
bids_path: /_data/lemon_bids_rpc
rules_path: /examples/lemon_example_rules.yml
mapping_path: /_data/lemon_bids_rpc/code/sovabids/mappings.yml

Cleaning the output directory

We will clean the output path as a safety measure from previous conversions.

try:
    shutil.rmtree(bids_path)
except:
    pass

The input directory

For clarity purposes we will print here the directory we are trying to convert to BIDS.

print_dir_tree(source_path)

Out:

|lemon/
|--- name_match.csv
|--- sub-032301.tar.gz
|--- sub-032302.tar.gz
|--- sub-032303.tar.gz
|--- sub-010002/
|------ RSEEG/
|--------- sub-010002.eeg
|--------- sub-010002.vhdr
|--------- sub-010002.vmrk
|--- sub-010003/
|------ RSEEG/
|--------- sub-010003.eeg
|--------- sub-010003.vhdr
|--------- sub-010003.vmrk
|--- sub-010004/
|------ RSEEG/
|--------- sub-010004.eeg
|--------- sub-010004.vhdr
|--------- sub-010004.vmrk

RPC API

Simulating ourselves as clients

We will use the TestClient class to send requests to the API (the sovapp variable)

client = TestClient(sovapp)

The general request

We will define a function to make a request to the API given the name of the method and its parameters as a dictionary

def make_request(method,params):
    print('Method:',method)
    print('');print('');
    print('Parameters:')
    print(json.dumps(params, indent=4))
    print('');print('');
    # We create the complete request
    request= {
    "jsonrpc": "2.0",
    "id": 0,
    "method": method,
    "params": params}
    print('Request:')
    print(json.dumps(request, indent=4))
    print('');print('');
   # json dumps is important to avoid parsing errors in the API request
    request = json.dumps(request)

    # Send the request
    request_url = "/api/sovabids/" +method
    print('Request URL:')
    print(request_url)
    print('');print('');
    response = client.post(request_url,data=request ) # POST request as common in RPC-based APIs

    # Get the answer
    result = json.loads(response.content.decode())['result']
    print('Answer:')
    print(json.dumps(result, indent=4))
    print('');print('');
    return result

load_rules

For loading a yaml rules file. Lets see the docstring of this method

print(sovarpc.load_rules.__doc__)

Out:

Load rules from a path.

    Parameters
    ----------

    rules_path : str
        The path to the rules file.

    Returns
    -------

    dict
        The rules dictionary.

    Notes
    -----
    A wrapper of around rules.load_rules function.

    See docstring of :py:func:`load_rules() <rules.load_rules>` in :py:mod:`rules`

Lets define the request

method = 'load_rules' # Just a variable for the method name

params = {                  # Parameters of the method
"rules_path": rules_path
    }

And proceed with it

result = make_request(method,params)

rules = copy.deepcopy(result)

Out:

Method: load_rules


Parameters:
{
    "rules_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/examples/lemon_example_rules.yml"
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "load_rules",
    "params": {
        "rules_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/examples/lemon_example_rules.yml"
    }
}


Request URL:
/api/sovabids/load_rules


Answer:
{
    "entities": {
        "task": "resting"
    },
    "dataset_description": {
        "Name": "Lemon",
        "Authors": [
            "Anahit Babayan",
            "Miray Erbey",
            "Deniz Kumral",
            "Janis D. Reinelt",
            "Andrea M. F. Reiter",
            "Josefin R\u00f6bbig",
            "H. Lina Schaare",
            "Marie Uhlig",
            "Alfred Anwander",
            "Pierre-Louis Bazin",
            "Annette Horstmann",
            "Leonie Lampe",
            "Vadim V. Nikulin",
            "Hadas Okon-Singer",
            "Sven Preusser",
            "Andr\u00e9 Pampel",
            "Christiane S. Rohr",
            "Julia Sacher1",
            "Angelika Th\u00f6ne-Otto",
            "Sabrina Trapp",
            "Till Nierhaus",
            "Denise Altmann",
            "Katrin Arelin",
            "Maria Bl\u00f6chl",
            "Edith Bongartz",
            "Patric Breig",
            "Elena Cesnaite",
            "Sufang Chen",
            "Roberto Cozatl",
            "Saskia Czerwonatis",
            "Gabriele Dambrauskaite",
            "Maria Dreyer",
            "Jessica Enders",
            "Melina Engelhardt",
            "Marie Michele Fischer",
            "Norman Forschack",
            "Johannes Golchert",
            "Laura Golz",
            "C. Alexandrina Guran",
            "Susanna Hedrich",
            "Nicole Hentschel",
            "Daria I. Hoffmann",
            "Julia M. Huntenburg",
            "Rebecca Jost",
            "Anna Kosatschek",
            "Stella Kunzendorf",
            "Hannah Lammers",
            "Mark E. Lauckner",
            "Keyvan Mahjoory",
            "Natacha Mendes",
            "Ramona Menger",
            "Enzo Morino",
            "Karina N\u00e4the",
            "Jennifer Neubauer",
            "Handan Noyan",
            "Sabine Oligschl\u00e4ger",
            "Patricia Panczyszyn-Trzewik",
            "Dorothee Poehlchen",
            "Nadine Putzke",
            "Sabrina Roski",
            "Marie-Catherine Schaller",
            "Anja Schieferbein",
            "Benito Schlaak",
            "Hanna Maria Schmidt",
            "Robert Schmidt",
            "Anne Schrimpf",
            "Sylvia Stasch",
            "Maria Voss",
            "Anett Wiedemann",
            "Daniel S. Margulies",
            "Michael Gaebler",
            "Arno Villringer"
        ]
    },
    "sidecar": {
        "PowerLineFrequency": 50,
        "EEGReference": "FCz"
    },
    "channels": {
        "type": {
            "VEOG": "VEOG",
            "F3": "EEG"
        }
    },
    "non-bids": {
        "eeg_extension": ".vhdr",
        "path_analysis": {
            "pattern": "RSEEG/sub-%entities.subject%.vhdr"
        }
    }
}

save_rules

We can for example use it as a way to save a backup of the already-existing rules file. Lets see the docstring of this method

print(sovarpc.save_rules.__doc__)

Out:

Save rules as a yaml file to a path.

    Parameters
    ----------
    rules: dict
        The rules dictionary to save
    path : str
        The full-path (including filename) where to save the rules as yaml.

    Returns
    -------

    None

    Notes
    -----

    A wrapper of around files._write_yaml function.

    See docstring of :py:func:`_write_yaml() <files._write_yaml>` in :py:mod:`files`

Lets define the request

method = "save_rules" # Just a variable for the method name

params = {                  # Parameters of the method
    "rules": rules,
    "path": mapping_path.replace('mappings','rules')+'.bkp' # We will do it as if we were saving a backup of the rules
                              # Since the rules file already exists
    }

And proceed with it

result = make_request(method,params)

Out:

Method: save_rules


Parameters:
{
    "rules": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        }
    },
    "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/rules.yml.bkp"
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "save_rules",
    "params": {
        "rules": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            }
        },
        "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/rules.yml.bkp"
    }
}


Request URL:
/api/sovabids/save_rules


Answer:
null

get_files

Useful for getting the files on a directory. Lets see the docstring of this method

print(sovarpc.get_files.__doc__)

Out:

Recursively scan the directory for valid files, returning a list with the full-paths to each.

    The valid files are given by the 'non-bids.eeg_extension' rule. See the "Rules File Schema".

    Parameters
    ----------

    path : str
        The path we want to obtain the files from.
    rules : dict
        The rules dictionary.

    Returns
    -------

    list[str]:
        A list containing the path to each valid file in the source_path.


    Notes
    -----

    A wrapper of around rules.get_files function.

    See docstring of :py:func:`get_files() <rules.get_files>` in :py:mod:`rules`

Note

get_files uses the rules because of the non-bids.eeg_extension configuration.

Lets define the request

method = "get_files" # Just a variable for the method name

params = {                  # Parameters of the method
            "rules": rules,
            "path": source_path
    }

And proceed with it

result = make_request(method,params)

filelist = copy.deepcopy(result)

Out:

Method: get_files


Parameters:
{
    "rules": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        }
    },
    "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon"
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "get_files",
    "params": {
        "rules": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            }
        },
        "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon"
    }
}


Request URL:
/api/sovabids/get_files


Answer:
[
    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
]

apply_rules_to_single_file

We can use this to get a mapping for a single mapping and for previewing the bids files that would be written. Lets see the docstring of this method

print(sovarpc.apply_rules_to_single_file.__doc__)

Out:

Apply rules to a single file.

    Parameters
    ----------

    file : str
        Path to the file.
    rules : dict
        The rules dictionary.
    bids_path : str
        Path to the bids directory
    write : bool, optional
        Whether to write the converted files to disk or not.
    preview : bool, optional
        Whether to return a dictionary with a "preview" of the conversion.
        This dict will have the same schema as the "Mapping File Schema" but may have flat versions of its fields.
        *UNDER CONSTRUCTION*

    Returns
    -------

    dict:
        {
        mapping : dict
            The mapping obtained from applying the rules to the given file
        preview : bool|dict
            If preview = False, then False. If True, then the preview dictionary.
        }

    Notes
    -----
    A wrapper of around rules.apply_rules_to_single_file function.

    See docstring of :py:func:`apply_rules_to_single_file() <rules.apply_rules_to_single_file>` in :py:mod:`rules`

Lets define the request

method = "apply_rules_to_single_file" # Just a variable for the method name

params = {                  # Parameters of the method
        "file": filelist[0],
        "bids_path": bids_path+'.preview',
        "rules": rules,
        "write":False,
        "preview":True
    }

And proceed with it

result = make_request(method,params)

Out:

Method: apply_rules_to_single_file


Parameters:
{
    "file": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
    "bids_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc.preview",
    "rules": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        }
    },
    "write": false,
    "preview": true
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "apply_rules_to_single_file",
    "params": {
        "file": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
        "bids_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc.preview",
        "rules": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            }
        },
        "write": false,
        "preview": true
    }
}


Request URL:
/api/sovabids/apply_rules_to_single_file


Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr...
Setting channel info structure...
/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/sovabids/rules.py:253: RuntimeWarning: Encountered data in "short" format. Converting to float32.
  write_raw_bids(raw, bids_path=bids_path,overwrite=True,format='BrainVision',allow_preload=True,verbose=False)
Answer:
{
    "mapping": {
        "entities": {
            "task": "resting",
            "subject": "010004"
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "IO": {
            "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc.preview/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
            "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
        }
    },
    "preview": {
        "IO": {
            "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc.preview/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
            "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
        },
        "entities": {
            "task": "resting",
            "subject": "010004"
        },
        "dataset_description": "{    \"Name\": \"Lemon\",    \"BIDSVersion\": \"1.6.0\",    \"DatasetType\": \"raw\",    \"Authors\": [        \"Anahit Babayan\",        \"Miray Erbey\",        \"Deniz Kumral\",        \"Janis D. Reinelt\",        \"Andrea M. F. Reiter\",        \"Josefin R\\u00f6bbig\",        \"H. Lina Schaare\",        \"Marie Uhlig\",        \"Alfred Anwander\",        \"Pierre-Louis Bazin\",        \"Annette Horstmann\",        \"Leonie Lampe\",        \"Vadim V. Nikulin\",        \"Hadas Okon-Singer\",        \"Sven Preusser\",        \"Andr\\u00e9 Pampel\",        \"Christiane S. Rohr\",        \"Julia Sacher1\",        \"Angelika Th\\u00f6ne-Otto\",        \"Sabrina Trapp\",        \"Till Nierhaus\",        \"Denise Altmann\",        \"Katrin Arelin\",        \"Maria Bl\\u00f6chl\",        \"Edith Bongartz\",        \"Patric Breig\",        \"Elena Cesnaite\",        \"Sufang Chen\",        \"Roberto Cozatl\",        \"Saskia Czerwonatis\",        \"Gabriele Dambrauskaite\",        \"Maria Dreyer\",        \"Jessica Enders\",        \"Melina Engelhardt\",        \"Marie Michele Fischer\",        \"Norman Forschack\",        \"Johannes Golchert\",        \"Laura Golz\",        \"C. Alexandrina Guran\",        \"Susanna Hedrich\",        \"Nicole Hentschel\",        \"Daria I. Hoffmann\",        \"Julia M. Huntenburg\",        \"Rebecca Jost\",        \"Anna Kosatschek\",        \"Stella Kunzendorf\",        \"Hannah Lammers\",        \"Mark E. Lauckner\",        \"Keyvan Mahjoory\",        \"Natacha Mendes\",        \"Ramona Menger\",        \"Enzo Morino\",        \"Karina N\\u00e4the\",        \"Jennifer Neubauer\",        \"Handan Noyan\",        \"Sabine Oligschl\\u00e4ger\",        \"Patricia Panczyszyn-Trzewik\",        \"Dorothee Poehlchen\",        \"Nadine Putzke\",        \"Sabrina Roski\",        \"Marie-Catherine Schaller\",        \"Anja Schieferbein\",        \"Benito Schlaak\",        \"Hanna Maria Schmidt\",        \"Robert Schmidt\",        \"Anne Schrimpf\",        \"Sylvia Stasch\",        \"Maria Voss\",        \"Anett Wiedemann\",        \"Daniel S. Margulies\",        \"Michael Gaebler\",        \"Arno Villringer\"    ]}",
        "sidecar": "{    \"TaskName\": \"resting\",    \"Manufacturer\": \"BrainProducts\",    \"PowerLineFrequency\": 50,    \"SamplingFrequency\": 2500.0,    \"SoftwareFilters\": \"n/a\",    \"RecordingDuration\": 1022.0396,    \"RecordingType\": \"continuous\",    \"EEGReference\": \"FCz\",    \"EEGGround\": \"n/a\",    \"EEGPlacementScheme\": \"based on the extended 10/20 system\"}",
        "channels": {
            "name": "Fp1,Fp2,F7,F3,Fz,F4,F8,FC5,FC1,FC2,FC6,T7,C3,Cz,C4,T8,VEOG,CP5,CP1,CP2,CP6,AFz,P7,P3,Pz,P4,P8,PO9,O1,Oz,O2,PO10,AF7,AF3,AF4,AF8,F5,F1,F2,F6,FT7,FC3,FC4,FT8,C5,C1,C2,C6,TP7,CP3,CPz,CP4,TP8,P5,P1,P2,P6,PO7,PO3,POz,PO4,PO8",
            "type": "EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,VEOG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG,EEG",
            "units": "\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V,\u00b5V",
            "low_cutoff": "0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534,0.015915494309189534",
            "high_cutoff": "1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0,1000.0",
            "description": "ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroOculoGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram,ElectroEncephaloGram",
            "sampling_frequency": "2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0,2500.0",
            "status": "good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good,good",
            "status_description": "n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a"
        }
    }
}

apply_rules

We can use this to get the mappings for all the files in a list of them. Lets see the docstring of this method

print(sovarpc.apply_rules.__doc__)

Out:

Apply rules to a set of files.

    Parameters
    ----------

    file_list : list of str
        List of str with the paths of the files we want to convert (ie the output of get_files).
    bids_path : str
        The path we want the converted files in.
    rules : dict
        A dictionary with the rules.
    mapping_path : str, optional
        The fullpath where we want to write the mappings file.
        If '', then bids_path/code/sovabids/mappings.yml will be used.

    Returns
    -------

    dict :
        A dictionary following: {
                                    'General': rules given,
                                    'Individual':list of mapping dictionaries for each file
                                }


    Notes
    -----
    A wrapper of around rules.apply_rules function.
    See docstring of :py:func:`apply_rules() <rules.apply_rules>` in :py:mod:`rules`

Lets define the request

method = "apply_rules" # Just a variable for the method name

params = {                  # Parameters of the method
        "file_list": filelist,
        "bids_path": bids_path,
        "rules": rules,
        "mapping_path":mapping_path
    }

And proceed with it

result = make_request(method,params)

file_mappings=copy.deepcopy(result)

Out:

Method: apply_rules


Parameters:
{
    "file_list": [
        "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
        "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
        "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
    ],
    "bids_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc",
    "rules": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        }
    },
    "mapping_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/mappings.yml"
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "apply_rules",
    "params": {
        "file_list": [
            "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
            "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
            "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
        ],
        "bids_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc",
        "rules": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            }
        },
        "mapping_path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/mappings.yml"
    }
}


Request URL:
/api/sovabids/apply_rules


Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr...
Setting channel info structure...
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr...
Setting channel info structure...
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr...
Setting channel info structure...
Answer:
{
    "General": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        },
        "IO": {
            "source": [
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            ],
            "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc"
        }
    },
    "Individual": [
        {
            "entities": {
                "task": "resting",
                "subject": "010004"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010003"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010002"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            }
        }
    ]
}

save_mappings

We can use this to save a backup of the mappings. Lets see the docstring of this method

print(sovarpc.save_mappings.__doc__)

Out:

Save mappings as a yaml file to a path.

    Parameters
    ----------

    path : str
        The full-path (including filename) where to save the mappings as yaml.
    general: dict
        The general rules dictionary.
    individual: list of dict
        A list containing the mapping dictionary of each file.

    Returns
    -------

    None

    Notes
    -----

    A wrapper of around files._write_yaml function.

    See docstring of :py:func:`_write_yaml() <files._write_yaml>` in :py:mod:`files`

Lets define the request

method = "save_mappings" # Just a variable for the method name

params = {                  # Parameters of the method
    "general": file_mappings['General'],
    "individual":file_mappings['Individual'],
    "path": mapping_path+'.bkp'
    }

And proceed with it

result = make_request(method,params)

Out:

Method: save_mappings


Parameters:
{
    "general": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        },
        "IO": {
            "source": [
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            ],
            "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc"
        }
    },
    "individual": [
        {
            "entities": {
                "task": "resting",
                "subject": "010004"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010003"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010002"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            }
        }
    ],
    "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/mappings.yml.bkp"
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "save_mappings",
    "params": {
        "general": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "IO": {
                "source": [
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
                ],
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc"
            }
        },
        "individual": [
            {
                "entities": {
                    "task": "resting",
                    "subject": "010004"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
                }
            },
            {
                "entities": {
                    "task": "resting",
                    "subject": "010003"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr"
                }
            },
            {
                "entities": {
                    "task": "resting",
                    "subject": "010002"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
                }
            }
        ],
        "path": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/code/sovabids/mappings.yml.bkp"
    }
}


Request URL:
/api/sovabids/save_mappings


Answer:
null

convert_them

We can use this to perform the conversion given the mappings. Lets see the docstring of this method

print(sovarpc.convert_them.__doc__)

Out:

Convert eeg files to bids according to the mappings given.

    Parameters
    ----------
    general : dict
        The general rules
    individual:  list[dict]
        List with the individual mappings of each file.

    Notes
    -----
    A wrapper of around convert.convert_them function.

    See docstring of :py:func:`convert_them() <convert.convert_them>` in :py:mod:`convert`

    Returns
    -------
    None

Lets define the request

method = "convert_them" # Just a variable for the method name

params = {                  # Parameters of the method
    "general": file_mappings['General'],
    "individual":file_mappings['Individual']
    }

And proceed with it

result = make_request(method,params)

Out:

Method: convert_them


Parameters:
{
    "general": {
        "entities": {
            "task": "resting"
        },
        "dataset_description": {
            "Name": "Lemon",
            "Authors": [
                "Anahit Babayan",
                "Miray Erbey",
                "Deniz Kumral",
                "Janis D. Reinelt",
                "Andrea M. F. Reiter",
                "Josefin R\u00f6bbig",
                "H. Lina Schaare",
                "Marie Uhlig",
                "Alfred Anwander",
                "Pierre-Louis Bazin",
                "Annette Horstmann",
                "Leonie Lampe",
                "Vadim V. Nikulin",
                "Hadas Okon-Singer",
                "Sven Preusser",
                "Andr\u00e9 Pampel",
                "Christiane S. Rohr",
                "Julia Sacher1",
                "Angelika Th\u00f6ne-Otto",
                "Sabrina Trapp",
                "Till Nierhaus",
                "Denise Altmann",
                "Katrin Arelin",
                "Maria Bl\u00f6chl",
                "Edith Bongartz",
                "Patric Breig",
                "Elena Cesnaite",
                "Sufang Chen",
                "Roberto Cozatl",
                "Saskia Czerwonatis",
                "Gabriele Dambrauskaite",
                "Maria Dreyer",
                "Jessica Enders",
                "Melina Engelhardt",
                "Marie Michele Fischer",
                "Norman Forschack",
                "Johannes Golchert",
                "Laura Golz",
                "C. Alexandrina Guran",
                "Susanna Hedrich",
                "Nicole Hentschel",
                "Daria I. Hoffmann",
                "Julia M. Huntenburg",
                "Rebecca Jost",
                "Anna Kosatschek",
                "Stella Kunzendorf",
                "Hannah Lammers",
                "Mark E. Lauckner",
                "Keyvan Mahjoory",
                "Natacha Mendes",
                "Ramona Menger",
                "Enzo Morino",
                "Karina N\u00e4the",
                "Jennifer Neubauer",
                "Handan Noyan",
                "Sabine Oligschl\u00e4ger",
                "Patricia Panczyszyn-Trzewik",
                "Dorothee Poehlchen",
                "Nadine Putzke",
                "Sabrina Roski",
                "Marie-Catherine Schaller",
                "Anja Schieferbein",
                "Benito Schlaak",
                "Hanna Maria Schmidt",
                "Robert Schmidt",
                "Anne Schrimpf",
                "Sylvia Stasch",
                "Maria Voss",
                "Anett Wiedemann",
                "Daniel S. Margulies",
                "Michael Gaebler",
                "Arno Villringer"
            ]
        },
        "sidecar": {
            "PowerLineFrequency": 50,
            "EEGReference": "FCz"
        },
        "channels": {
            "type": {
                "VEOG": "VEOG",
                "F3": "EEG"
            }
        },
        "non-bids": {
            "eeg_extension": ".vhdr",
            "path_analysis": {
                "pattern": "RSEEG/sub-%entities.subject%.vhdr"
            }
        },
        "IO": {
            "source": [
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
                "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            ],
            "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc"
        }
    },
    "individual": [
        {
            "entities": {
                "task": "resting",
                "subject": "010004"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010003"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr"
            }
        },
        {
            "entities": {
                "task": "resting",
                "subject": "010002"
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "IO": {
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.vhdr",
                "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
            }
        }
    ]
}


Request:
{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "convert_them",
    "params": {
        "general": {
            "entities": {
                "task": "resting"
            },
            "dataset_description": {
                "Name": "Lemon",
                "Authors": [
                    "Anahit Babayan",
                    "Miray Erbey",
                    "Deniz Kumral",
                    "Janis D. Reinelt",
                    "Andrea M. F. Reiter",
                    "Josefin R\u00f6bbig",
                    "H. Lina Schaare",
                    "Marie Uhlig",
                    "Alfred Anwander",
                    "Pierre-Louis Bazin",
                    "Annette Horstmann",
                    "Leonie Lampe",
                    "Vadim V. Nikulin",
                    "Hadas Okon-Singer",
                    "Sven Preusser",
                    "Andr\u00e9 Pampel",
                    "Christiane S. Rohr",
                    "Julia Sacher1",
                    "Angelika Th\u00f6ne-Otto",
                    "Sabrina Trapp",
                    "Till Nierhaus",
                    "Denise Altmann",
                    "Katrin Arelin",
                    "Maria Bl\u00f6chl",
                    "Edith Bongartz",
                    "Patric Breig",
                    "Elena Cesnaite",
                    "Sufang Chen",
                    "Roberto Cozatl",
                    "Saskia Czerwonatis",
                    "Gabriele Dambrauskaite",
                    "Maria Dreyer",
                    "Jessica Enders",
                    "Melina Engelhardt",
                    "Marie Michele Fischer",
                    "Norman Forschack",
                    "Johannes Golchert",
                    "Laura Golz",
                    "C. Alexandrina Guran",
                    "Susanna Hedrich",
                    "Nicole Hentschel",
                    "Daria I. Hoffmann",
                    "Julia M. Huntenburg",
                    "Rebecca Jost",
                    "Anna Kosatschek",
                    "Stella Kunzendorf",
                    "Hannah Lammers",
                    "Mark E. Lauckner",
                    "Keyvan Mahjoory",
                    "Natacha Mendes",
                    "Ramona Menger",
                    "Enzo Morino",
                    "Karina N\u00e4the",
                    "Jennifer Neubauer",
                    "Handan Noyan",
                    "Sabine Oligschl\u00e4ger",
                    "Patricia Panczyszyn-Trzewik",
                    "Dorothee Poehlchen",
                    "Nadine Putzke",
                    "Sabrina Roski",
                    "Marie-Catherine Schaller",
                    "Anja Schieferbein",
                    "Benito Schlaak",
                    "Hanna Maria Schmidt",
                    "Robert Schmidt",
                    "Anne Schrimpf",
                    "Sylvia Stasch",
                    "Maria Voss",
                    "Anett Wiedemann",
                    "Daniel S. Margulies",
                    "Michael Gaebler",
                    "Arno Villringer"
                ]
            },
            "sidecar": {
                "PowerLineFrequency": 50,
                "EEGReference": "FCz"
            },
            "channels": {
                "type": {
                    "VEOG": "VEOG",
                    "F3": "EEG"
                }
            },
            "non-bids": {
                "eeg_extension": ".vhdr",
                "path_analysis": {
                    "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                }
            },
            "IO": {
                "source": [
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr",
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr",
                    "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
                ],
                "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc"
            }
        },
        "individual": [
            {
                "entities": {
                    "task": "resting",
                    "subject": "010004"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr"
                }
            },
            {
                "entities": {
                    "task": "resting",
                    "subject": "010003"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr"
                }
            },
            {
                "entities": {
                    "task": "resting",
                    "subject": "010002"
                },
                "non-bids": {
                    "eeg_extension": ".vhdr",
                    "path_analysis": {
                        "pattern": "RSEEG/sub-%entities.subject%.vhdr"
                    }
                },
                "channels": {
                    "type": {
                        "VEOG": "VEOG",
                        "F3": "EEG"
                    }
                },
                "sidecar": {
                    "PowerLineFrequency": 50,
                    "EEGReference": "FCz"
                },
                "IO": {
                    "target": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.vhdr",
                    "source": "/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr"
                }
            }
        ]
    }
}


Request URL:
/api/sovabids/convert_them


Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr...
Setting channel info structure...
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010004/RSEEG/sub-010004.vhdr...
Setting channel info structure...

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/README'...

References
----------
Appelhoff, S., Sanderson, M., Brooks, T., Vliet, M., Quentin, R., Holdgraf, C., Chaumon, M., Mikulan, E., Tavabi, K., Höchenberger, R., Welke, D., Brunner, C., Rockhill, A., Larson, E., Gramfort, A. and Jas, M. (2019). MNE-BIDS: Organizing electrophysiological data into the BIDS format and facilitating their analysis. Journal of Open Source Software 4: (1896). https://doi.org/10.21105/joss.01896

Pernet, C. R., Appelhoff, S., Gorgolewski, K. J., Flandin, G., Phillips, C., Delorme, A., Oostenveld, R. (2019). EEG-BIDS, an extension to the brain imaging data structure for electroencephalography. Scientific Data, 6, 103. https://doi.org/10.1038/s41597-019-0104-8


Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.tsv'...

participant_id  age     sex     hand
sub-010004      n/a     n/a     n/a

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.json'...

{
    "participant_id": {
        "Description": "Unique participant identifier"
    },
    "age": {
        "Description": "Age of the participant at time of testing",
        "Units": "years"
    },
    "sex": {
        "Description": "Biological sex of the participant",
        "Levels": {
            "F": "female",
            "M": "male"
        }
    },
    "hand": {
        "Description": "Handedness of the participant",
        "Levels": {
            "R": "right",
            "L": "left",
            "A": "ambidextrous"
        }
    }
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_events.tsv'...

onset   duration        trial_type      value   sample
0.0     0.0004  New Segment/    2       0
0.0     0.0004  Comment/actiCAP Data On 1       0
7.1968  0.0004  Stimulus/S  1   3       17992
10.3628 0.0004  Stimulus/S  1   3       25907
10.372  0.0004  Stimulus/S210   5       25930

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/dataset_description.json'...

{
    "Name": " ",
    "BIDSVersion": "1.6.0",
    "DatasetType": "raw",
    "Authors": [
        "[Unspecified]"
    ]
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_eeg.json'...

{
    "TaskName": "resting",
    "Manufacturer": "BrainProducts",
    "PowerLineFrequency": 50,
    "SamplingFrequency": 2500.0,
    "SoftwareFilters": "n/a",
    "RecordingDuration": 1022.0396,
    "RecordingType": "continuous",
    "EEGReference": "n/a",
    "EEGGround": "n/a",
    "EEGPlacementScheme": "based on the extended 10/20 system",
    "EEGChannelCount": 61,
    "EOGChannelCount": 1,
    "ECGChannelCount": 0,
    "EMGChannelCount": 0,
    "MiscChannelCount": 0,
    "TriggerChannelCount": 0
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/eeg/sub-010004_task-resting_channels.tsv'...

name    type    units   low_cutoff      high_cutoff     description     sampling_frequency      status  status_description
Fp1     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fp2     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F7      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F3      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fz      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Copying data files to sub-010004_task-resting_eeg.vhdr

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/sub-010004_scans.tsv'...

filename        acq_time
eeg/sub-010004_task-resting_eeg.vhdr    2013-11-15T13:54:17.255858Z
Wrote /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010004/sub-010004_scans.tsv entry with eeg/sub-010004_task-resting_eeg.vhdr.
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr...
Setting channel info structure...
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010003/RSEEG/sub-010003.vhdr...
Setting channel info structure...

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.tsv'...

participant_id  age     sex     hand
sub-010003      n/a     n/a     n/a
sub-010004      n/a     n/a     n/a

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.json'...

{
    "participant_id": {
        "Description": "Unique participant identifier"
    },
    "age": {
        "Description": "Age of the participant at time of testing",
        "Units": "years"
    },
    "sex": {
        "Description": "Biological sex of the participant",
        "Levels": {
            "F": "female",
            "M": "male"
        }
    },
    "hand": {
        "Description": "Handedness of the participant",
        "Levels": {
            "R": "right",
            "L": "left",
            "A": "ambidextrous"
        }
    }
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_events.tsv'...

onset   duration        trial_type      value   sample
0.0     0.0004  New Segment/    2       0
0.0     0.0004  Comment/no USB Connection to actiCAP    1       0
10.0988 0.0004  Stimulus/S  1   3       25247
13.0396 0.0004  Stimulus/S  1   3       32599
13.0488 0.0004  Stimulus/S210   5       32622

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/dataset_description.json'...

{
    "Name": " ",
    "BIDSVersion": "1.6.0",
    "DatasetType": "raw",
    "Authors": [
        "[Unspecified]"
    ]
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_eeg.json'...

{
    "TaskName": "resting",
    "Manufacturer": "BrainProducts",
    "PowerLineFrequency": 50,
    "SamplingFrequency": 2500.0,
    "SoftwareFilters": "n/a",
    "RecordingDuration": 1007.9396,
    "RecordingType": "continuous",
    "EEGReference": "n/a",
    "EEGGround": "n/a",
    "EEGPlacementScheme": "based on the extended 10/20 system",
    "EEGChannelCount": 61,
    "EOGChannelCount": 1,
    "ECGChannelCount": 0,
    "EMGChannelCount": 0,
    "MiscChannelCount": 0,
    "TriggerChannelCount": 0
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/eeg/sub-010003_task-resting_channels.tsv'...

name    type    units   low_cutoff      high_cutoff     description     sampling_frequency      status  status_description
Fp1     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fp2     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F7      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F3      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fz      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Copying data files to sub-010003_task-resting_eeg.vhdr

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/sub-010003_scans.tsv'...

filename        acq_time
eeg/sub-010003_task-resting_eeg.vhdr    2013-09-10T10:58:55.350974Z
Wrote /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010003/sub-010003_scans.tsv entry with eeg/sub-010003_task-resting_eeg.vhdr.
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr...
Setting channel info structure...
Extracting parameters from /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon/sub-010002/RSEEG/sub-010002.vhdr...
Setting channel info structure...

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.tsv'...

participant_id  age     sex     hand
sub-010002      n/a     n/a     n/a
sub-010003      n/a     n/a     n/a
sub-010004      n/a     n/a     n/a

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/participants.json'...

{
    "participant_id": {
        "Description": "Unique participant identifier"
    },
    "age": {
        "Description": "Age of the participant at time of testing",
        "Units": "years"
    },
    "sex": {
        "Description": "Biological sex of the participant",
        "Levels": {
            "F": "female",
            "M": "male"
        }
    },
    "hand": {
        "Description": "Handedness of the participant",
        "Levels": {
            "R": "right",
            "L": "left",
            "A": "ambidextrous"
        }
    }
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_events.tsv'...

onset   duration        trial_type      value   sample
0.0     0.0004  New Segment/    2       0
0.0     0.0004  Comment/no USB Connection to actiCAP    1       0
3.9916  0.0004  Stimulus/S  1   3       9979
6.3752  0.0004  Stimulus/S  1   3       15938
6.3848  0.0004  Stimulus/S210   5       15962

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/dataset_description.json'...

{
    "Name": " ",
    "BIDSVersion": "1.6.0",
    "DatasetType": "raw",
    "Authors": [
        "[Unspecified]"
    ]
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_eeg.json'...

{
    "TaskName": "resting",
    "Manufacturer": "BrainProducts",
    "PowerLineFrequency": 50,
    "SamplingFrequency": 2500.0,
    "SoftwareFilters": "n/a",
    "RecordingDuration": 1021.9996,
    "RecordingType": "continuous",
    "EEGReference": "n/a",
    "EEGGround": "n/a",
    "EEGPlacementScheme": "based on the extended 10/20 system",
    "EEGChannelCount": 61,
    "EOGChannelCount": 1,
    "ECGChannelCount": 0,
    "EMGChannelCount": 0,
    "MiscChannelCount": 0,
    "TriggerChannelCount": 0
}

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/eeg/sub-010002_task-resting_channels.tsv'...

name    type    units   low_cutoff      high_cutoff     description     sampling_frequency      status  status_description
Fp1     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fp2     EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F7      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
F3      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Fz      EEG     µV      0.015915494309189534    1000.0  ElectroEncephaloGram    2500.0  good    n/a
Copying data files to sub-010002_task-resting_eeg.vhdr

Writing '/home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/sub-010002_scans.tsv'...

filename        acq_time
eeg/sub-010002_task-resting_eeg.vhdr    2013-11-11T13:47:40.346211Z
Wrote /home/docs/checkouts/readthedocs.org/user_builds/sovabids/checkouts/stable/_data/lemon_bids_rpc/sub-010002/sub-010002_scans.tsv entry with eeg/sub-010002_task-resting_eeg.vhdr.
Answer:
null

Checking the conversion

For clarity purposes we will check the output directory we got from sovabids.

print_dir_tree(bids_path)

print('LEMON CONVERSION FINISHED!')

Out:

|lemon_bids_rpc/
|--- README
|--- dataset_description.json
|--- participants.json
|--- participants.tsv
|--- code/
|------ sovabids/
|--------- mappings.yml
|--------- mappings.yml.bkp
|--------- rules.yml.bkp
|--------- sovabids.log
|--------- sovabids.log.errors
|--- sub-010002/
|------ sub-010002_scans.tsv
|------ eeg/
|--------- sub-010002_task-resting_channels.tsv
|--------- sub-010002_task-resting_eeg.eeg
|--------- sub-010002_task-resting_eeg.json
|--------- sub-010002_task-resting_eeg.vhdr
|--------- sub-010002_task-resting_eeg.vmrk
|--------- sub-010002_task-resting_events.tsv
|--- sub-010003/
|------ sub-010003_scans.tsv
|------ eeg/
|--------- sub-010003_task-resting_channels.tsv
|--------- sub-010003_task-resting_eeg.eeg
|--------- sub-010003_task-resting_eeg.json
|--------- sub-010003_task-resting_eeg.vhdr
|--------- sub-010003_task-resting_eeg.vmrk
|--------- sub-010003_task-resting_events.tsv
|--- sub-010004/
|------ sub-010004_scans.tsv
|------ eeg/
|--------- sub-010004_task-resting_channels.tsv
|--------- sub-010004_task-resting_eeg.eeg
|--------- sub-010004_task-resting_eeg.json
|--------- sub-010004_task-resting_eeg.vhdr
|--------- sub-010004_task-resting_eeg.vmrk
|--------- sub-010004_task-resting_events.tsv
LEMON CONVERSION FINISHED!

Total running time of the script: ( 0 minutes 6.525 seconds)

Gallery generated by Sphinx-Gallery