Skip to content

Commit

Permalink
Apply diagnosis mapping inside function
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceJoubert committed Oct 10, 2024
1 parent 4186106 commit a5ace77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
5 changes: 0 additions & 5 deletions clinica/iotools/converters/oasis_to_bids/oasis_to_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ def _create_sessions_tsv(
bids_ids=bids_ids,
)

# todo : when tested add to create_sessions_dict bc specific to oasis1
for bids_id in bids_ids:
sessions_dict[bids_id]["M000"]["diagnosis"] = (
"AD" if sessions_dict[bids_id]["M000"]["diagnosis"] > 0 else "CN"
)
write_sessions_tsv(bids_dir, sessions_dict)

return sessions_dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def create_sessions_dict(
# managed before

result = result.loc[bids_ids]
result["diagnosis"] = result["diagnosis"].apply(
lambda x: "AD" if x > 0 else "CN"
)
result["session_id"] = "ses-M000"

for bids_id, row in result.iterrows():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ def expected() -> dict:
"session_id": "ses-M000",
"cdr_global": 0,
"MMS": 29,
"diagnosis": 0,
"diagnosis": "CN",
},
},
"sub-OASIS10002": {
"M000": {
"session_id": "ses-M000",
"cdr_global": 0,
"MMS": 29,
"diagnosis": 0,
"diagnosis": "CN",
}
},
}
Expand Down

0 comments on commit a5ace77

Please sign in to comment.