Loris icon indicating copy to clipboard operation
Loris copied to clipboard

Refactor mri_protocol into scan_type_identification with similar structure as mri_protocol_checks

Open cmadjar opened this issue 2 years ago • 4 comments

Brief summary of changes

This is the LORIS side changes required for the refactoring of the mri_protocol table to be like mri_protocol_checks. During an imaging call, it was suggested by @driusan to rename the table to scan_type_identification to make it clear that the table is used for scan type identification which will avoid future confusion with the mri_protocol_checks table which validates the protocol of the scan used against some parameters.

Note: because of this naming changes, the mri_protocol_group, mri_protocol_group_target and mri_protocol_violated_scans were renamed to scan_type_identification_group, scan_type_identification_group_target and scan_type_identification_failure to remain consistent and avoid more confusion when looking at the tables.

List of changes:

  • [x] modified default schema
  • [x] created a patch that adds the scan_type_identification and scan_type_identification_failures tables and alters the mri_protocol_group and mri_protocol_group_target tables
  • [x] addition of two scripts that
    • [x] populate the new scan_type_identification table based on the content of mri_protocol
    • [x] populate the new scan_type_identification_failures table based on the content of mri_protocol_violated_scans
  • [x] created a cleanup patch to remove the old mri_protocol table
  • [x] documented the update process in CHANGELOG under Notes for existing projects + in the description of the PR
  • [x] modified the MRI violation module where the protocol is displayed (that is going to be fun, LOL)
  • [x] updated raisinbread with SQL changes
  • [x] checked if those changes affect the API, if so, modify the API code -> no change needed
  • [x] checked whether tests need to be updated -> no change needed
  • [ ] modify the LORIS-MRI code to use the new table

Testing instructions (if applicable)

  1. test that the default schema can be sourced
  2. test the patch 2022-05-17-add-scan_type_identification-table-refactor-mri_protocol-part-1.sql
  3. run the PHP tool script that populates the scan_type_identification table based on the content of mri_protocol
  4. test the MRI violations module

Notes for existing projects

mri_protocol, mri_protocol_group, mri_protocol_group_target and mri_protocol_violated_scans have been redesigned and renamed to scan_type_parameter, scan_type_parameter_group, scan_type_parameter_group_target and scan_type_identification_failure respectively. To upgrade to the new structure, follow the following steps:

  1. run SQL patch SQL/New_patches/2022-05-17-add-scan_type_identification-table-refactor-mri_protocol-part-1.sql
  2. run tools/single_use/populate_scan_type_parameter_table_based_on_mri_protocol_table.php to populate scan_type_parameter based on the entries present in mri_protocol
  3. run tools/single_use/populate_scan_type_identification_failure_table_based_on_mri_protocol_violated_scans_table.php to populate scan_type_identification_failure based on the entries present in mri_protocol_violated_scans
  4. optionally, run the two SQL clean up patches to remove mri_protocol and mri_protocol_violated_scans after ensuring there are proper backups of those tables. (Clean up patches are: SQL/Cleanup_patches/2022-05-17-remove-mri_protocol.sql and SQL/Cleanup_patches/2022-05-17-remove-mri_protocol_violated_scans.sql)

Link(s) to related issue(s)

  • Related to https://github.com/aces/Loris-MRI/issues/363

cmadjar avatar May 17 '22 21:05 cmadjar

@driusan @nicolasbrossard before I move forward with this work, could you take a look at the new SQL structure and let me know if the changes make sense? I'd like to validate the SQL changes before changing the code everywhere, including the LORIS-MRI side.

Thank you!

cmadjar avatar May 17 '22 21:05 cmadjar

@driusan thank you for the review!! See my answers to your comments. Let me know your thoughts. We can also discuss during the imaging call. Thanks!

cmadjar avatar Jun 17 '22 12:06 cmadjar

@driusan ready for another round of review. All your comments have been replied to or taken care of in the last few commits. I also fixed the dashboard automated tests in theory.

Thank you!

cmadjar avatar Jun 17 '22 18:06 cmadjar

@driusan @kongtiaowang I don't understand where the error comes from in the tests. Would you mind taking a look?

cmadjar avatar Jun 23 '22 20:06 cmadjar