Skip to content

neurobagel/bagel-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bagel-cli

Coverage Status Tests Docker Image Version

The bagel-cli is a Python command-line tool to automatically parse and describe subject phenotypic and imaging attributes in an annotated dataset for integration into the Neurobagel graph.

Please refer to our official Neurobagel documentation for information on how to install and use the CLI.

Development environment

To ensure that our Docker images are built in a predictable way, we use requirements.txt as a lock-file. That is, requirements.txt includes the entire dependency tree of our tool, with pinned versions for every dependency (see here for more information).

Setting up a local development environment

To work on the CLI, we suggest that you create a development environment that is as close as possible to the environment we run in production.

  1. Install the dependencies from the lockfile (dev_requirements.txt):

    pip install -r dev_requirements.txt
  2. Install the CLI without touching the dependencies:

    pip install --no-deps -e .
  3. Install the bids-examples and neurobagel_examples submodules needed to run the test suite:

    git submodule init
    git submodule update

Confirm that everything works well by running the tests: pytest .

Update python lock-file

The requirements.txt file is automatically generated from the setup.cfg constraints. To update it, we use pip-compile from the pip-tools package. Here is how you can use these tools to update the requirements.txt file.

  1. Ensure pip-tools is installed:
    pip install pip-tools
  2. Update the runtime dependencies in requirements.txt:
    pip-compile -o requirements.txt --upgrade
  3. The above command only updates the runtime dependencies. Now, update the developer dependencies in dev_requirements.txt:
    pip-compile -o dev_requirements.txt --extra all

Regenerating the Neurobagel vocabulary file

Terms in the Neurobagel namespace (nb prefix) and their class relationships are serialized to a file called nb_vocab.ttl, which is automatically uploaded to new Neurobagel graph deployments. This vocabulary is used by Neurobagel APIs to fetch available attributes and attribute instances from a graph store.

When the Neurobagel graph data model is updated (e.g., if new classes or subclasses are created), this file should be regenerated by running:

python generate_nb_vocab_file.py

This will create a file called nb_vocab.ttl in the current working directory.