From 7435fc7b1e57f05a5a5ec7e680b84e7020da42f9 Mon Sep 17 00:00:00 2001 From: cmadjar Date: Mon, 6 Feb 2023 16:21:06 -0500 Subject: [PATCH 1/7] fix Human dangling out of nowhere --- modules/imaging_browser/jsx/imagingBrowserIndex.js | 5 +++++ modules/imaging_browser/php/imaging_browser.class.inc | 7 +++++++ .../php/imagingbrowserrowprovisioner.class.inc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/imaging_browser/jsx/imagingBrowserIndex.js b/modules/imaging_browser/jsx/imagingBrowserIndex.js index 54d6f373fdc..35402204d96 100644 --- a/modules/imaging_browser/jsx/imagingBrowserIndex.js +++ b/modules/imaging_browser/jsx/imagingBrowserIndex.js @@ -167,6 +167,11 @@ class ImagingBrowserIndex extends Component { type: 'multiselect', options: options.pendingNew, }}, + {label: 'Entity Type', show: false, filter: { + name: 'entityType', + type: 'multiselect', + option: options.entityType, + }}, ]; /** * Adding columns based on the Imaging Browser Tabulated Scan Types diff --git a/modules/imaging_browser/php/imaging_browser.class.inc b/modules/imaging_browser/php/imaging_browser.class.inc index eca7b1bb641..a203d4b2490 100644 --- a/modules/imaging_browser/php/imaging_browser.class.inc +++ b/modules/imaging_browser/php/imaging_browser.class.inc @@ -137,6 +137,12 @@ class Imaging_Browser extends \DataFrameworkMenu $config = \NDB_Config::singleton(); $toTable_scan_types = $config->getSetting('tblScanTypes'); + // get entity type options + $entityType = [ + 'Human' => 'Human', + 'Scanner' => 'Scanner', + ]; + return [ 'sites' => $siteList, 'projects' => $list_of_projects, @@ -144,6 +150,7 @@ class Imaging_Browser extends \DataFrameworkMenu 'sequenceTypes' => $sequenceTypes, 'pendingNew' => $pending, 'configLabels' => $toTable_scan_types, + 'entityType' => $entityType, ]; } diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 98e18425e5a..9901f0784a8 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -189,9 +189,9 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi s.ID as sessionID, GROUP_CONCAT(DISTINCT modality.Scan_type) as sequenceType, $PendingNewquery as pending, - $modalities_subquery s.CenterID as CenterID, c.Entity_type as entityType, + $modalities_subquery s.ProjectID FROM psc AS p JOIN session s ON (s.CenterID=p.CenterID) From e4bed86fb4b17b4a55ef76447a4752a2d04815dd Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 09:32:42 -0500 Subject: [PATCH 2/7] add some prints to figure out what is going on --- .../imagingbrowserrowprovisioner.class.inc | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 9901f0784a8..fab201434f6 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -172,6 +172,42 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi // ================================================= // Final query // ================================================= + error_log(print_r( + "SELECT + p.Name as Site, + c.PSCID as PSCID, + c.CandID as DCCID, + Project.Name as project, + s.Visit_label as visitLabel, + $PendingFailSubquery as Visit_QC_Status, + 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, + GROUP_CONCAT(DISTINCT OutputType) as Links, + s.ID as sessionID, + GROUP_CONCAT(DISTINCT modality.Scan_type) as sequenceType, + $PendingNewquery as pending, + s.CenterID as CenterID, + c.Entity_type as entityType, + $modalities_subquery + s.ProjectID + FROM psc AS p + JOIN session s ON (s.CenterID=p.CenterID) + JOIN candidate c ON (c.CandID=s.CandID) + 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) + LEFT JOIN mri_scan_type modality ON + (f.AcquisitionProtocolID=modality.ID) + $left_joins + WHERE + s.Active = 'Y' AND + f.FileType IN ('mnc', 'nii') + GROUP BY s.ID + ORDER BY c.PSCID, s.Visit_label + " + )); parent::__construct( "SELECT From 893a0360cfb22d169c384289e59397cebee54d34 Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 10:10:55 -0500 Subject: [PATCH 3/7] remove print --- .../imagingbrowserrowprovisioner.class.inc | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index fab201434f6..9fc1fab0b5a 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -172,43 +172,6 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi // ================================================= // Final query // ================================================= - error_log(print_r( - "SELECT - p.Name as Site, - c.PSCID as PSCID, - c.CandID as DCCID, - Project.Name as project, - s.Visit_label as visitLabel, - $PendingFailSubquery as Visit_QC_Status, - 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, - GROUP_CONCAT(DISTINCT OutputType) as Links, - s.ID as sessionID, - GROUP_CONCAT(DISTINCT modality.Scan_type) as sequenceType, - $PendingNewquery as pending, - s.CenterID as CenterID, - c.Entity_type as entityType, - $modalities_subquery - s.ProjectID - FROM psc AS p - JOIN session s ON (s.CenterID=p.CenterID) - JOIN candidate c ON (c.CandID=s.CandID) - 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) - LEFT JOIN mri_scan_type modality ON - (f.AcquisitionProtocolID=modality.ID) - $left_joins - WHERE - s.Active = 'Y' AND - f.FileType IN ('mnc', 'nii') - GROUP BY s.ID - ORDER BY c.PSCID, s.Visit_label - " - )); - parent::__construct( "SELECT p.Name as Site, From fcbe98654c68a0557febdb4ad9ff175492438111 Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 10:38:53 -0500 Subject: [PATCH 4/7] fix order of QC status displayed? --- .../php/imagingbrowserrowprovisioner.class.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 9fc1fab0b5a..14f42a0a4b1 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -107,7 +107,11 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi $pass = []; $coalesce_desc = []; - foreach ($scan_id_types as $id => $type) { + foreach($toTable_scan_types as $arr_idx => $type) { + if (!in_array($type, $scan_id_types)) { + continue; + } + $id = array_search($type, $scan_id_types); $pass[$id] = $DB->escape($type); $qc[$id] = $DB->quote($type); $coalesce_desc[$id] = $DB->escape($type); From c251110f3203abb7aebd9cad7cf62818cfa788cd Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 10:42:16 -0500 Subject: [PATCH 5/7] add comments to give context as to why the foreach loop is done on and not --- .../php/imagingbrowserrowprovisioner.class.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 14f42a0a4b1..862945f7e34 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -107,6 +107,11 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi $pass = []; $coalesce_desc = []; + // in order to keep the same order as the order of modalities + // specified in the config module, loop through the + // $toTable_scan_types array that conserved the order with + // which modalities will be displayed (which is what the React + // side expects) foreach($toTable_scan_types as $arr_idx => $type) { if (!in_array($type, $scan_id_types)) { continue; From b7dc444b4b1692a1cdc2c76ae6b1aaf4e0084fd8 Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 10:46:31 -0500 Subject: [PATCH 6/7] fix spacing --- .../php/imagingbrowserrowprovisioner.class.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 862945f7e34..61b95bdff68 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -112,13 +112,13 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi // $toTable_scan_types array that conserved the order with // which modalities will be displayed (which is what the React // side expects) - foreach($toTable_scan_types as $arr_idx => $type) { + foreach ($toTable_scan_types as $arr_idx => $type) { if (!in_array($type, $scan_id_types)) { continue; } - $id = array_search($type, $scan_id_types); - $pass[$id] = $DB->escape($type); - $qc[$id] = $DB->quote($type); + $id = array_search($type, $scan_id_types); + $pass[$id] = $DB->escape($type); + $qc[$id] = $DB->quote($type); $coalesce_desc[$id] = $DB->escape($type); $case_desc[$id] = " CASE From b478b20547fc47a0a8c482fce0f7cfa2de21b8c6 Mon Sep 17 00:00:00 2001 From: cmadjar Date: Thu, 9 Feb 2023 11:02:11 -0500 Subject: [PATCH 7/7] Rida said to always listen to Phan :) --- .../imaging_browser/php/imagingbrowserrowprovisioner.class.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc index 61b95bdff68..ee614bc9ff2 100644 --- a/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc +++ b/modules/imaging_browser/php/imagingbrowserrowprovisioner.class.inc @@ -112,7 +112,7 @@ class ImagingBrowserRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisi // $toTable_scan_types array that conserved the order with // which modalities will be displayed (which is what the React // side expects) - foreach ($toTable_scan_types as $arr_idx => $type) { + foreach ($toTable_scan_types as $type) { if (!in_array($type, $scan_id_types)) { continue; }