From 79ddf22774aec200ea76ebf01d58c190a00eeac1 Mon Sep 17 00:00:00 2001 From: 611 Date: Sun, 12 Jul 2026 14:57:23 -0400 Subject: [PATCH] Fix naming robustness and validator compliance across flat/deep datasets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - filename_tokenizer: _pick supports whole-segment mode (omit position), default segment=-1, robust to letter/digit tokenization (S01, PD01) - filename_tokenizer: _match handles **/ glob for root-level flat files - planner: add evidence gate — demote session/run to none when constant or resolving to <2 distinct values across all files - planner: subject-count guard no longer short-circuits on empty map - executor: inject ses- into DICOM filenames when subdir has a session layer, keeping directory and filename consistent - eeg_convert: bootstrap empty TSV cells to n/a; drop duplicate row append --- .autobidsify_session | 1 - .gitignore | 9 +- README.md | 14 +- autobidsify/bids_grammar.py | 208 ++++++++++++++++++ autobidsify/converters/eeg_convert.py | 10 +- autobidsify/converters/executor.py | 141 ++++++++++-- autobidsify/converters/mri_convert.py | 44 ++++ autobidsify/converters/nirs_convert.py | 5 +- autobidsify/converters/planner.py | 286 ++++++++++++++++++++++++- autobidsify/filename_tokenizer.py | 231 ++++++++++++++++++++ autobidsify/llm.py | 56 ++++- 11 files changed, 977 insertions(+), 28 deletions(-) delete mode 100644 .autobidsify_session create mode 100644 autobidsify/bids_grammar.py diff --git a/.autobidsify_session b/.autobidsify_session deleted file mode 100644 index 0c22ef8..0000000 --- a/.autobidsify_session +++ /dev/null @@ -1 +0,0 @@ -/drives/jin1/users/roseliu/auto_bidsify/outputs_new/run3/run3-qwen3-n \ No newline at end of file diff --git a/.gitignore b/.gitignore index b553682..195cb67 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,11 @@ backups/ *.bak # Misc -bump_version.py \ No newline at end of file +bump_version.py + +# Tests +repeatability/ +repeatability_config.py +repeatability_run.out +run_repeatability.py +repeatability_full.out \ No newline at end of file diff --git a/README.md b/README.md index 429be89..3f10b80 100644 --- a/README.md +++ b/README.md @@ -326,22 +326,22 @@ https://github.com/yiyiliu-rose/autobidsifyAPP/releases Two versions are provided: **AutoBIDSify ExecVal** — Execute and validate only. No AI or API key required. -Runs the `execute` and `validate` stages locally using a pre-generated BIDS plan. +Runs the `execute` and `validate` stages locally using a pre-generated BIDS plan. https://github.com//autobidsifyAPP.git | Platform | Download | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Windows | [AutoBIDSify-ExecVal-Windows.zip](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-Windows.zip) | -| macOS (Apple Silicon) | [AutoBIDSify-ExecVal-macOS-arm64.zip](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-macOS-arm64.zip) | -| Linux | [AutoBIDSify-ExecVal-Linux.tar.gz](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-Linux.tar.gz) | +| Windows | [AutoBIDSify-ExecVal-Windows.zip](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-Windows.zip) | +| macOS (Apple Silicon) | [AutoBIDSify-ExecVal-macOS-arm64.zip](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-macOS-arm64.zip) | +| Linux | [AutoBIDSify-ExecVal-Linux.tar.gz](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-execval/AutoBIDSify-ExecVal-Linux.tar.gz) | **AutoBIDSify Full** — Complete pipeline with AI. Requires an OpenAI API key, local Ollama model, or DashScope API key. Runs the full AutoBIDSify pipeline from ingestion to validation. | Platform | Download | | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Windows | [AutoBIDSify-Full-Windows.zip](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-Windows.zip) | -| macOS (Apple Silicon) | [AutoBIDSify-Full-macOS-arm64.zip](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-macOS-arm64.zip) | -| Linux | [AutoBIDSify-Full-Linux.tar.gz](https://github.com/yiyiliu-rose/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-Linux.tar.gz) | +| Windows | [AutoBIDSify-Full-Windows.zip](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-Windows.zip) | +| macOS (Apple Silicon) | [AutoBIDSify-Full-macOS-arm64.zip](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-macOS-arm64.zip) | +| Linux | [AutoBIDSify-Full-Linux.tar.gz](https://github.com/NeuroJSON/autobidsifyAPP/releases/download/latest-full/AutoBIDSify-Full-Linux.tar.gz) | Linux note: both desktop apps require a desktop environment with Tk and are built for GLIBC 2.35+. diff --git a/autobidsify/bids_grammar.py b/autobidsify/bids_grammar.py new file mode 100644 index 0000000..75f3563 --- /dev/null +++ b/autobidsify/bids_grammar.py @@ -0,0 +1,208 @@ +# bids_grammar.py +# Single source of truth for BIDS filename grammar and required-metadata rules. +# +# Everything that decides "what a legal BIDS filename looks like" lives here, so +# that name assembly (executor) and sidecar generation share ONE rule set instead +# of each re-deriving order/legality with ad-hoc string surgery. Adding a modality +# means adding rows to these tables, not editing assembly logic. +# +# Rules encoded here come directly from the BIDS spec and the MRS-BIDS extension +# (Bouchard et al., Sci Data 2025, https://doi.org/10.1038/s41597-025-05543-2): +# - filenames are sub-