Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] No failure when creation date is not null and other improvements to _check_derived_image_xml #957

Merged

Conversation

NicolasGensollen
Copy link
Member

Closes #955

This PR proposes to improve the function _check_derived_image_xml of the ADNI2BIDS converter. This function was performing a bunch of assertions on the metadata associated with derived images. One of these assertions on the creationDate field doesn't make sense to me as it was asserting the date is always equal to "0000-00-00":

This led to issue #955 were the creation date in the XML file provided by the user is a valid date not equal to this value.

This PR proposes to check that the creation date is either "0000-00-00" or a valid date in format YYYY-MM-DD.
It also changes from assertions to error raising, and tries to improve the error messages to give a better user experience.

@NicolasGensollen
Copy link
Member Author

Anyone's up for a review on that one ?

@ghisvail
Copy link
Contributor

ghisvail commented Aug 24, 2023 via email

@NicolasGensollen
Copy link
Member Author

NicolasGensollen commented Aug 24, 2023

Would be great to keep function definition order as it were before the proposed changes, in order to reduce the size of the diff and facilitate the review.

Yes I know, sorry about that. I changed it for a reason though. When a function relies on another, the callee is defined just after the caller (except if already defined). This tends to reduce the amount of scrolling the reader has to do when trying to understand what a function does. In a way, the PR reviewers are sacrificed for the confort of maintainers...

@NicolasGensollen
Copy link
Member Author

@ghisvail indeed the order was reversed compared to what I said above, sorry about that...
Should be fixed now.

Copy link
Contributor

@ghisvail ghisvail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I liked your proposal to turn generic assets to more meaningful error messages very much 👍

@NicolasGensollen
Copy link
Member Author

Thanks for the review @ghisvail !

Merging...

@NicolasGensollen NicolasGensollen merged commit 988f611 into aramis-lab:dev Aug 24, 2023
20 checks passed
@NicolasGensollen NicolasGensollen deleted the fix-xml-checks-adni-to-bids branch August 24, 2023 13:53
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.

ADNI-to-BIDS problem with MRI
2 participants