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

[Everything] DIE MRI ALIAS DIE #1227

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion docs/scripts_md/MRIProcessingUtility.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ utilities

%tarchiveInfo = $utility->createTarchiveArray($ArchiveLocation);

my ($center_name, $centerID) = $utility->determinePSC(\%tarchiveInfo,0);
my $centerID = $utility->determinePSC(\%tarchiveInfo,0);

my $projectID = $utility->determineProjectID(\%tarchiveInfo);
my $scannerID = $utility->determineScannerID(\%tarchiveInfo, 0, $centerID, $projectID);
Expand Down
44 changes: 37 additions & 7 deletions uploadNeuroDB/NeuroDB/MRIProcessingUtility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ utilities

%tarchiveInfo = $utility->createTarchiveArray($ArchiveLocation);

my ($center_name, $centerID) = $utility->determinePSC(\%tarchiveInfo,0);
my $centerID = $utility->determinePSC(\%tarchiveInfo,0);

my $projectID = $utility->determineProjectID(\%tarchiveInfo);
my $scannerID = $utility->determineScannerID(\%tarchiveInfo, 0, $centerID, $projectID);
Expand Down Expand Up @@ -613,14 +613,13 @@ sub determinePSC {
my $lookupCenterNameUsing = $configOB->getLookupCenterNameUsing();


my ($center_name, $centerID) =
NeuroDB::MRI::getPSC(
my $centerID = NeuroDB::MRI::getPSC(
$tarchiveInfo->{$lookupCenterNameUsing},
$this->{dbhr},
$this->{'db'}
);
if ($to_log) {
if (!$center_name) {
if (!$centerID) {

my $message = "\nERROR: No center found for this candidate \n\n";
$this->writeErrorLog(
Expand All @@ -630,13 +629,12 @@ sub determinePSC {
exit $NeuroDB::ExitCodes::SELECT_FAILURE;
}
my $message = "\n==> Verifying acquisition center\n-> " .
"Center Name : $center_name\n-> CenterID ".
" : $centerID\n";
"CenterID: $centerID\n";
$this->{LOG}->print($message);
$this->spool($message, 'N', $upload_id, $notify_detailed);
}

return ($center_name, $centerID);
return $centerID;
}


Expand Down Expand Up @@ -2289,6 +2287,38 @@ sub getUploadIDUsingTarchiveSrcLoc {
return $upload_id;
}

=pod

=head3 getCenterNameFromCenterID($centerID)

Gets the MRI ALIAS form the C<psc> table using the center ID.

INPUT: Center ID

RETURNS: MRI ALIAS

=cut


sub getCenterNameFromCenterID {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal opinion: I would prefer this function to be named getSiteMRIAliasFromSiteID.

  • "center" is used pervasively in the LORIS code but Samir said in some LORIS / LORIS-MRI meeting that "site" is the preferred terminology. Since it does against the current code I guess this is somewhat controversial.
  • A "site name" refers to another column in the database, so I think it would be less confusing to specify "MRIAlias" directly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll avoid the entire situation and change it to getMRIAliasFromCenterID()

my $dbh = &NeuroDB::DBI::connect_to_db(@Settings::db);

my $centerID = shift;
my $query = '';
my $alias = undef;

if ($centerID) {
$query = "SELECT MRI_alias FROM psc "
. "WHERE CenterID =?";
my $sth = $dbh->prepare($query);
$sth->execute($centerID);
if ( $sth->rows > 0 ) {
$alias = $sth->fetchrow_array;
}
}
return $alias;
}


=pod

Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/imaging_non_minc_insertion.pl
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ =head2 Methods


# determine Center ID
my ($center_name, $centerID) = $utility->determinePSC(\%info, 0, undef);
my $centerID = $utility->determinePSC(\%info, 0, undef);



Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/minc_insertion.pl
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ =head2 Methods
$studyInfo{'DateAcquired'} //= $file->getParameter('study:start_date');

## Determine PSC, ScannerID and Subject IDs
my ($center_name, $centerID) = $utility->determinePSC(\%studyInfo, 0, $upload_id);
my $centerID = $utility->determinePSC(\%studyInfo, 0, $upload_id);
my $projectID = $utility->determineProjectID(\%studyInfo);
my $scannerID = $utility->determineScannerID(\%studyInfo, 0, $centerID, $projectID, $upload_id);
my $subjectIDsref = $utility->determineSubjectID(
Expand Down
9 changes: 4 additions & 5 deletions uploadNeuroDB/register_processed_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ =head2 Methods

# ----- STEP 2: Verify PSC information using whatever field contains the site string
# (only for minc files)
my ($center_name,$centerID);
my $centerID;
if ($file->getFileDatum('FileType') eq 'mnc') {
my $patientInfo;
if ($lookupCenterName eq 'PatientName') {
Expand All @@ -243,13 +243,12 @@ =head2 Methods
$filename, 'patient:identification'
);
}
($center_name, $centerID) = NeuroDB::MRI::getPSC($patientInfo, \$dbh, $db);
my $psc = $center_name;
if (!$psc) {
$centerID = NeuroDB::MRI::getPSC($patientInfo, \$dbh, $db);
if (!$centerID) {
print LOG "\nERROR: No center found for this candidate \n\n";
exit $NeuroDB::ExitCodes::SELECT_FAILURE;
}
print LOG "\n==> Verifying acquisition center\n - Center Name : $center_name\n - CenterID : $centerID\n";
print LOG "\n==> Verifying acquisition center\n - CenterID: $centerID\n";
}


Expand Down
7 changes: 4 additions & 3 deletions uploadNeuroDB/tarchiveLoader.pl
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,11 @@ =head2 Methods
}

################################################################
########## Get the $center_name, $centerID ################
#################### Get the $centerID #########################
################################################################
my ($center_name, $centerID) =
my $centerID =
$utility->determinePSC(\%tarchiveInfo, 0, $upload_id);
my $mri_alias = $utility->getCenterNameFromCenterID($centerID);

################################################################
######### Determine the ScannerID ##############################
Expand Down Expand Up @@ -605,7 +606,7 @@ =head2 Methods
################################################################
# make final logfile name without overwriting phantom logs #####
################################################################
my $final_logfile = $center_name;
my $final_logfile = $mri_alias;
unless ($tarchiveInfo{'DateAcquired'} && $subjectIDsref->{'CandID'}) {
### if something went wrong and there is no acq date or CandID
$final_logfile .= '_'.$temp[$#temp];
Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/tarchive_validation.pl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ =head2 Methods
### Verify PSC information using whatever field ################
### contains site string #######################################
################################################################
my ($center_name, $centerID) = $utility->determinePSC(\%tarchiveInfo, 1, $upload_id);
my $centerID = $utility->determinePSC(\%tarchiveInfo, 1, $upload_id);

################################################################
################################################################
Expand Down
Loading