Describe the bug
When converting an ADNI subset to BIDS using Clinica's ADNI-to-BIDS converter, an error can occur when processing clinical data if no subject IDs match the bids_ids list in the function _filter_subj_bids from clinica/converters/adni-to-bids/_utils.py.
In this case, an empty dataframe is returned with its columns not properly filtered against the sessions specifications in the function _create_adni_sessions_dict from clinica/converters/adni-to-bids/_utils.py, which can lead to unexpected and invalid columns being added to the final sessions dataframe.
To Reproduce
Steps to reproduce the behavior:
- Use the ADNI-to-BIDS converter
- Convert a single subject for which no rows match in some clinical data, such as
003_S_6432 in clinica_data_ci
- Open the produced
*_sessions.tsv in the BIDS folder
- Observe the invalid columns present in
*_sessions.tsv, such as ADAS_QuestionnaireNotAttempted, ADAS_Q1_T1_WL1_W1_butter, ...
Expected behavior
The resulting empty dataframe df_filtered, the final sessions dataframe df_subj_session, and the produced *_sessions.tsv file, should only keep columns defined in the sessions.tsv specifications.
Screenshots
This kind of data should be found in the produced *_sessions.tsv file :

Desktop :
- OS: MacOS Sequoia 15.7.1
- Clinica Version: 0.10.1
Additional context
A temporary and quick fix would be to filter df_filtered columns to keep only those defined in the sessions.tsv specifications before merging them into df_subj_session.
Describe the bug
When converting an ADNI subset to BIDS using Clinica's ADNI-to-BIDS converter, an error can occur when processing clinical data if no subject IDs match the
bids_idslist in the function_filter_subj_bidsfromclinica/converters/adni-to-bids/_utils.py.In this case, an empty dataframe is returned with its columns not properly filtered against the sessions specifications in the function
_create_adni_sessions_dictfromclinica/converters/adni-to-bids/_utils.py, which can lead to unexpected and invalid columns being added to the final sessions dataframe.To Reproduce
Steps to reproduce the behavior:
003_S_6432inclinica_data_ci*_sessions.tsvin the BIDS folder*_sessions.tsv, such asADAS_QuestionnaireNotAttempted,ADAS_Q1_T1_WL1_W1_butter, ...Expected behavior
The resulting empty dataframe
df_filtered, the final sessions dataframedf_subj_session, and the produced*_sessions.tsvfile, should only keep columns defined in thesessions.tsvspecifications.Screenshots

This kind of data should be found in the produced
*_sessions.tsvfile :Desktop :
Additional context
A temporary and quick fix would be to filter
df_filteredcolumns to keep only those defined in thesessions.tsvspecifications before merging them intodf_subj_session.