Remove function validate_subject_ids in lib/imaging.py as it was dead code.
Add a file lib/validate_subject_ids to isolate subject IDs validation.
Add a directory python/lib/exception to contain exception classes.
Add two exceptions DetermineSubjectException and ValidateSubjectException to handle subject IDs errors, and use these exceptions where dictionary entries were previously used.
Simplify the PSCID / CandID combination checking by using a simpler SQL query.
Notes for existing projects
If a separate script is using the validate_subject_ids logic, you will likely need to modify related code to work with the new refactored way of determining subjects IDs. This caveat is only for users using the python imaging pipeline.
Changes extracted from #1144.
Here are the changes:
validate_subject_ids
inlib/imaging.py
as it was dead code.lib/validate_subject_ids
to isolate subject IDs validation.python/lib/exception
to contain exception classes.DetermineSubjectException
andValidateSubjectException
to handle subject IDs errors, and use these exceptions where dictionary entries were previously used.Notes for existing projects
If a separate script is using the
validate_subject_ids
logic, you will likely need to modify related code to work with the new refactored way of determining subjects IDs. This caveat is only for users using the python imaging pipeline.