Split longitudinal CLI into nested per-stage subcommands (Stage 3 of #301)#313
Merged
Conversation
…301) Replace the legacy `rbc longitudinal process --anatomical --functional` flag flow with dedicated `rbc longitudinal {template,anatomical,functional, metrics,qc,all}` subcommands. `rbc long` stays as an alias for the parent group. `metrics`, `qc`, and `all` register for discoverability but raise `NotImplementedError` until Stage 6 lands. CLI args now hang off `LongitudinalBaseArgs` (in `cli/longitudinal/_base.py`), which adds `--fs-license` on top of `BaseArgs`. Orchestration gains per-stage `run()` entrypoints in `orchestration/longitudinal/{anatomical,functional, metrics,qc,all}.py`; the shared subject/session iteration primitive moves to `orchestration/longitudinal.iter_sessions_with_template`. Unit tests now cover each subcommand's `validate_namespace`, the parent subparser + `long` alias help output, and per-stage orchestration dispatch.
The per-stage orchestration `run()` entrypoints previously imported the shared iteration helper via a function-local import because the package `__init__.py` already imported those modules at top level. Moving the helper into a dedicated `_iter.py` module lets both sides import it cleanly at module scope. Test patch paths updated accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracker: #301 — Stage 3.
Summary
rbc longitudinal process --anatomical --functionalflag flow with a nested subparser group:rbc longitudinal {template,anatomical,functional,metrics,qc,all}.rbc longstays registered as an alias for the parent command (aliases=["long"]).cli/longitudinal/_base.py::LongitudinalBaseArgson top ofBaseArgs, adding--fs-license. Every longitudinal subcommand accepts--fs-licensefor a consistent surface, even though onlytemplateconsumes it today.cli/longitudinal/process.py.metrics,qc, andallso they surface in--help, but their orchestration entrypoints raiseNotImplementedErroruntil Stage 6 lands. This keeps the discoverable shape stable while leaving the implementation to later stages.run()into per-stage entrypoints inorchestration/longitudinal/{anatomical,functional,metrics,qc,all}.py, sharing subject/session iteration via a newiter_sessions_with_templatehelper in the package__init__.py.validate_namespace, the parent subparser +longalias help output, and per-stage orchestration dispatch.rbc longitudinal …row to workflow table, flag Stage 6 gap) anddocs/data_dictionary.md.Stage 3 checklist (#301)
cli/longitudinal/{template,anatomical,functional,metrics,qc,all}.pyexist with nested subparsers.__init__.pyregisterslongitudinalwithaliases=["long"].cli/longitudinal/_base.pydefinesLongitudinalBaseArgswith--fs-licenseon top ofBaseArgs.cli/longitudinal.py(the--anatomical --functionalshape) is deleted — here, the Stage-2 holding pencli/longitudinal/process.py.cli/main.pyalready registers the longitudinal subparser group; this PR leaves it unchanged.NotImplementedErrorwith a pointer to Longitudinal pipeline: refactor and release readiness (tracker) #301.docs/data_dictionary.mdupdated.Test plan
uv run pytest -m unit— 767 passed, 1 skipped.uv run ruff check src/ tests/— clean.uv run ruff format --check src/ tests/— clean.uv run mypy src/ tests/— clean (166 files).uv run rbc longitudinal --helpshows all six stages.uv run rbc long --helpmatches.