aces / Loris-MRI

The set of scripts that preprocess and insert MRI data into the database.
10 stars 50 forks source link

DICOM archive validation python crashes when run on inexistant upload ID #962

Closed cmadjar closed 1 year ago

cmadjar commented 1 year ago

Resolves the following bug when running dicom_archive_validation.py with an Upload ID that does not exist in the database.

Traceback (most recent call last):
  File "/opt/loris/bin/mri/python/run_dicom_archive_validation.py", line 75, in <module>
    main()
  File "/opt/loris/bin/mri/python/run_dicom_archive_validation.py", line 71, in main
    DicomValidationPipeline(loris_getopt_obj, os.path.basename(__file__[:-3]))
  File "/opt/loris/bin/mri/python/lib/dcm2bids_imaging_pipeline_lib/dicom_validation_pipeline.py", line 29, in __init__
    super().__init__(loris_getopt_obj, script_name)
  File "/opt/loris/bin/mri/python/lib/dcm2bids_imaging_pipeline_lib/base_pipeline.py", line 89, in __init__
    self.load_imaging_upload_and_tarchive_dictionaries()
  File "/opt/loris/bin/mri/python/lib/dcm2bids_imaging_pipeline_lib/base_pipeline.py", line 162, in load_imaging_upload_and_tarchive_dictionaries
    if not success and not self.options_dict["force"]["value"]:
KeyError: 'force'

With this fix, the proper message is returned:

[ERROR   ] Did not find an entry in mri_upload associated with 'UploadID' 16666

Resolves #955