# Contributing to iTrialSpace Thanks for your interest in improving iTrialSpace! This guide covers the development workflow, coding standards, and how to extend the framework. ## Development setup ```bash git clone cd itrialspace # Create the environment (conda recommended for the imaging/ML stack) conda env create -f environment.yml conda activate itrialspace # Editable install with dev tooling pip install -e ".[dev]" # Configure paths (copy and edit) cp .env.example .env # Install git hooks pre-commit install ``` ## Project layout The repo is a single installable package under `src/itrialspace/`. See [docs/architecture.md](docs/architecture.md) for the full component map. | Path | Purpose | |------|---------| | `src/itrialspace/{core,io,index,query,site}` | Nodule index, querying, trial specs | | `src/itrialspace/trials` | Trial manifest runner (the 13 modes) | | `src/itrialspace/mask_inserter` | Voxel-level nodule mask insertion | | `src/itrialspace/synthesis` | NodMAISI CT synthesis (model weights external) | | `src/itrialspace/apps/{nodulemap,retriever}` | Interactive web tools | | `src/itrialspace/evaluation/vlm_eval` | Vision-language model evaluation | | `src/itrialspace/evaluation/{cade,cadx}` | Optional CADe/CADx eval (external deps) | | `infra/slurm` | HPC submission scripts (cluster-portable via `env.sh`) | | `configs/` | Example configs (`*.example.yaml`) | | `tests/` | Unit tests (run with no external data) | ## Coding standards - **Formatting/linting**: `black` + `ruff` (run automatically via pre-commit). - **No hardcoded paths**: never write `/home/...` or `/scratch/...` in code, configs, or scripts. Resolve paths through `itrialspace.config.settings` or env vars. CI enforces this via `tools/check_portability.py`. - **NIfTI orientation**: always canonicalize to RAS+ (`nib.as_closest_canonical()`). - **Determinism**: seed with `42` and derive per-case seeds deterministically. ## Running checks locally ```bash ruff check . && black --check . pytest -m "not full_volume" # unit tests, no external data python tools/check_portability.py # no stray absolute paths pre-commit run --all-files ``` ## Extending the framework - **New dataset**: see [docs/data.md](docs/data.md) and `src/itrialspace/io/adapters/`. - **New trial mode**: add a factory in `src/itrialspace/site/trial_modes.py` and wire it into `src/itrialspace/trials/run_trial.py`. - **New VLM**: add a wrapper in `src/itrialspace/evaluation/vlm_eval/models/`. ## Pull requests 1. Branch from `main`. 2. Keep changes focused; update docs and tests. 3. Ensure CI passes (lint + tests + portability gate). 4. Describe the change and link any related issue.