Skip to content

Fix insertions in table mri_violations_log #1291

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

Merged
merged 1 commit into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion uploadNeuroDB/NeuroDB/MRIProcessingUtility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,32 @@ sub insert_into_mri_violations_log {
my $move_file = $severity eq 'exclude' ? 1 : undef;
my $file_rel_path = NeuroDB::MRI::get_trashbin_file_rel_path($file_path, $data_dir, $move_file);


#------------------------------------------#
# Find the CandidateID of candidate with #
# CandID=$candID #
#------------------------------------------#
my $query = "SELECT ID FROM candidate WHERE CandID=?";
my $rowsref = ${$this->{'dbhr'}}->selectall_arrayref($query, { Slice=> {} }, $candID);

if (@$rowsref != 1) {
NeuroDB::UnexpectedValueException->throw(
errorMessage => sprintf(
"Unexpected number of candidates with CandID set to %s (should be 1 but was %d)",
$candID,
scalar(@$rowsref)
)
);
}

my $candidateID = $rowsref->[0]->{'ID'};

my %newViolationsLog = (
'TarchiveID' => $tarchiveID,
'SeriesUID' => $file->getFileDatum('SeriesUID'),
'MincFile' => $file_rel_path,
'PatientName' => $pname,
'CandID' => $candID,
'CandidateID' => $candidateID,
'Visit_label' => $visit_label,
'MriScanTypeID' => $scan_type,
'Severity' => $severity,
Expand Down
Loading