Skip to content

Commit

Permalink
[imaging_browser] Add AcquisitionDate field in the files table (aces#…
Browse files Browse the repository at this point in the history
…6892)

This adds an AcquisitionDate column in the files table where the acquisition date of the files will be stored. If none are available for the file, then it will default to NULL.

    Resolves aces#6883 

See also: aces/Loris-MRI#553 and  aces/Loris-MRI#554
  • Loading branch information
cmadjar authored and zaliqarosli committed Sep 3, 2020
1 parent d87cae3 commit fe5abfc
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 318 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Quality Control, and Behavioural Quality Control. (PR #6041)
- Addition of a new `account_request_date` in `users` table that will be used when
requesting a new account and will be displayed in the User Accounts module (PR #6191)
- Candidate's age can be retrieved from the Candidate class in days, months, or years (PR #5945)
- An `AcquisitionDate` field has been added to the `files` table (PR #6892)
#### Bug Fixes
- *Add item here*
### Modules
Expand Down
1 change: 1 addition & 0 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ CREATE TABLE `files` (
`HrrtArchiveID` int(11) default NULL,
`ScannerID` int(10) unsigned default NULL,
`AcqOrderPerModality` int(11) default NULL,
`AcquisitionDate` date default NULL,
PRIMARY KEY (`FileID`),
KEY `file` (`File`),
KEY `sessionid` (`SessionID`),
Expand Down
13 changes: 13 additions & 0 deletions SQL/New_patches/2020-08-10_add_AcquisitionDate_to_files.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

ALTER TABLE files ADD COLUMN `AcquisitionDate` date DEFAULT NULL;

UPDATE
files f,
parameter_file pf,
parameter_type pt
SET
f.AcquisitionDate=pf.Value
WHERE
f.FileID=pf.FileID
AND pf.ParameterTypeID=pt.ParameterTypeID
AND pt.Name='acquisition_date';
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi
Project.Name as project,
s.Visit_label as visitLabel,
$PendingFailSubquery as Visit_QC_Status,
DATE_FORMAT(MIN(pf.Value), \"%Y-%m-%d\") as First_Acquisition,
DATE_FORMAT(MIN(f.AcquisitionDate), \"%Y-%m-%d\") as First_Acquisition,
FROM_UNIXTIME(MIN(f.InsertTime)) as First_Insertion,
FROM_UNIXTIME(MAX(fqc.QCLastChangeTime)) as Last_QC,
$NewDataSubquery as New_Data,
Expand All @@ -203,8 +203,6 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi
LEFT JOIN Project ON (s.ProjectID=Project.ProjectID)
JOIN files f ON (f.SessionID=s.ID)
LEFT JOIN files_qcstatus fqc ON (fqc.FileID=f.FileID)
JOIN parameter_file pf ON (f.FileID=pf.FileID)
JOIN parameter_type pt USING (ParameterTypeID)
LEFT JOIN mri_scan_type modality ON
(f.AcquisitionProtocolID=modality.ID)
$left_joins
Expand Down
5 changes: 1 addition & 4 deletions modules/imaging_browser/php/viewsession.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ class ViewSession extends \NDB_Form
$AcquisitionProtocol = $FileObj->getAcquisitionProtocol();
$CoordinateSpace = $FileObj->getParameter('CoordinateSpace');
$Algorithm = $FileObj->getParameter('Algorithm');
$AcquisitionDate = $this->_getDate(
$FileObj,
'acquisition_date'
);
$AcquisitionDate = $FileObj->getParameter('AcquisitionDate');
$ProcDate = $this->_getDate(
$FileObj,
'processing:processing_date'
Expand Down
Loading

0 comments on commit fe5abfc

Please sign in to comment.