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 a ScannerID column to files table: Redmine 10939 #156

Merged
merged 4 commits into from
Sep 28, 2016
Merged
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 uploadNeuroDB/NeuroDB/MRI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ sub register_db {
# build the insert query
my $query = "INSERT INTO files SET ";

foreach my $key ('File', 'SessionID','EchoTime', 'CoordinateSpace', 'OutputType', 'AcquisitionProtocolID', 'FileType', 'InsertedByUserID', 'Caveat', 'SeriesUID', 'TarchiveSource','SourcePipeline','PipelineDate','SourceFileID') {
foreach my $key ('File', 'SessionID','EchoTime', 'CoordinateSpace', 'OutputType', 'AcquisitionProtocolID', 'FileType', 'InsertedByUserID', 'Caveat', 'SeriesUID', 'TarchiveSource','SourcePipeline','PipelineDate','SourceFileID', 'ScannerID') {
# add the key=value pair to the query
$query .= "$key=".$dbh->quote($${fileData{$key}}).", ";
}
Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/minc_insertion.pl
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
## at this point things will appear in the database ############
## Set some file information ###################################
################################################################
$file->setParameter('ScannerID', $scannerID);
$file->setFileData('ScannerID', $scannerID);
$file->setFileData('SessionID', $sessionID);
$file->setFileData('SeriesUID', $file->getParameter('series_instance_uid'));
$file->setFileData('EchoTime', $file->getParameter('echo_time'));
Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/registerFile.pl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
$file->getParameter('software_versions'),
$centerID,
\$dbh, 0);
$file->setParameter('ScannerID', $scannerID);
$file->setFileData('ScannerID', $scannerID);
print "Set scannerid = $scannerID\n" if $verbose;

# get ids from the headers
Expand Down
11 changes: 5 additions & 6 deletions uploadNeuroDB/register_processed_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
print LOG "\nERROR: could not determine scannerID based on sourceFileID $sourceFileID.\n\n";
exit 2;
}
$file->setParameter('ScannerID',$scannerID);
$file->setFileData('ScannerID',$scannerID);
print LOG "\t -> Set ScannerID to $scannerID.\n";


Expand Down Expand Up @@ -302,16 +302,15 @@ sub getSessionID {


=pod
This function gets ScannerID from parameter_file using sourceFileID
This function gets ScannerID from files using sourceFileID
=cut
sub getScannerID {
my ($sourceFileID,$dbh) = @_;

my $scannerID;
my $query = "SELECT pf.Value AS ScannerID " .
"FROM parameter_file AS pf " .
"JOIN parameter_type AS pt ON (pt.ParameterTypeID=pf.ParameterTypeID) " .
"WHERE pt.Name='ScannerID' AND pf.FileID=?";
my $query = "SELECT f.ScannerID AS ScannerID " .
"FROM files AS f " .
"WHERE f.FileID=?";
my $sth = $dbh->prepare($query);
$sth->execute($sourceFileID);
if($sth->rows > 0) {
Expand Down