[ENH] Rework architecture specific to BIDS and CAPS dataset #1453
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.
Closes #1448
Following #1443, this PR continues the re-organization of the code relative to
iotools
andconverters
. More precisely, it targets the code handling BIDS and CAPS datasets which is scattered across the code base (some inclinica.converters
, some inclinica.iotools
, some inclinica.utils
...).The base idea of this PR is to regroup all this code in a separate module called
clinica.datasets
(name can change if needed). This module has all the logic related to BIDS and CAPS datasets (validation, queries, writing, parsing...).The logic specific to BIDS datasets is in the
clinica.datasets.bids
submodule while the logic specific to CAPS is inclinica.dataset.caps
. Logic handling both is inclinica.datasets
.Going through these pieces of code, it seems we have a lot of small functions doing more or less the same things, and sometimes in ways that we don't need anymore. An example is the functions trying to guess whether a folder is a BIDS or CAPS dataset by doing some heuristic checks. Since the introduction of the MANDATORY
dataset_description.json
file for both types of datasets, we don't need to guess anymore, we have the information written in the metadata, so we "just" need to parse it.