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';
8 changes: 4 additions & 4 deletions modules/candidate_list/jsx/candidateListIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ class CandidateListIndex extends Component {
default: return <td>None</td>;
}
}
if (column === this.props.t('Scan Done', {ns: 'loris'})) {
if (column === this.props.t('Scan Uploaded', {ns: 'loris'})) {
if (cell === 'Y') {
const pscid = row[this.props.t('PSCID', {ns: 'loris'})];
let url = this.props.baseURL + '/imaging_browser/?PSCID=' + pscid;
return (
<td className="scanDoneLink">
<td className="scanUploadedLink">
<a href={url}>{this.props.t('Yes', {ns: 'loris'})}</a>
</td>
);
Expand Down Expand Up @@ -254,10 +254,10 @@ class CandidateListIndex extends Component {
},
},
{
'label': this.props.t('Scan Done', {ns: 'loris'}),
'label': this.props.t('Scan Uploaded', {ns: 'loris'}),
'show': true,
'filter': {
name: 'scanDone',
name: 'scanUploaded',
type: 'select',
hide: this.state.hideFilter,
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ 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(f.FileID) > 0 THEN 'Y'
ELSE 'N'
END AS scanUploaded,
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 +84,7 @@ 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
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
32 changes: 18 additions & 14 deletions modules/candidate_list/test/CandidateListTestIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class CandidateListTestIntegrationTest extends LorisIntegrationTestWithCandidate
static $cohort = 'select[name="cohort"]';
static $advancedFilter = ".panel-body .btn-primary:nth-child(1)";
// advanced filter
static $scanDone = 'select[name="scanDone"]';
static $Participant = 'select[name="participantStatus"]';
static $dob = 'input[name="DoB"]';
static $visitCount = 'input[name="visitCount"]';
static $feedback = 'select[name="feedback"]';
static $edc = 'input[name="edc"]';
static $scanUploaded = 'select[name="scanUploaded"]';
static $Participant = 'select[name="participantStatus"]';
static $dob = 'input[name="DoB"]';
static $visitCount = 'input[name="visitCount"]';
static $feedback = 'select[name="feedback"]';
static $edc = 'input[name="edc"]';



Expand Down Expand Up @@ -136,10 +136,10 @@ function testCandidateListAdvancedOptionsAppear()
$this->safeClick(WebDriverBy::cssSelector($btn));
// Go through each element and ensure it's on the page after clicking
// advanced
$scanDoneOptions = $this->safeFindElement(
WebDriverBy::Name("scanDone")
$scanUploadedOptions = $this->safeFindElement(
WebDriverBy::Name("scanUploaded")
);
$this->assertEquals("select", $scanDoneOptions->getTagName());
$this->assertEquals("select", $scanUploadedOptions->getTagName());
$participantsStatusOptions = $this->safeFindElement(
WebDriverBy::Name("participantStatus")
);
Expand Down Expand Up @@ -252,7 +252,7 @@ function testFilters()
'210'
);
$this->_filterTest(
self::$scanDone,
self::$scanUploaded,
self::$display,
self::$clearFilter,
"Yes",
Expand Down Expand Up @@ -357,23 +357,27 @@ function testPscidLink()
}

/**
* Tests that, click the scan_done ="y" link,
* Tests that, click the scanUploaded ="y" link,
* and it will goto the imaging browser page.
*
* @return void
*/
function testScanDoneLink()
function testScanUploadedLink()
{
$this->safeGet($this->url . "/candidate_list/?pscid=MTL022");
$bodyText = $this->safeFindElement(
WebDriverBy::cssSelector("#dynamictable > tbody > tr > td.scanDoneLink")
WebDriverBy::cssSelector(
"#dynamictable > tbody > tr > td.scanUploadedLink"
)
)->getText();
$this->assertStringContainsString(
"Y",
$bodyText
);
$this->safeClick(
WebDriverBy::cssSelector("#dynamictable > tbody > tr > td.scanDoneLink")
WebDriverBy::cssSelector(
"#dynamictable > tbody > tr > td.scanUploadedLink"
)
);
$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
15 changes: 9 additions & 6 deletions modules/imaging_browser/php/queryengine.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ class QueryEngine extends \LORIS\Data\Query\SQLQueryEngine
);
$items = [
new DictionaryItem(
"ScanDone",
"Does the session have any imaging scan done?",
"ScanUploaded",
"Does the session have any imaging scan uploaded?",
$scope,
new \LORIS\Data\Types\BooleanType(),
new Cardinality(Cardinality::SINGLE),
Expand Down Expand Up @@ -374,11 +374,14 @@ class QueryEngine extends \LORIS\Data\Query\SQLQueryEngine
protected function getFieldNameFromDict(
\LORIS\Data\Dictionary\DictionaryItem $item
): string {
if ($item->getName() == 'ScanDone') {
if ($item->getName() == 'ScanUploaded') {
$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";
$this->addTable('LEFT JOIN files f ON (f.SessionID=s.ID)');
return "EXISTS (
SELECT 1
FROM files f
WHERE f.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
32 changes: 14 additions & 18 deletions modules/imaging_browser/test/ImagingQueryEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,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 +116,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 +127,7 @@ function setUp() : void
'ProjectID' => 1,
'CohortID' => 1,
'Active' => 'Y',
'Visit_Label' => 'TestMRIVisit',
'Scan_Done' => 'Y'
'Visit_Label' => 'TestMRIVisit'
],
]
);
Expand Down Expand Up @@ -225,29 +222,29 @@ function tearDown() : void
}

/**
* Test that matching ScanDone matches the correct CandIDs.
* Test that matching ScanUploaded matches the correct CandIDs.
*
* @return void
*/
public function testScanDoneMatches()
public function testScanUploadedMatches()
{
$dict = $this->_getDictItem("ScanDone");
$dict = $this->_getDictItem("ScanUploaded");

$result = iterator_to_array(
$this->engine->getCandidateMatches(
new QueryTerm($dict, new Equal(true))
)
);

// 123456 has a ScanDone = true result for visit TestMRIVisit
// 123456 has a ScanUploaded = true result for visit TestMRIVisit
// So does 123457.
$this->assertTrue(is_array($result));
$this->assertEquals(2, count($result));
$this->assertEquals($result[0], new CandID("123456"));
$this->assertEquals($result[1], new CandID("123457"));

// 123456 has a ScanDone = false result for visit TestBvlVisit
// No other candidate has a ScanDone=false session.
// 123456 has a ScanUploaded = false result for visit TestBvlVisit
// No other candidate has a ScanUploaded=false session.
$result = iterator_to_array(
$this->engine->getCandidateMatches(
new QueryTerm($dict, new NotEqual(true))
Expand Down Expand Up @@ -385,7 +382,7 @@ function testGetCandidateData()
$results = iterator_to_array(
$this->engine->getCandidateData(
[
$this->_getDictItem("ScanDone"),
$this->_getDictItem("ScanUploaded"),
$this->_getDictItem("ScanType1_file"),
$this->_getDictItem("ScanType1_QCStatus"),
],
Expand All @@ -394,13 +391,12 @@ function testGetCandidateData()
)
);

// 123458 had no files, but has a session, so still has the ScanDone
$this->assertEquals(count($results), 3);
$this->assertEquals(count($results), 1);
$this->assertEquals(
$results,
[
"123456" => [
"ScanDone" => [
"ScanUploaded" => [
"1" => [
'VisitLabel' => 'TestMRIVisit',
'SessionID' => 1,
Expand Down Expand Up @@ -430,7 +426,7 @@ function testGetCandidateData()
],
],
"123457" => [
"ScanDone" => [
"ScanUploaded" => [
"3" => [
'VisitLabel' => 'TestMRIVisit',
'SessionID' => 3,
Expand Down Expand Up @@ -461,7 +457,7 @@ function testGetCandidateData()
],
],
"123458" => [
'ScanDone' => [],
'ScanUploaded' => [],
'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
Loading
Loading