Skip to content
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
1 change: 0 additions & 1 deletion SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ CREATE TABLE `session` (
`BVLQCType` enum('Visual','Hardcopy') DEFAULT NULL,
`BVLQCExclusion` enum('Excluded','Not Excluded') DEFAULT NULL,
`QCd` enum('Visual','Hardcopy') DEFAULT NULL,
`Scan_done` enum('N','Y') DEFAULT NULL,
`MRIQCStatus` enum('','Pass','Fail') NOT NULL DEFAULT '',
`MRIQCPending` enum('Y','N') NOT NULL DEFAULT 'N',
`MRIQCFirstChangeTime` datetime DEFAULT NULL,
Expand Down
2 changes: 0 additions & 2 deletions SQL/0000-00-03-ConfigTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'excluded_instruments', "Instruments to be excluded from the Data Dictionary and download via the Data Query Tool", 1, 1, 'instrument', ID, 'Excluded instruments', 18 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'InstrumentResetting', 'Allows resetting of instrument data', 1, 0, 'boolean', ID, 'Instrument Resetting', 20 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'SupplementalSessionStatus', 'Display supplemental session status information on Timepoint List page', 1, 0, 'boolean', ID, 'Use Supplemental Session Status', 21 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useScanDone', 'Used for identifying timepoints that have (or should have) imaging data', 1, 0, 'boolean', ID, 'Use Scan Done', 22 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'allowPrenatalTimepoints', 'Determines whether creation of timepoints prior to Date of Birth is allowed', 1, 0, 'boolean', ID, 'Allow Prenatal Timepoints', 23 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'ImagingUploaderAutoLaunch', "Allows running the ImagingUpload pre-processing scripts", 1, 0, 'boolean', ID, 'ImagingUploader Auto Launch',24 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'citation_policy', 'Citation Policy for Acknowledgements module', 1, 0, 'textarea', ID, 'Citation Policy', 25 FROM ConfigSettings WHERE Name="study";
Expand Down Expand Up @@ -226,7 +225,6 @@ INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHER
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useScreening";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useConsent";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="SupplementalSessionStatus";
INSERT INTO Config (ConfigID, Value) SELECT ID, "true" FROM ConfigSettings WHERE Name="useScanDone";
INSERT INTO Config (ConfigID, Value) SELECT ID, "true" FROM ConfigSettings WHERE Name="allowPrenatalTimepoints";
INSERT INTO Config (ConfigID, Value) SELECT ID, 0 FROM ConfigSettings WHERE Name="ImagingUploaderAutoLaunch";
INSERT INTO Config (ConfigID, Value) SELECT ID, "Customize this text with your citation policy (via Configuration module)" FROM ConfigSettings WHERE Name="citation_policy";
Expand Down
5 changes: 5 additions & 0 deletions SQL/New_patches/2025-12-16-remove-scan-done.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE session DROP COLUMN scan_done;

DELETE FROM Config WHERE ConfigID=(SELECT ID FROM ConfigSettings WHERE Name="useScanDone");

DELETE FROM ConfigSettings WHERE Name='useScanDone';
12 changes: 11 additions & 1 deletion modules/candidate_list/php/candidatelistrowprovisioner.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ class CandidateListRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisio
psc.Name AS RegistrationSite,
GROUP_CONCAT(DISTINCT sp.title) AS Cohort,
c.Entity_type AS EntityType,
MAX(s.Scan_done) AS scanDone,
CASE
WHEN COUNT(s.ID) = 0 THEN NULL
WHEN COUNT(f.FileID) > 0
OR COUNT(mu.UploadID) > 0
OR COUNT(t.TarchiveID) > 0
THEN 'Y'
ELSE 'N'
END AS scanDone,
COALESCE(pso.Description,'Active') AS ParticipantStatus,
DATE_FORMAT(c.DoB,'%Y-%m-%d') AS DoB,
DATE_FORMAT(c.Date_registered,'%Y-%m-%d') AS Date_registered,
Expand All @@ -81,6 +88,9 @@ class CandidateListRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisio
ON (ps.participant_status=pso.ID)
LEFT JOIN Project p ON (c.RegistrationProjectID=p.ProjectID)
LEFT JOIN cohort sp ON (s.CohortID=sp.CohortID)
LEFT JOIN files f ON f.SessionID=s.ID
LEFT JOIN mri_upload mu ON mu.SessionID=s.ID
LEFT JOIN tarchive t ON t.SessionID=s.ID
WHERE c.Active = 'Y'
AND c.RegistrationProjectID IS NOT NULL
GROUP BY c.CandID, psc.Name, c.PSCID, c.Sex, c.Entity_type,
Expand Down
10 changes: 7 additions & 3 deletions modules/candidate_list/test/CandidateListTestIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ function testPscidLink()
}

/**
* Tests that, click the scan_done ="y" link,
* Tests that, click the scanDone ="y" link,
* and it will goto the imaging browser page.
*
* @return void
Expand All @@ -366,14 +366,18 @@ function testScanDoneLink()
{
$this->safeGet($this->url . "/candidate_list/?pscid=MTL022");
$bodyText = $this->safeFindElement(
WebDriverBy::cssSelector("#dynamictable > tbody > tr > td.scanDoneLink")
WebDriverBy::cssSelector(
"#dynamictable > tbody > tr > td.scanDoneLink"
)
)->getText();
$this->assertStringContainsString(
"Y",
$bodyText
);
$this->safeClick(
WebDriverBy::cssSelector("#dynamictable > tbody > tr > td.scanDoneLink")
WebDriverBy::cssSelector(
"#dynamictable > tbody > tr > td.scanDoneLink"
)
);
$bodyText = $this->safeFindElement(
WebDriverBy::cssSelector(self::$pscidLink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function setUp(): void
'Visit_label' => 'Test0',
'CenterID' => 253,
'ProjectID' => 2,
'Scan_done' => 'Y',
'Current_stage' => 'Visit',
'Visit' => 'In Progress',
]
Expand Down
8 changes: 5 additions & 3 deletions modules/imaging_browser/php/queryengine.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,11 @@ class QueryEngine extends \LORIS\Data\Query\SQLQueryEngine
): string {
if ($item->getName() == 'ScanDone') {
$this->addTable('LEFT JOIN session s ON (s.CandidateID=c.ID)');
return "CASE WHEN s.Scan_Done='Y' THEN true
WHEN s.Scan_Done='N' THEN false
ELSE NULL END";
return "(
EXISTS (SELECT 1 FROM files f2 WHERE f2.SessionID = s.ID)
OR EXISTS (SELECT 1 FROM mri_upload m2 WHERE m2.SessionID = s.ID)
OR EXISTS (SELECT 1 FROM tarchive t2 WHERE t2.SessionID = s.ID)
)";
}

if (!($item instanceof ImagingDictionaryItem)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public function setUp(): void
'Visit_label' => 'Test0',
'CenterID' => 1,
'ProjectID' => 1,
'Scan_done' => 'Y',
'Current_stage' => 'Visit',
'Visit' => 'In Progress',
]
Expand All @@ -143,7 +142,6 @@ public function setUp(): void
'Visit_label' => 'Test1',
'CenterID' => 253,
'ProjectID' => 1,
'Scan_done' => 'Y',
'Current_stage' => 'Visit',
'Visit' => 'In Progress',
]
Expand All @@ -157,7 +155,6 @@ public function setUp(): void
'Visit_label' => 'Test2',
'CenterID' => 254,
'ProjectID' => 1,
'Scan_done' => 'Y',
'Current_stage' => 'Visit',
'Visit' => 'In Progress',
]
Expand Down
31 changes: 5 additions & 26 deletions modules/imaging_browser/test/ImagingQueryEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ function setUp() : void
'EDC' => '1930-04-01',
'Entity_type' => 'Human',
],
[
'ID' => 3,
'CandID' => "123458",
'PSCID' => "test3",
'RegistrationProjectID' => '1',
'RegistrationCenterID' => '3',
'Active' => 'N',
'DoB' => '1940-01-01',
'Sex' => 'Other',
'EDC' => '1930-04-01',
'Entity_type' => 'Human',
],
]
);

Expand All @@ -107,8 +95,7 @@ function setUp() : void
'ProjectID' => 1,
'CohortID' => 1,
'Active' => 'Y',
'Visit_Label' => 'TestMRIVisit',
'Scan_Done' => 'Y'
'Visit_Label' => 'TestMRIVisit'
],
[
'ID' => 2,
Expand All @@ -117,8 +104,7 @@ function setUp() : void
'ProjectID' => 1,
'CohortID' => 1,
'Active' => 'Y',
'Visit_Label' => 'TestBvlVisit',
'Scan_Done' => 'N'
'Visit_Label' => 'TestBvlVisit'
],
// Candidate 123457 has 1 visit with different MRI data
// It contains multiple ScanType1 and no ScanType2
Expand All @@ -129,8 +115,7 @@ function setUp() : void
'ProjectID' => 1,
'CohortID' => 1,
'Active' => 'Y',
'Visit_Label' => 'TestMRIVisit',
'Scan_Done' => 'Y'
'Visit_Label' => 'TestMRIVisit'
],
]
);
Expand Down Expand Up @@ -389,13 +374,12 @@ function testGetCandidateData()
$this->_getDictItem("ScanType1_file"),
$this->_getDictItem("ScanType1_QCStatus"),
],
[new CandID("123456"), new CandID("123457"), new CandID("123458")],
[new CandID("123456"), new CandID("123457")],
null
)
);

// 123458 had no files, but has a session, so still has the ScanDone
$this->assertEquals(count($results), 3);
$this->assertEquals(count($results), 2);
$this->assertEquals(
$results,
[
Expand Down Expand Up @@ -460,11 +444,6 @@ function testGetCandidateData()
],
],
],
"123458" => [
'ScanDone' => [],
'ScanType1_file' => [],
'ScanType1_QCStatus' => [],
],
]
);
}
Expand Down
21 changes: 2 additions & 19 deletions modules/instrument_list/php/instrument_list_controlpanel.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,7 @@ class Instrument_List_ControlPanel extends \TimePoint
function _getSendToDCCStatusMessage()
{
// create user object
$user = \User::singleton();
$config = \NDB_Config::singleton();

// get the value of the session.Scan_done field
$scanDone = $this->getData('Scan_done');
$user = \User::singleton();

if (!$user->hasPermission('send_to_dcc')) {
return "User does not have permission to send to DCC";
Expand Down Expand Up @@ -674,12 +670,6 @@ class Instrument_List_ControlPanel extends \TimePoint
return "The status of this stage is either"
. " In Progress or has not been set.";
}
if (! $config->settingEnabled("useScanDone")
|| ($this->getData('Current_stage') != 'Screening'
&& empty($scanDone))
) {
return "The Scan done field must be entered for the Visit stage";
}

$battery = new \NDB_BVL_Battery();

Expand Down Expand Up @@ -734,11 +724,7 @@ class Instrument_List_ControlPanel extends \TimePoint
function _hasAccessSendToDCC()
{
// create user object
$user =& \User::singleton();
$config =& \NDB_Config::singleton();

// get the value of the session.Scan_done field
$scanDone = $this->getData('Scan_done');
$user =& \User::singleton();

// make the option available is the Stage/Status is Sendable to DCC
// or if its Superuser and option was Sent (to unsend i.e. set to N)
Expand All @@ -764,9 +750,6 @@ class Instrument_List_ControlPanel extends \TimePoint
'In Progress',
]
)
&& (!$config->settingEnabled("useScanDone")
|| $this->getData('Current_stage') == 'Screening'
|| !empty($scanDone))
) {
return true;
}
Expand Down
14 changes: 7 additions & 7 deletions modules/instrument_list/templates/menu_instrument_list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@
{$display.CohortTitle}
</td>
<td>
{if $display.Scan_done != ""}
{if $display.Scan_done == 'Y'}
{assign var="scan_done" value=dgettext("loris", "Yes")}
{if $display.scanDone != ""}
{if $display.scanDone == 'Y'}
{assign var="scanDone" value=dgettext("loris", "Yes")}
<a href="{$baseurl|default}/imaging_browser/viewSession/?sessionID={$sessionID}" class="timepoint_list">
{$scan_done}</a>
{$scanDone}</a>
{else}
{assign var="scan_done" value={dgettext("loris", "No")}}
{$scan_done}
{assign var="scanDone" value={dgettext("loris", "No")}}
{$scanDone}
{/if}
{else}
<img alt="Data Missing" src="{$baseurl|default}/images/help2.gif" border=0>
<img alt="Data Missing" src="{$baseurl|default}/images/delete.gif" border=0>
{/if}
</td>
<td>
Expand Down
4 changes: 4 additions & 0 deletions modules/timepoint_list/php/timepoint_list.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ class Timepoint_List extends \NDB_Menu

$this->tpl_data['timePoints'][$x]['language']
= $timePoint->getLanguage();

$this->tpl_data['timePoints'][$x]['scanDone']
= $timePoint->isScanDone();

$x++;
} // end list

Expand Down
14 changes: 7 additions & 7 deletions modules/timepoint_list/templates/menu_timepoint_list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@
{/if}
</td>
<td>
{if $timePoints[timepoint].Scan_done != ""}
{if $timePoints[timepoint].Scan_done == 'Y'}
{assign var="scan_done" value={dgettext("loris", "Yes")}}
{if $timePoints[timepoint].scanDone != ""}
{if $timePoints[timepoint].scanDone}
{assign var="scanDone" value={dgettext("loris", "Yes")}}
<a href="{$baseurl|default}/imaging_browser/viewSession/?sessionID={$timePoints[timepoint].SessionID}" class="timepoint_list">
{dgettext('loris', $scan_done)}</a>
{dgettext('loris', $scanDone)}</a>
{else}
{assign var="scan_done" value={dgettext("loris", "No")}}
{$scan_done}
{assign var="scanDone" value={dgettext("loris", "No")}}
{$scanDone}
{/if}
{else}
<img alt="Data Missing" src="{$baseurl|default}/images/help2.gif" border=0>
<img alt="Data Missing" src="{$baseurl|default}/images/delete.gif" border=0>
{/if}
</td>

Expand Down
29 changes: 23 additions & 6 deletions php/libraries/TimePoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class TimePoint implements \LORIS\StudyEntities\AccessibleResource,
s.Current_stage, s.Screening, s.Date_screening, s.Visit,
s.Date_visit, s.Approval, s.Date_approval, s.Active,
s.registeredBy, s.UserID, u.Real_name, s.Hardcopy_request,
s.BVLQCStatus, s.BVLQCType, s.BVLQCExclusion, s.Scan_done,
s.BVLQCStatus, s.BVLQCType, s.BVLQCExclusion,
pr.Name as ProjectName, p.Alias as SiteAlias,
s.ProjectID as ProjectID,
l.language_code as LanguageCode,
Expand All @@ -164,7 +164,7 @@ class TimePoint implements \LORIS\StudyEntities\AccessibleResource,
$this->data = new TimePointData(
$sessionID,
isset($row['ProjectID'])
? ProjectID::singleton($row['ProjectID'])
? ProjectID::singleton((int) $row['ProjectID'])
: null,
isset($row['CenterID'])
? \CenterID::singleton($row['CenterID'])
Expand All @@ -189,6 +189,10 @@ class TimePoint implements \LORIS\StudyEntities\AccessibleResource,

$this->_timePointInfo['CandID']
= new CandID(strval($row['CandID']));

$this->_timePointInfo['scanDone']
= $this->isScanDone() ? 'Y' : 'N';

} else {
// return error when 0 rows to prevent creation of an empty object
throw new LorisException(
Expand Down Expand Up @@ -591,13 +595,26 @@ class TimePoint implements \LORIS\StudyEntities\AccessibleResource,
}

/**
* Gets whether or not a scan was done for this TimePoint
* Returns whether a scan has been done for this session
*
* @return string 'Y' if a scan was done 'N' if not.
* @return bool
*/
function getScanDone(): string
public function isScanDone() : bool
{
return $this->_timePointInfo["Scan_done"];
$db = \NDB_Factory::singleton()->database();
$result = $db->pselectOne(
"SELECT DISTINCT 'Y' AS ScanDone
FROM session s
LEFT JOIN files f ON f.SessionID = s.ID
LEFT JOIN mri_upload mu ON mu.SessionID = s.ID
LEFT JOIN tarchive t ON t.SessionID = s.ID
WHERE s.ID = :v_sessionid
AND (f.FileID IS NOT NULL
OR mu.UploadID IS NOT NULL
OR t.TarchiveID IS NOT NULL)",
['v_sessionid' => $this->getSessionID()]
);
return $result == 'Y';
}

/**
Expand Down
Loading
Loading