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.
The AFIDs-Validator is an open-access, browser-based platform that pairs active learning with quality assurance for anatomical landmark placement. As summarized in the graphical abstract above, it comprises three parts: (1) a data foundation of trained-rater placements distilled into per-landmark reference distributions of anatomical fiducial localization error (AFLE); (2) an AI-guided learning mode (/learn) that teaches placement of the 32 AFIDs landmarks in an in-browser MRI viewer with protocol-grounded, reliability-calibrated feedback; and (3) a validation engine that scores uploaded landmark files against expert-annotated reference templates. It is described in our accompanying paper (see Paper & reproducibility).
The validator includes a guided-learning mode at /learn — an interactive tutor that walks users through placing anatomical fiducials and gives feedback on each placement. It is powered by any OpenAI-compatible language model.
Default model: Groq's Llama 3.3 70B (llama-3.3-70b-versatile) — a free, open-source model. When an API key is present, the endpoint and model default to Groq automatically, so the only thing you need to configure is the key.
Configure via .env (see .env.template):
LLM_API_KEY— API key for the shared tutor. Get a free Groq key at https://console.groq.com/keys. Setting only this is enough —LLM_BASE_URLandLLM_MODELdefault to Groq.LLM_BASE_URL— OpenAI-compatible endpoint. Optional; defaults to Groq when a key is set.LLM_MODEL— Model name. Optional; defaults tollama-3.3-70b-versatile.
The tutor works with any OpenAI-compatible model. The simplest zero-cost option is Groq, which offers a free developer tier with no credit card required:
- Go to https://console.groq.com and sign up (email, Google, or GitHub).
- Open API Keys in the sidebar, or go directly to https://console.groq.com/keys.
- Click Create API Key, name it (e.g.
afids-tutor), and submit. - Copy the key immediately — Groq shows the full key only once; after you close the dialog it is masked and cannot be retrieved.
- On the
/learnpage, open Settings (⚙), paste the key into the API-key field (the provider defaults to Groq), and save. The key is stored only in your browser and is never transmitted to or logged by the server.
The free tier is rate-limited but ample for individual learning. No payment details are required.
The tutor degrades gracefully:
- Visitors can enter their own key/provider from the in-page Settings panel — their key stays in their browser and is never logged or persisted server-side.
- If no key is configured anywhere, the tutor streams static reference material instead of failing.
Local, zero-key option: run Ollama (ollama pull llama3.2) and leave LLM_API_KEY empty — the tutor talks to your local model, no key or cost.
RAG note: retrieval degrades gracefully to the built-in landmark reference when no embeddings store is present, so the tutor works without ingestion. Do not run
flask ingest-knowledgeagainst a Groq key — Groq serves chat models only, not embeddings.
Production is deployed via the AFIDs Validator Deploy GitHub Actions workflow (.github/workflows/deploy.yml, manually triggered), which builds a wheel and ships it to the server over SSH. Deployment configuration (including PRODUCTION_LLM_API_KEY for the shared tutor) is supplied through repository secrets.
The platform and its pedagogical design are described in our accompanying methods/resource paper (in preparation). The analysis and figure-generation scripts live in scripts/ and are run from the repository root:
scripts/compute_reliability.py— computes the per-landmark trained-rater AFLE distributions from the AFIDs multi-rater release, writingafidsvalidator/rater_reliability.json(the reliability prior used by the tutor and validator).scripts/analyze_afids_templates.py— inter-template variability analysis across the reference templates.scripts/make_figures.py— regenerates the graphical abstract and Figures 1–6 intopaper_figures/. Figures 3–6 regenerate deterministically from the released templates and placements.scripts/make_graphical_abstract.py,scripts/make_ga_assets.py— build the graphical abstract (Figure 0) and its assets.
Run these from the repository root, e.g. python scripts/make_figures.py.
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:
- Git clone the afids-validator repository
git clone https://github.com/afids/afids-validator.git - Set up python environment via
poetry shell - Install the required libraries via
poetry install --with dev - Install the pre-commit action via
poetry run poe setup. This will automatically perform quality tasks for each new commit. - Update configuration in
.env.templateand rename to.envfile
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.
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.
To test the login with ORCID iD:
- Create an account (with a mailinator.com email address) on sandbox.orcid.org
- Follow these instructions to get a client ID and client secret. Set the
Redirect URIsto your local testing address (eg.127.0.0.1:5001,localhost:5001) - Update your local
.envfile with your new credentials. - Locally change the URLs in
afidsvalidator/orcid.pyto start with api.sandbox.orcid.org - Run the application and test your login.

