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

Added Create_visit_label option so that you don't get any MRICandidateMi... #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions uploadNeuroDB/NeuroDB/MRI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ B<subjectIDIsValid( C<$CandID>, C<$PSCID>, C<$dbhr> )>
Returns: 1 if the ID pair matches, 0 otherwise
=cut
sub subjectIDIsValid {
my ($candID, $pscid, $visit_label, $dbhr, $check_visit_label) = @_;
my ($candID, $pscid, $visit_label, $dbhr, $create_visit_label) = @_;
my $query = "SELECT COUNT(*) AS isValid FROM candidate WHERE CandID=".$${dbhr}->quote($candID)." AND PSCID=".$${dbhr}->quote($pscid);
my $sth = $${dbhr}->prepare($query);
$sth->execute();

my $rowhr = $sth->fetchrow_hashref();

if (($rowhr->{'isValid'} == 1) && $check_visit_label) {
# Check that visit label exists in the database if don't want to create visit labels via imaging pipeline
if (($rowhr->{'isValid'} == 1) && ($create_visit_label eq "no")) {
$query = "SELECT COUNT(*) AS isValid FROM Visit_Windows WHERE BINARY Visit_label=".$${dbhr}->quote($visit_label);
$sth = $${dbhr}->prepare($query);
$sth->execute();
Expand Down
4 changes: 3 additions & 1 deletion uploadNeuroDB/NeuroDB/MRIProcessingUtility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,12 @@ sub validateCandidate {
$query = "SELECT Visit_label FROM Visit_Windows WHERE BINARY Visit_label=?";
$sth = ${$this->{'dbhr'}}->prepare($query);
$sth->execute($subjectIDsref->{'visitLabel'});
if ($sth->rows == 0) {
if (($sth->rows == 0) && ($subjectIDsref->{'createVisitLabel'} eq "no") {
print LOG "\n\n => No Visit label";
$CandMismatchError= 'Visit label does not exist';
return $CandMismatchError;
} elsif (($sth->rows == 0) && ($subjectIDsref->{'createVisitLabel'} eq "yes")) {
print LOG "\n\n => Will create visit label $subjectIDsref->{'visitLabel'}";
}

return $CandMismatchError;
Expand Down