Skip to content

Split longitudinal CLI into nested per-stage subcommands (Stage 3 of #301)#313

Merged
nx10 merged 2 commits into
mainfrom
refactor/longitudinal-stage-3
Apr 15, 2026
Merged

Split longitudinal CLI into nested per-stage subcommands (Stage 3 of #301)#313
nx10 merged 2 commits into
mainfrom
refactor/longitudinal-stage-3

Conversation

@nx10
Copy link
Copy Markdown
Contributor

@nx10 nx10 commented Apr 15, 2026

Tracker: #301 — Stage 3.

Summary

  • Replace the legacy rbc longitudinal process --anatomical --functional flag flow with a nested subparser group: rbc longitudinal {template,anatomical,functional,metrics,qc,all}. rbc long stays registered as an alias for the parent command (aliases=["long"]).
  • Introduce cli/longitudinal/_base.py::LongitudinalBaseArgs on top of BaseArgs, adding --fs-license. Every longitudinal subcommand accepts --fs-license for a consistent surface, even though only template consumes it today.
  • Delete the Stage-2 holding-pen cli/longitudinal/process.py.
  • Register metrics, qc, and all so they surface in --help, but their orchestration entrypoints raise NotImplementedError until Stage 6 lands. This keeps the discoverable shape stable while leaving the implementation to later stages.
  • Split the combined orchestration run() into per-stage entrypoints in orchestration/longitudinal/{anatomical,functional,metrics,qc,all}.py, sharing subject/session iteration via a new iter_sessions_with_template helper in the package __init__.py.
  • Update unit tests to cover each subcommand's validate_namespace, the parent subparser + long alias help output, and per-stage orchestration dispatch.
  • Update README (add rbc longitudinal … row to workflow table, flag Stage 6 gap) and docs/data_dictionary.md.

Stage 3 checklist (#301)

  • cli/longitudinal/{template,anatomical,functional,metrics,qc,all}.py exist with nested subparsers.
  • __init__.py registers longitudinal with aliases=["long"].
  • cli/longitudinal/_base.py defines LongitudinalBaseArgs with --fs-license on top of BaseArgs.
  • Legacy flat cli/longitudinal.py (the --anatomical --functional shape) is deleted — here, the Stage-2 holding pen cli/longitudinal/process.py.
  • cli/main.py already registers the longitudinal subparser group; this PR leaves it unchanged.
  • Stage-6 subcommands (metrics, qc, all) register but raise NotImplementedError with a pointer to Longitudinal pipeline: refactor and release readiness (tracker) #301.
  • README + docs/data_dictionary.md updated.

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 --help shows all six stages.
  • uv run rbc long --help matches.

…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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

Coverage

Tests Skipped Failures Errors Time
768 0 💤 0 ❌ 0 🔥 11.094s ⏱️

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.
@nx10 nx10 merged commit 4904354 into main Apr 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant