/afids-validator

Validator for the anatomical fiducial placement protocol

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

AFIDs

DOI AFIDs Validator CI AFIDs Validator Release GitHub release (latest SemVer) License: GPL v3 Code style: black

Anatomical fiducials (AFIDs) is an open framework for evaluating correspondence in brain images and teaching neuroanatomy using anatomical fiducial placement. The AFIDs Validator project aims to build a web application that allows the user to upload an FCSV file generated using the AFIDs protocol, and validate that it conforms to the protocol.

Development

poetry is used to manage dependencies. To install, run the following command:

curl -sSL https://install.python-poetry.org | python3 -

For detailed setup instructions, see the documentation here.

Once installed, you can set up your development environment by:

  1. Git clone the afids-validator repository git clone https://github.com/afids/afids-validator.git
  2. Set up python environment via poetry shell
  3. Install the required libraries via poetry install --with dev
  4. Install the pre-commit action via poetry run poe setup. This will automatically perform quality tasks for each new commit.
  5. Update configuration in .env.template and rename to .env file

This will allow you to make changes and perform the necessary formatting and linting tasks. To test changes, the easiest way is via docker compose. To use this, you will need to install Docker.

Once installed, you can run docker compose up --build in the terminal.

If there are no errors, you can test it out locally at http://localhost:5001

After you are done testing, you can hit CTRL/CMD+C on the terminal to exit out of the instance and run docker compose down to remove unused containers.

Testing afids upload

If docker compose successfully starts the required services, you will first want to enter the afids-validator container interactively to migrate the database, enabling testing of database uploads.

# Enter the container interactively
docker exec -it afids-validator-afidsvalidator-1 bash

# Migrate the database
flask db upgrade -d /usr/local/lib/python3.9/dist-packages/migrations/

Note: You may need to change the container name (i.e. afids-validator-afidsvalidator-1) accordingly.

Testing login

To test the login with ORCID iD:

  1. Create an account (with a mailinator.com email address) on sandbox.orcid.org
  2. Follow these instructions to get a client ID and client secret. Set the Redirect URIs to your local testing address (eg. 127.0.0.1:5001, localhost:5001)
  3. Update your local .env file with your new credentials.
  4. Locally change the URLs in afidsvalidator/orcid.py to start with api.sandbox.orcid.org
  5. Run the application and test your login.