From bf53274bb35de993ccf31ea70e0c6698b1376881 Mon Sep 17 00:00:00 2001 From: Saagar Arya <51128536+skarya22@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:43:10 -0400 Subject: [PATCH] [SQL][Instrument List][Battery Manager] Move DDE Enabled to Test_Battery (#9264) - Changed the logic for DDE being enabled to be moved from Config to Test_Battery so that it can be managed on a visit-instrument basis instead of just instrument. - Modified Battery Manager to have a section for editing which battery has DDE enabled --- SQL/0000-00-00-schema.sql | 1 + SQL/0000-00-03-ConfigTables.sql | 1 - .../2024_05_13_Add_DDE_To_Battery.sql | 9 ++ modules/api/docs/LorisRESTAPI_v0.0.4-dev.md | 2 + .../endpoints/project/instruments.class.inc | 12 +- .../php/endpoints/project/project.class.inc | 4 +- .../models/projectinstrumentsrow.class.inc | 41 +++-- .../php/views/project/instruments.class.inc | 12 +- .../battery_manager/jsx/batteryManagerForm.js | 8 + .../jsx/batteryManagerIndex.js | 9 +- modules/battery_manager/php/test.class.inc | 24 +-- .../php/testendpoint.class.inc | 4 +- .../php/testoptionsendpoint.class.inc | 15 +- .../php/testprovisioner.class.inc | 1 + .../test/BatteryManagerTest.php | 10 +- .../incompleteprovisioner.class.inc | 25 +-- .../php/instrument_list.class.inc | 18 ++- .../instrument_list_controlpanel.class.inc | 41 +++-- php/libraries/NDB_BVL_Battery.class.inc | 81 +++++++--- php/libraries/NDB_BVL_Instrument.class.inc | 29 +++- php/libraries/Utility.class.inc | 26 ++-- raisinbread/RB_files/RB_Config.sql | 5 - raisinbread/RB_files/RB_ConfigSettings.sql | 1 - raisinbread/RB_files/RB_test_battery.sql | 66 ++++---- .../instrument_sql/Meta/aosi_meta.sql | 6 +- .../instrument_sql/Meta/bmi_meta.sql | 48 +++--- .../Meta/medical_history_meta.sql | 14 +- .../Meta/mri_parameter_form_meta.sql | 72 ++++----- .../Meta/radiology_review_meta.sql | 16 +- raisinbread/test/api/LorisApiProjectsTest.php | 6 + test/RBdata.sql | 2 +- test/integrationtests/BatteryLookup_Test.php | 147 +++++++++--------- test/unittests/NDB_BVL_Instrument_Test.php | 11 +- test/unittests/UtilityTest.php | 14 +- .../delete_ignored_conflicts.php | 4 +- tools/detect_conflicts.php | 4 +- tools/detect_duplicated_commentids.php | 8 +- tools/recreate_conflicts.php | 4 +- 38 files changed, 463 insertions(+), 338 deletions(-) create mode 100644 SQL/New_patches/2024_05_13_Add_DDE_To_Battery.sql diff --git a/SQL/0000-00-00-schema.sql b/SQL/0000-00-00-schema.sql index 887c2942f0e..1759cd8669f 100644 --- a/SQL/0000-00-00-schema.sql +++ b/SQL/0000-00-00-schema.sql @@ -341,6 +341,7 @@ CREATE TABLE `test_battery` ( `CenterID` int(11) default NULL, `firstVisit` enum('Y','N') default NULL, `instr_order` tinyint(4) default NULL, + `DoubleDataEntryEnabled` enum('Y','N') default 'N', PRIMARY KEY (`ID`), KEY `age_test` (`AgeMinDays`,`AgeMaxDays`,`Test_name`), KEY `FK_test_battery_1` (`Test_name`), diff --git a/SQL/0000-00-03-ConfigTables.sql b/SQL/0000-00-03-ConfigTables.sql index f4fb22e499b..e7b4d637a0d 100644 --- a/SQL/0000-00-03-ConfigTables.sql +++ b/SQL/0000-00-03-ConfigTables.sql @@ -51,7 +51,6 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useConsent', 'Enable if the study uses the loris architecture for consent', 1, 0, 'boolean', ID, 'Use consent', 16 FROM ConfigSettings WHERE Name="study"; INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'additional_user_info', 'Display additional user profile fields on the User accounts page (e.g. Institution, Position, Country, Address)', 1, 0, 'boolean', ID, 'Additional user information', 17 FROM ConfigSettings WHERE Name="study"; 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 'DoubleDataEntryInstruments', "Instruments for which double data entry should be enabled", 1, 1, 'instrument', ID, 'Double data entry instruments', 19 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"; diff --git a/SQL/New_patches/2024_05_13_Add_DDE_To_Battery.sql b/SQL/New_patches/2024_05_13_Add_DDE_To_Battery.sql new file mode 100644 index 00000000000..5e508c7ef28 --- /dev/null +++ b/SQL/New_patches/2024_05_13_Add_DDE_To_Battery.sql @@ -0,0 +1,9 @@ +ALTER TABLE test_battery ADD COLUMN DoubleDataEntryEnabled enum("Y", "N") DEFAULT "N"; + +UPDATE test_battery SET DoubleDataEntryEnabled = 'Y' WHERE Test_name IN ( + SELECT Value from Config WHERE ConfigID = (SELECT ID FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments') +); + +DELETE FROM Config WHERE ConfigID IN (SELECT ID FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments'); + +DELETE FROM ConfigSettings WHERE Name = 'DoubleDataEntryInstruments'; diff --git a/modules/api/docs/LorisRESTAPI_v0.0.4-dev.md b/modules/api/docs/LorisRESTAPI_v0.0.4-dev.md index e445316e5b5..6edea3e19a0 100644 --- a/modules/api/docs/LorisRESTAPI_v0.0.4-dev.md +++ b/modules/api/docs/LorisRESTAPI_v0.0.4-dev.md @@ -189,11 +189,13 @@ Will return a JSON object of the form: "FullName" : "Long Name", "Subgroup" : "Subgroup Name", "DoubleDataEntryEnabled" : boolean + "DoubleDataEntryVisits" : array }, "Instrument2" : { "FullName" : "Long Name", "Subgroup" : "Subgroup Name", "DoubleDataEntryEnabled" : boolean + "DoubleDataEntryVisits" : array }, ... } diff --git a/modules/api/php/endpoints/project/instruments.class.inc b/modules/api/php/endpoints/project/instruments.class.inc index 14eacd3be10..1b2d891b641 100644 --- a/modules/api/php/endpoints/project/instruments.class.inc +++ b/modules/api/php/endpoints/project/instruments.class.inc @@ -42,10 +42,13 @@ class Instruments extends Endpoint implements \LORIS\Middleware\ETagCalculator /** * Contructor * - * @param \Project $project The requested project + * @param \Project $project The requested project + * @param string $apiversion The version of the API being used */ - public function __construct(\Project $project) - { + public function __construct( + \Project $project, + private string $apiversion = 'v0.0.3' + ) { $this->_project = $project; } @@ -146,7 +149,8 @@ class Instruments extends Endpoint implements \LORIS\Middleware\ETagCalculator $array = (new \LORIS\api\Views\Project\Instruments( $this->_project, - iterator_to_array($instruments) + iterator_to_array($instruments), + $this->apiversion ))->toArray(); $this->_cache = new \LORIS\Http\Response\JsonResponse($array); diff --git a/modules/api/php/endpoints/project/project.class.inc b/modules/api/php/endpoints/project/project.class.inc index c7baf1f10a8..105483a0ac7 100644 --- a/modules/api/php/endpoints/project/project.class.inc +++ b/modules/api/php/endpoints/project/project.class.inc @@ -100,6 +100,8 @@ class Project extends Endpoint implements \LORIS\Middleware\ETagCalculator } } + $apiversion = $request->getAttribute("LORIS-API-Version") ?? "unknown"; + // Delegate to sub-endpoints $subendpoint = array_shift($pathparts); switch ($subendpoint) { @@ -110,7 +112,7 @@ class Project extends Endpoint implements \LORIS\Middleware\ETagCalculator $handler = new Images($this->_project); break; case 'instruments': - $handler = new Instruments($this->_project); + $handler = new Instruments($this->_project, $apiversion); break; case 'visits': $handler = new Visits($this->_project); diff --git a/modules/api/php/models/projectinstrumentsrow.class.inc b/modules/api/php/models/projectinstrumentsrow.class.inc index 58bd8634d51..76be7c809f7 100644 --- a/modules/api/php/models/projectinstrumentsrow.class.inc +++ b/modules/api/php/models/projectinstrumentsrow.class.inc @@ -27,25 +27,26 @@ class ProjectInstrumentsRow implements \LORIS\Data\DataInstance private $_fullname; private $_subgroupname; private $_isDDE; + private $_ddeVisits; /** * Create a new ProjectImagesRow. * - * @param array $row An array of image properties + * @param array $row An array of image properties + * @param string $apiversion The version of the API being used */ - public function __construct(array $row) - { - $shortname = $row['shortname'] ?? null; - $ddeinstruments = array_keys(\Utility::getAllDDEInstruments()); + public function __construct( + array $row, + private string $apiversion = 'v0.0.3' + ) { + $this->_shortname = $row['shortname'] ?? null; + $this->_ddeVisits = \NDB_BVL_Battery::getDDEVisitsForInstrument( + $this->_shortname + ); - $this->_shortname = $shortname; $this->_fullname = $row['fullname'] ?? null; $this->_subgroupname = $row['subgroupname'] ?? null; - $this->_isDDE = in_array( - $shortname, - $ddeinstruments, - true - ); + $this->_isDDE = count($this->_ddeVisits) > 0; } /** @@ -88,6 +89,16 @@ class ProjectInstrumentsRow implements \LORIS\Data\DataInstance return $this->_isDDE; } + /** + * Accessor for ddeVisits. + * + * @return array + */ + public function getddeVisits(): array + { + return $this->_ddeVisits; + } + /** * Implements \LORIS\Data\DataInstance interface for this row. * @@ -95,11 +106,17 @@ class ProjectInstrumentsRow implements \LORIS\Data\DataInstance */ public function jsonSerialize() : array { - return [ + $obj = [ 'shortname' => $this->_shortname, 'fullname' => $this->_fullname, 'subgroup' => $this->_subgroupname, 'ddeenable' => $this->_isDDE, + 'ddevisits' => $this->_ddeVisits, ]; + if ($this->apiversion != 'v0.0.3') { + // api version >= v0.0.4 + $obj['ddevisits'] = $this->_ddeVisits; + } + return $obj; } } diff --git a/modules/api/php/views/project/instruments.class.inc b/modules/api/php/views/project/instruments.class.inc index c117d463404..49a3ceb0c8f 100644 --- a/modules/api/php/views/project/instruments.class.inc +++ b/modules/api/php/views/project/instruments.class.inc @@ -45,9 +45,13 @@ class Instruments * * @param \Project $project The requested project * @param ProjectInstrumentsRow[] $instruments An array of ProjectInstrumentsRow + * @param string $apiversion The version of the API being used */ - public function __construct(\Project $project, array $instruments) - { + public function __construct( + \Project $project, + array $instruments, + private string $apiversion = 'v0.0.3' + ) { $this->_project = $project; $this->_instruments = $instruments; } @@ -70,6 +74,10 @@ class Instruments 'Subgroup' => $instrument->getSubgroupname(), 'DoubleDataEntryEnabled' => $instrument->isDDE(), ]; + if ($this->apiversion != 'v0.0.3') { + // >= v0.0.4 + $item['DoubleDataEntryVisits'] = $instrument->getddeVisits(); + } if (!is_null($shortname)) { $instruments[$shortname] = $item; diff --git a/modules/battery_manager/jsx/batteryManagerForm.js b/modules/battery_manager/jsx/batteryManagerForm.js index 7277ab11b38..6f0329c78b5 100644 --- a/modules/battery_manager/jsx/batteryManagerForm.js +++ b/modules/battery_manager/jsx/batteryManagerForm.js @@ -145,6 +145,14 @@ class BatteryManagerForm extends Component { max={127} // max value allowed by default column type of instr_order value={test.instrumentOrder} /> + diff --git a/modules/battery_manager/jsx/batteryManagerIndex.js b/modules/battery_manager/jsx/batteryManagerIndex.js index c93e8030d07..40b3be79693 100644 --- a/modules/battery_manager/jsx/batteryManagerIndex.js +++ b/modules/battery_manager/jsx/batteryManagerIndex.js @@ -336,6 +336,11 @@ class BatteryManagerIndex extends Component { name: 'instrumentOrder', type: 'text', }}, + {label: 'Double Data Entry Enabled', show: true, filter: { + name: 'DoubleDataEntryEnabled', + type: 'select', + options: options.DoubleDataEntryEnabled, + }}, {label: 'Active', show: true, filter: { name: 'active', type: 'select', @@ -365,6 +370,7 @@ class BatteryManagerIndex extends Component { test.centerId, test.firstVisit, test.instrumentOrder, + test.DoubleDataEntryEnabled, test.active, ]; }); @@ -420,7 +426,8 @@ class BatteryManagerIndex extends Component { test.cohort == testCheck.cohort && test.visitLabel == testCheck.visitLabel && test.centerId == testCheck.centerId && - test.firstVisit == testCheck.firstVisit + test.firstVisit == testCheck.firstVisit && + test.DoubleDataEntryEnabled == testCheck.DoubleDataEntryEnabled ) { duplicate = testCheck; } diff --git a/modules/battery_manager/php/test.class.inc b/modules/battery_manager/php/test.class.inc index 2c948025fca..f83fa27abb3 100644 --- a/modules/battery_manager/php/test.class.inc +++ b/modules/battery_manager/php/test.class.inc @@ -90,17 +90,19 @@ class Test implements public function toSQL() : array { return [ - 'ID' => $this->row['id'] ?? null, - 'Test_name' => $this->row['testName'] ?? null, - 'AgeMinDays' => $this->row['ageMinDays'] ?? null, - 'AgeMaxDays' => $this->row['ageMaxDays'] ?? null, - 'Stage' => $this->row['stage'] ?? null, - 'CohortID' => $this->row['cohort'] ?? null, - 'Visit_label' => $this->row['visitLabel'] ?? null, - 'CenterID' => $this->row['centerId'] ?? null, - 'firstVisit' => $this->row['firstVisit'] ?? null, - 'instr_order' => $this->row['instrumentOrder'] ?? null, - 'Active' => $this->row['active'] ?? null, + 'ID' => $this->row['id'] ?? null, + 'Test_name' => $this->row['testName'] ?? null, + 'AgeMinDays' => $this->row['ageMinDays'] ?? null, + 'AgeMaxDays' => $this->row['ageMaxDays'] ?? null, + 'Stage' => $this->row['stage'] ?? null, + 'CohortID' => $this->row['cohort'] ?? null, + 'Visit_label' => $this->row['visitLabel'] ?? null, + 'CenterID' => $this->row['centerId'] ?? null, + 'firstVisit' => $this->row['firstVisit'] ?? null, + 'DoubleDataEntryEnabled' => $this->row['DoubleDataEntryEnabled'] + ?? null, + 'instr_order' => $this->row['instrumentOrder'] ?? null, + 'Active' => $this->row['active'] ?? null, ]; } } diff --git a/modules/battery_manager/php/testendpoint.class.inc b/modules/battery_manager/php/testendpoint.class.inc index 2e18205844a..b3c17c3b0d9 100644 --- a/modules/battery_manager/php/testendpoint.class.inc +++ b/modules/battery_manager/php/testendpoint.class.inc @@ -219,7 +219,8 @@ class TestEndpoint extends \NDB_Page implements RequestHandlerInterface CohortID, Visit_label, CenterID, - firstVisit + firstVisit, + DoubleDataEntryEnabled as DDE_enabled FROM test_battery"; // Select duplicate entry from Test Battery $entries = $this->db->pselect($query, []); @@ -235,6 +236,7 @@ class TestEndpoint extends \NDB_Page implements RequestHandlerInterface && $testArray['Visit_label'] == $entry['Visit_label'] && $testArray['CenterID'] == $entry['CenterID'] && $testArray['firstVisit'] == $entry['firstVisit'] + && $testArray['DoubleDataEntryEnabled'] == $entry['DDE_enabled'] ) { return true; } diff --git a/modules/battery_manager/php/testoptionsendpoint.class.inc b/modules/battery_manager/php/testoptionsendpoint.class.inc index 77af508917c..6b2ba925349 100644 --- a/modules/battery_manager/php/testoptionsendpoint.class.inc +++ b/modules/battery_manager/php/testoptionsendpoint.class.inc @@ -64,15 +64,16 @@ class TestOptionsEndpoint extends \NDB_Page $this->loris->getDatabaseConnection() ); return [ - 'instruments' => \NDB_BVL_Instrument::getInstrumentNamesList( + 'instruments' => \NDB_BVL_Instrument::getInstrumentNamesList( $this->loris ), - 'stages' => $this->_getStageList(), - 'cohorts' => \Utility::getCohortList(null), - 'visits' => $visitController->getVisitlabels(), - 'sites' => \Utility::getSiteList(false), - 'firstVisit' => $this->_getYesNoList(), - 'active' => $this->_getYesNoList(), + 'stages' => $this->_getStageList(), + 'cohorts' => \Utility::getCohortList(null), + 'visits' => $visitController->getVisitlabels(), + 'sites' => \Utility::getSiteList(false), + 'firstVisit' => $this->_getYesNoList(), + 'DoubleDataEntryEnabled' => $this->_getYesNoList(), + 'active' => $this->_getYesNoList(), ]; } diff --git a/modules/battery_manager/php/testprovisioner.class.inc b/modules/battery_manager/php/testprovisioner.class.inc index 777e52e347c..2ee3944850e 100644 --- a/modules/battery_manager/php/testprovisioner.class.inc +++ b/modules/battery_manager/php/testprovisioner.class.inc @@ -51,6 +51,7 @@ class TestProvisioner extends \LORIS\Data\Provisioners\DBRowProvisioner b.Visit_label as visitLabel, p.CenterID as centerId, b.firstVisit, + b.DoubleDataEntryEnabled, b.instr_order as instrumentOrder, b.Active as active FROM test_battery b diff --git a/modules/battery_manager/test/BatteryManagerTest.php b/modules/battery_manager/test/BatteryManagerTest.php index ce7e9327206..06c482854d7 100644 --- a/modules/battery_manager/test/BatteryManagerTest.php +++ b/modules/battery_manager/test/BatteryManagerTest.php @@ -138,7 +138,7 @@ function testLoadsWithPermissionEdit() ); $this->safeClick( WebDriverBy::cssSelector( - "#dynamictable > tbody > tr:nth-child(1) > td:nth-child(13) > button" + "#dynamictable > tbody > tr:nth-child(1) > td:nth-child(14) > button" ) ); $bodyText = $this->safeFindElement( @@ -165,7 +165,7 @@ function testEditform() $this->safeGet($this->url . "/battery_manager/"); $this->safeClick( WebDriverBy::cssSelector( - "#dynamictable > tbody > tr > td:nth-child(13) > button" + "#dynamictable > tbody > tr > td:nth-child(14) > button" ) ); $this->safeClick( @@ -209,7 +209,7 @@ function testEditform() $this->safeClick( WebDriverBy::cssSelector( "#lorisworkspace>div>div:nth-child(2)>div>div:nth-child(2)>form>". - " div > div:nth-child(11) > div > div > button" + " div > div:nth-child(12) > div > div > button" ) ); $bodyText = $this->safeFindElement( @@ -264,7 +264,7 @@ function testAddNew() $this->safeClick( WebDriverBy::cssSelector( "#lorisworkspace > div >div:nth-child(2)>div>div:nth-child(2)>form ". - "> div > div:nth-child(11) > div > div > button" + "> div > div:nth-child(12) > div > div > button" ) ); $bodyText = $this->safeFindElement( @@ -286,7 +286,7 @@ function testActivebtn() $this->safeGet($this->url . "/battery_manager/"); $this->safeClick( WebDriverBy::cssSelector( - "#dynamictable > tbody > tr:nth-child(1) > td:nth-child(12) > button" + "#dynamictable > tbody > tr:nth-child(1) > td:nth-child(13) > button" ) ); $bodyText = $this->safeFindElement( diff --git a/modules/behavioural_qc/php/provisioners/incompleteprovisioner.class.inc b/modules/behavioural_qc/php/provisioners/incompleteprovisioner.class.inc index 57ab07a50cd..f22f3096846 100644 --- a/modules/behavioural_qc/php/provisioners/incompleteprovisioner.class.inc +++ b/modules/behavioural_qc/php/provisioners/incompleteprovisioner.class.inc @@ -22,22 +22,6 @@ class IncompleteProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner */ function __construct() { - $config =& \NDB_Config::singleton(); - $ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); - $db = \NDB_Factory::singleton()->database(); - for ($i=0; $iquote($ddeInstruments[$i]); - } - $where = " - AND (f.commentid NOT LIKE 'DDE_%') - "; - if (count($ddeInstruments) > 0) { - $ddeInstruments = implode(',', $ddeInstruments); - $where = " - AND (t.test_name IN ($ddeInstruments) OR - f.commentid NOT LIKE 'DDE_%') - "; - } parent::__construct( " SELECT DISTINCT @@ -59,13 +43,20 @@ class IncompleteProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner JOIN candidate c ON (c.candid = s.candid) JOIN test_names t ON (t.ID = f.TestID) JOIN psc ON (s.CenterID = psc.CenterID) + JOIN test_battery ON ( + t.Test_name = test_battery.Test_name + AND test_battery.Visit_label = s.Visit_label + ) WHERE s.Active = 'Y' AND c.Active = 'Y' AND coalesce(f.data_entry, 'In Progress') = 'In Progress' AND psc.Centerid != '1' AND c.Entity_type != 'Scanner' - $where + AND ( + test_battery.DoubleDataEntryEnabled = 'Y' + OR f.commentid NOT LIKE 'DDE_%' + ) ORDER BY f.commentid ", diff --git a/modules/instrument_list/php/instrument_list.class.inc b/modules/instrument_list/php/instrument_list.class.inc index ec27597d6d1..c613cdc95a5 100644 --- a/modules/instrument_list/php/instrument_list.class.inc +++ b/modules/instrument_list/php/instrument_list.class.inc @@ -223,9 +223,6 @@ class Instrument_List extends \NDB_Menu_Filter $status = new \NDB_BVL_InstrumentStatus($this->loris); $status->select($instrument['CommentID']); - $ddeStatus = new \NDB_BVL_InstrumentStatus($this->loris); - $ddeStatus->select($instrument['DDECommentID']); - $Ins = "instruments"; $ins = $instrument['Full_name']; @@ -245,15 +242,22 @@ class Instrument_List extends \NDB_Menu_Filter $this->tpl_data[$Ins][$x][$i]['commentID'] = $ins; $ins = \NDB_BVL_Battery::isDoubleDataEntryEnabledForInstrument( + $this->timePoint->getVisitLabel(), $instrument['Test_name'] ); + $this->tpl_data[$Ins][$x][$i]['isDdeEnabled'] = $ins; - $ins = $instrument['DDECommentID']; - $this->tpl_data[$Ins][$x][$i]['ddeCommentID'] = $ins; + if ($ins) { + $ddeStatus = new \NDB_BVL_InstrumentStatus($this->loris); + $ddeStatus->select($instrument['DDECommentID']); - $ins = $ddeStatus->getDataEntryStatus(); - $this->tpl_data[$Ins][$x][$i]['ddeDataEntryStatus'] = $ins; + $ins = $instrument['DDECommentID']; + $this->tpl_data[$Ins][$x][$i]['ddeCommentID'] = $ins; + + $ins = $ddeStatus->getDataEntryStatus(); + $this->tpl_data[$Ins][$x][$i]['ddeDataEntryStatus'] = $ins; + } $ins = $instrument['isDirectEntry']; $this->tpl_data[$Ins][$x][$i]['isDirectEntry'] = $ins; diff --git a/modules/instrument_list/php/instrument_list_controlpanel.class.inc b/modules/instrument_list/php/instrument_list_controlpanel.class.inc index 7f30bca6a36..0e50c271e89 100644 --- a/modules/instrument_list/php/instrument_list_controlpanel.class.inc +++ b/modules/instrument_list/php/instrument_list_controlpanel.class.inc @@ -133,8 +133,6 @@ class Instrument_List_ControlPanel extends \TimePoint && in_array($currentStage, ['Visit', 'Screening']) && $currentStatus != 'In Progress' ) { - $config = \NDB_Config::singleton(); - // Send to DCC - set Submitted to Y $this->setData( [ @@ -169,9 +167,11 @@ class Instrument_List_ControlPanel extends \TimePoint $batteryList = $battery->getBatteryVerbose(); // Get the list of DDE instruments - $config =& \NDB_Config::singleton(); - $ddeInstruments = $config->getSetting( - 'DoubleDataEntryInstruments' + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList( + $this->loris, + $this->getData('Visit_label') + ) ); // clear the unresolved conflicts for all the instruments @@ -235,9 +235,11 @@ class Instrument_List_ControlPanel extends \TimePoint // get the list of instruments $batteryList = $battery->getBatteryVerbose(); // Get the list of DDE instruments - $config =& \NDB_Config::singleton(); - $ddeInstruments = $config->getSetting( - 'DoubleDataEntryInstruments' + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList( + $this->loris, + $this->getData('Visit_label') + ) ); // detect conflicts for all the instruments @@ -371,8 +373,12 @@ class Instrument_List_ControlPanel extends \TimePoint $batteryList = $battery->getBatteryVerbose(); // Get the list of DDE instruments - $config = \NDB_Config::singleton(); - $ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList( + $this->loris, + $this->getData('Visit_label') + ) + ); // loop the list and check the Data Entry status $ddeConflictDetected = false; @@ -581,8 +587,12 @@ class Instrument_List_ControlPanel extends \TimePoint $batteryList = $battery->getBatteryVerbose(); // Get the list of DDE instruments - $config =& \NDB_Config::singleton(); - $ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList( + $this->loris, + $this->getData('Visit_label') + ) + ); // clear the unresolved conflicts for all the instruments $allDataEntryComplete =true; @@ -678,7 +688,12 @@ class Instrument_List_ControlPanel extends \TimePoint $batteryList = $battery->getBatteryVerbose(); // Get the list of DDE instruments - $ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList( + $this->loris, + $this->getData('Visit_label') + ) + ); // clear the unresolved conflicts for all the instruments $allDataEntryComplete =true; diff --git a/php/libraries/NDB_BVL_Battery.class.inc b/php/libraries/NDB_BVL_Battery.class.inc index a0afb5fbec3..b6352446f2c 100644 --- a/php/libraries/NDB_BVL_Battery.class.inc +++ b/php/libraries/NDB_BVL_Battery.class.inc @@ -203,8 +203,9 @@ class NDB_BVL_Battery throw new \LorisException("Invalid instrument"); } - // get SessionID, UserID - $query = "SELECT ID as SessionID, UserID FROM session WHERE ID=:SID"; + // get SessionID, UserID, Visit_label + $query = "SELECT ID as SessionID, UserID, Visit_label + FROM session WHERE ID=:SID"; $rows = $DB->pselect($query, ['SID' => $this->sessionID]); if (count($rows)==0) { throw new Exception( @@ -222,12 +223,18 @@ class NDB_BVL_Battery // instantiate instrument object to get table name attribute $obj = NDB_BVL_Instrument::factory($loris, $testName, '', ''); + $DDEEnabled = $this->isDoubleDataEntryEnabledForInstrument( + $sessionData['Visit_label'], + $testName + ); if ($obj->usesJSONdata() !== true) { // insert into the test table $DB->insert($obj->table, ['CommentID' => $commentID]); // insert the dde into the test table - $DB->insert($obj->table, ['CommentID' => $ddeCommentID]); + if ($DDEEnabled) { + $DB->insert($obj->table, ['CommentID' => $ddeCommentID]); + } } $testId = $DB->pselectOne( @@ -246,15 +253,17 @@ class NDB_BVL_Battery ); // insert the dde into the flag table - $DB->insert( - 'flag', - [ - 'SessionID' => $sessionData['SessionID'], - 'TestID' => $testId, - 'CommentID' => $ddeCommentID, - 'UserID' => $sessionData['UserID'], - ] - ); + if ($DDEEnabled) { + $DB->insert( + 'flag', + [ + 'SessionID' => $sessionData['SessionID'], + 'TestID' => $testId, + 'CommentID' => $ddeCommentID, + 'UserID' => $sessionData['UserID'], + ] + ); + } return $commentID ?? ''; } // end addInstrument() @@ -366,24 +375,52 @@ class NDB_BVL_Battery return iterator_to_array($rows); } - /** * Checks if a test_name has double data entry enabled in the config * for this Loris instance. * - * @param string $instrumentName The test_name that we want to know if - * we're using DDE for. + * @param string $Visit_label The Visit_label that we want to + * check if DDE is enabled for. + * @param string $Test_name The test_name that we want to + * check if DDE is enabled for. * * @return boolean true if double data entry is enabled for this instrument */ - static function isDoubleDataEntryEnabledForInstrument($instrumentName) - { - - $config =& NDB_Config::singleton(); - $doubleDataEntryInstruments - = $config->getSetting("DoubleDataEntryInstruments"); + static function isDoubleDataEntryEnabledForInstrument( + String $Visit_label, + String $Test_name + ) : bool { + $DB = \NDB_Factory::singleton()->database(); + $ans = $DB->pselectOne( + 'SELECT DISTINCT DoubleDataEntryEnabled + FROM test_battery + WHERE Visit_label=:Visit_label + AND Test_name=:Test_name', + ['Visit_label' => $Visit_label, 'Test_name' => $Test_name] + ) == 'Y' ? true : false; + + return $ans; + } - return in_array($instrumentName, $doubleDataEntryInstruments); + /** + * Get the visits with DDE enabled for an instrument + * + * @param string $Test_name The test_name that we want to + * find DDE visits for. + * + * @return array with the Visit_labels + */ + static function getDDEVisitsForInstrument( + String $Test_name + ) : array { + $DB = \NDB_Factory::singleton()->database(); + return $DB->pselectCol( + "SELECT DISTINCT Visit_label + FROM test_battery + WHERE Test_name=:Test_name + AND DoubleDataEntryEnabled = 'Y'", + [':Test_name' => $Test_name] + ); } /** diff --git a/php/libraries/NDB_BVL_Instrument.class.inc b/php/libraries/NDB_BVL_Instrument.class.inc index 5babc30ebcf..2c184bdac07 100644 --- a/php/libraries/NDB_BVL_Instrument.class.inc +++ b/php/libraries/NDB_BVL_Instrument.class.inc @@ -3347,20 +3347,35 @@ abstract class NDB_BVL_Instrument extends NDB_Page * array with format $testName => $fullName. Only Names of instruments which are * instantiable are returned, invalid instruments will not appear in this list. * - * @param \LORIS\LorisInstance $loris The LORIS instance to get the DDE from + * @param \LORIS\LorisInstance $loris The LORIS instance to get DDE from + * @param ?string $Visit_label The visit label to get the DDE for if + * null all DDE instruments are returned * * @return array * @throws DatabaseException */ - static function getDDEInstrumentNamesList(\LORIS\LorisInstance $loris) : array - { - $config = $loris->getConfiguration(); + static function getDDEInstrumentNamesList( + \LORIS\LorisInstance $loris, + String $Visit_label=null + ) : array { + $DB = $loris->getDatabaseConnection(); $instrumentNamesList = self::getInstrumentNamesList($loris); - $doubleDataEntryInstruments = $config->getSetting( - 'DoubleDataEntryInstruments' - ); + if (empty($Visit_label)) { + $doubleDataEntryInstruments = $DB->pselectCol( + "SELECT DISTINCT Test_name FROM test_battery + WHERE DoubleDataEntryEnabled='Y'", + [] + ); + } else { + $doubleDataEntryInstruments = $DB->pselectCol( + "SELECT DISTINCT Test_name FROM test_battery + WHERE DoubleDataEntryEnabled='Y' + AND Visit_label = :Visit_label", + ['Visit_label' => $Visit_label] + ); + } $instrumentNames = []; foreach ($instrumentNamesList as $testName => $fullName) { diff --git a/php/libraries/Utility.class.inc b/php/libraries/Utility.class.inc index 108c733a8f4..7fa90d90bb2 100644 --- a/php/libraries/Utility.class.inc +++ b/php/libraries/Utility.class.inc @@ -580,24 +580,18 @@ class Utility most accurate Full_name value and should be replaced by getDDEInstrumentNamesList() of the NDB_BVL_Instrument class." ); - $Factory = \NDB_Factory::singleton(); - $DB = $Factory->Database(); - $config = $Factory->config(); - $instruments_q = $DB->pselect( - "SELECT Test_name,Full_name FROM test_names", + $Factory = \NDB_Factory::singleton(); + $DB = $Factory->Database(); + $ddeInstruments = $DB->pselect( + "SELECT DISTINCT test_battery.Test_name, Full_name + FROM test_battery + JOIN test_names ON test_battery.Test_name = test_names.Test_name + WHERE DoubleDataEntryEnabled = 'Y'", [] ); - $doubleDataEntryInstruments = $config->getSetting( - 'DoubleDataEntryInstruments' - ); - - $instruments = []; - foreach ($instruments_q as $row) { - if (isset($row['Test_name']) && isset($row['Full_name'])) { - if (in_array($row['Test_name'], $doubleDataEntryInstruments)) { - $instruments[$row['Test_name']] = $row['Full_name']; - } - } + $instruments = []; + foreach ($ddeInstruments as $instrument) { + $instruments[$instrument['Test_name']] = $instrument['Full_name']; } return $instruments; } diff --git a/raisinbread/RB_files/RB_Config.sql b/raisinbread/RB_files/RB_Config.sql index f7e70e6de08..7a91dd3186f 100644 --- a/raisinbread/RB_files/RB_Config.sql +++ b/raisinbread/RB_files/RB_Config.sql @@ -60,11 +60,6 @@ INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (65,83,'t1'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (66,84,'19'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (67,85,'/opt/niak-0.6.4.1/'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (68,86,'INTERLACE_outputDWIFileNameSuffix'); -INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (69,18,'aosi'); -INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (70,18,'bmi'); -INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (72,18,'medical_history'); -INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (73,18,'mri_parameter_form'); -INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (74,18,'radiology_review'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (75,87,'/issue_tracker'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (76,88,'localizer'); INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (77,88,'scout'); diff --git a/raisinbread/RB_files/RB_ConfigSettings.sql b/raisinbread/RB_files/RB_ConfigSettings.sql index a9cc60a3cf1..6e5137f91f3 100644 --- a/raisinbread/RB_files/RB_ConfigSettings.sql +++ b/raisinbread/RB_files/RB_ConfigSettings.sql @@ -16,7 +16,6 @@ INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMult INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (14,'useProband','Enable for proband data collection',1,0,'boolean',1,'Use proband',11); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (16,'useScreening','Enable if there is a Screening stage with its own distinct instruments, administered before the Visit stage',1,0,'boolean',1,'Use screening',14); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (17,'excluded_instruments','Instruments to be excluded from the Data Dictionary and download via the Data Query Tool',1,1,'instrument',1,'Excluded instruments',16); -INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (18,'DoubleDataEntryInstruments','Instruments for which double data entry should be enabled',1,1,'instrument',1,'Double data entry instruments',17); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (19,'InstrumentResetting','Allows resetting of instrument data',1,0,'boolean',1,'Instrument Resetting',18); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (20,'SupplementalSessionStatus','Display supplemental session status information on Timepoint List page',1,0,'boolean',1,'Use Supplemental Session Status',19); INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (21,'useScanDone','Used for identifying timepoints that have (or should have) imaging data',1,0,'boolean',1,'Use Scan Done',20); diff --git a/raisinbread/RB_files/RB_test_battery.sql b/raisinbread/RB_files/RB_test_battery.sql index 8322d3653b0..7c2d6fba0b2 100644 --- a/raisinbread/RB_files/RB_test_battery.sql +++ b/raisinbread/RB_files/RB_test_battery.sql @@ -2,38 +2,38 @@ SET FOREIGN_KEY_CHECKS=0; TRUNCATE TABLE `test_battery`; LOCK TABLES `test_battery` WRITE; -- AgeMaxDays maximum value is 99999 -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (131,'aosi',1,43800,'Y','Visit',NULL,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (132,'aosi',1,4299,'Y','Visit',NULL,'V2',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (133,'aosi',4300,43800,'Y','Visit',NULL,'V3',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (134,'radiology_review',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (135,'radiology_review',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (136,'radiology_review',1,43800,'Y','Visit',1,'V2',2,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (137,'radiology_review',1,43800,'Y','Visit',2,'V2',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (138,'mri_parameter_form',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (139,'mri_parameter_form',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (140,'mri_parameter_form',1,43800,'Y','Visit',3,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (141,'mri_parameter_form',1,43800,'Y','Visit',4,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (142,'mri_parameter_form',1,43800,'Y','Visit',1,'V2',2,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (143,'mri_parameter_form',1,43800,'Y','Visit',2,'V2',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (144,'mri_parameter_form',1,43800,'Y','Visit',3,'V2',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (145,'mri_parameter_form',1,43800,'Y','Visit',4,'V2',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (146,'mri_parameter_form',1,43800,'Y','Visit',1,'V3',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (147,'mri_parameter_form',1,43800,'Y','Visit',2,'V3',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (148,'mri_parameter_form',1,43800,'Y','Visit',3,'V3',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (149,'mri_parameter_form',1,43800,'Y','Visit',4,'V3',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (150,'mri_parameter_form',1,43800,'Y','Visit',3,'V4',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (151,'mri_parameter_form',1,43800,'Y','Visit',4,'V4',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (152,'mri_parameter_form',1,43800,'Y','Visit',3,'V5',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (153,'mri_parameter_form',1,43800,'Y','Visit',4,'V5',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (154,'mri_parameter_form',1,43800,'Y','Visit',3,'V6',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (155,'mri_parameter_form',1,43800,'Y','Visit',4,'V6',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (156,'medical_history',1,43800,'Y','Visit',NULL,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (157,'medical_history',1,43800,'Y','Visit',NULL,'V2',NULL,'Y',NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (158,'medical_history',1,43800,'N','Visit',NULL,'V3',NULL,'N',NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (159,'medical_history',1,43800,'Y','Visit',NULL,'V4',NULL,'N',NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (160,'medical_history',1,43800,'Y','Visit',NULL,'V5',NULL,'N',NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (161,'medical_history',1,43800,'Y','Visit',NULL,'V6',NULL,'N',NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (162,'bmi',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL); -INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`) VALUES (163,'bmi',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (131,'aosi',1,43800,'Y','Visit',NULL,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (132,'aosi',1,4299,'Y','Visit',NULL,'V2',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (133,'aosi',4300,43800,'Y','Visit',NULL,'V3',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (134,'radiology_review',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (135,'radiology_review',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (136,'radiology_review',1,43800,'Y','Visit',1,'V2',2,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (137,'radiology_review',1,43800,'Y','Visit',2,'V2',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (138,'mri_parameter_form',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (139,'mri_parameter_form',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (140,'mri_parameter_form',1,43800,'Y','Visit',3,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (141,'mri_parameter_form',1,43800,'Y','Visit',4,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (142,'mri_parameter_form',1,43800,'Y','Visit',1,'V2',2,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (143,'mri_parameter_form',1,43800,'Y','Visit',2,'V2',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (144,'mri_parameter_form',1,43800,'Y','Visit',3,'V2',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (145,'mri_parameter_form',1,43800,'Y','Visit',4,'V2',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (146,'mri_parameter_form',1,43800,'Y','Visit',1,'V3',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (147,'mri_parameter_form',1,43800,'Y','Visit',2,'V3',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (148,'mri_parameter_form',1,43800,'Y','Visit',3,'V3',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (149,'mri_parameter_form',1,43800,'Y','Visit',4,'V3',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (150,'mri_parameter_form',1,43800,'Y','Visit',3,'V4',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (151,'mri_parameter_form',1,43800,'Y','Visit',4,'V4',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (152,'mri_parameter_form',1,43800,'Y','Visit',3,'V5',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (153,'mri_parameter_form',1,43800,'Y','Visit',4,'V5',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (154,'mri_parameter_form',1,43800,'Y','Visit',3,'V6',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (155,'mri_parameter_form',1,43800,'Y','Visit',4,'V6',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (156,'medical_history',1,43800,'Y','Visit',NULL,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (157,'medical_history',1,43800,'Y','Visit',NULL,'V2',NULL,'Y',NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (158,'medical_history',1,43800,'N','Visit',NULL,'V3',NULL,'N',NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (159,'medical_history',1,43800,'Y','Visit',NULL,'V4',NULL,'N',NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (160,'medical_history',1,43800,'Y','Visit',NULL,'V5',NULL,'N',NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (161,'medical_history',1,43800,'Y','Visit',NULL,'V6',NULL,'N',NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (162,'bmi',1,43800,'Y','Visit',1,'V1',NULL,NULL,NULL, 'Y'); +INSERT INTO `test_battery` (`ID`, `Test_name`, `AgeMinDays`, `AgeMaxDays`, `Active`, `Stage`, `CohortID`, `Visit_label`, `CenterID`, `firstVisit`, `instr_order`, `DoubleDataEntryEnabled`) VALUES (163,'bmi',1,43800,'Y','Visit',2,'V1',NULL,NULL,NULL, 'Y'); UNLOCK TABLES; SET FOREIGN_KEY_CHECKS=1; diff --git a/raisinbread/instruments/instrument_sql/Meta/aosi_meta.sql b/raisinbread/instruments/instrument_sql/Meta/aosi_meta.sql index c2998a118e1..7159f13adcc 100644 --- a/raisinbread/instruments/instrument_sql/Meta/aosi_meta.sql +++ b/raisinbread/instruments/instrument_sql/Meta/aosi_meta.sql @@ -4,7 +4,7 @@ INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_num INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES('aosi', 'aosi_page2', 'General Observations', 2); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V1'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V2'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V3'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V1', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V2', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('aosi', 1, 2147483647, 'Y', 'Visit', NULL, 'V3', 'Y'); diff --git a/raisinbread/instruments/instrument_sql/Meta/bmi_meta.sql b/raisinbread/instruments/instrument_sql/Meta/bmi_meta.sql index 7076c3e20f2..2ab3660c2f6 100644 --- a/raisinbread/instruments/instrument_sql/Meta/bmi_meta.sql +++ b/raisinbread/instruments/instrument_sql/Meta/bmi_meta.sql @@ -1,27 +1,27 @@ INSERT INTO test_names (Test_name, Full_name, Sub_group) SELECT 'bmi', 'BMI Calculator', ID FROM test_subgroups WHERE Subgroup_name = 'Instruments'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'bmi', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6', 'Y' FROM cohort WHERE title = 'Stale'; diff --git a/raisinbread/instruments/instrument_sql/Meta/medical_history_meta.sql b/raisinbread/instruments/instrument_sql/Meta/medical_history_meta.sql index 9da322a09b4..112460310dd 100644 --- a/raisinbread/instruments/instrument_sql/Meta/medical_history_meta.sql +++ b/raisinbread/instruments/instrument_sql/Meta/medical_history_meta.sql @@ -1,12 +1,12 @@ INSERT INTO test_names (Test_name, Full_name, Sub_group) SELECT 'medical_history', 'Medical History', ID FROM test_subgroups WHERE Subgroup_name = 'Instruments'; -INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES('medical_history', 'medical_history_page1', 'Page 1', 1); +INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES('medical_history', 'medical_history_page1', 'Page 1', 'Y'); INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES('medical_history', 'medical_history_page2', 'Page 2', 2); INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES('medical_history', 'medical_history_page3', 'Page 3', 3); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V1'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V2'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V3'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V4'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V5'); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V6'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V1', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V2', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V3', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V4', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V5', 'Y'); +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) VALUES('medical_history', 1, 2147483647, 'Y', 'Visit', NULL, 'V6', 'Y'); diff --git a/raisinbread/instruments/instrument_sql/Meta/mri_parameter_form_meta.sql b/raisinbread/instruments/instrument_sql/Meta/mri_parameter_form_meta.sql index b78fcb170cf..624d83885b6 100644 --- a/raisinbread/instruments/instrument_sql/Meta/mri_parameter_form_meta.sql +++ b/raisinbread/instruments/instrument_sql/Meta/mri_parameter_form_meta.sql @@ -2,39 +2,39 @@ INSERT INTO test_names (Test_name, Full_name, Sub_group) SELECT 'mri_parameter_f INSERT INTO instrument_subtests (Test_name, Subtest_name, Description, Order_number) VALUES ('mri_parameter_form', 'mri_parameter_form_page1', 'Page 1', 1); -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'High Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'High Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3' FROM cohort WHERE title = 'High Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4' FROM cohort WHERE title = 'High Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5' FROM cohort WHERE title = 'High Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6' FROM cohort WHERE title = 'Low Yeast'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V3', 'Y' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V4', 'Y' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V5', 'Y' FROM cohort WHERE title = 'High Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6', 'Y' FROM cohort WHERE title = 'Low Yeast'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'mri_parameter_form', 1, 2147483647, 'Y', 'Visit', CohortID, 'V6', 'Y' FROM cohort WHERE title = 'High Yeast'; diff --git a/raisinbread/instruments/instrument_sql/Meta/radiology_review_meta.sql b/raisinbread/instruments/instrument_sql/Meta/radiology_review_meta.sql index 3a84f19e023..b9bc0c214e2 100644 --- a/raisinbread/instruments/instrument_sql/Meta/radiology_review_meta.sql +++ b/raisinbread/instruments/instrument_sql/Meta/radiology_review_meta.sql @@ -1,10 +1,10 @@ INSERT INTO test_names (Test_name, Full_name, Sub_group) SELECT 'radiology_review', 'Radiology review', ID FROM test_subgroups WHERE Subgroup_name = 'Imaging'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1' FROM cohort WHERE title = 'Fresh'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Stale'; -INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label) - SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V1', 'Y' FROM cohort WHERE title = 'Fresh'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Stale'; +INSERT INTO test_battery (Test_name, AgeMinDays, AgeMaxDays, Active, Stage, CohortID, Visit_label, DoubleDataEntryEnabled) + SELECT 'radiology_review', 1, 2147483647, 'Y', 'Visit', CohortID, 'V2', 'Y' FROM cohort WHERE title = 'Fresh'; diff --git a/raisinbread/test/api/LorisApiProjectsTest.php b/raisinbread/test/api/LorisApiProjectsTest.php index e3481ae83a2..ee3a0f4ef3a 100644 --- a/raisinbread/test/api/LorisApiProjectsTest.php +++ b/raisinbread/test/api/LorisApiProjectsTest.php @@ -475,6 +475,12 @@ public function testGetProjectsProjectInstruments(): void ), 'boolean' ); + $this->assertSame( + gettype( + $projectsInstrArray['Instruments']['aosi']['DoubleDataEntryVisits'] + ), + 'array' + ); $this->assertArrayHasKey( 'Meta', diff --git a/test/RBdata.sql b/test/RBdata.sql index 077498b061b..2fb19139edb 100644 --- a/test/RBdata.sql +++ b/test/RBdata.sql @@ -1442,7 +1442,7 @@ UNLOCK TABLES; LOCK TABLES `test_battery` WRITE; DELETE FROM `test_battery`; /*!40000 ALTER TABLE `test_battery` DISABLE KEYS */; -INSERT INTO `test_battery` (ID,Test_name,AgeMinDays,AgeMaxDays,Active,Stage,CohortID,Visit_label,CenterID,firstVisit,instr_order) VALUES (1,'radiology_review',0,99999,'Y','Visit',1,'V1',1,NULL,NULL),(2,'radiology_review',0,99999,'Y','Visit',2,'V1',2,NULL,NULL),(3,'bmi',1,99999,'Y','Visit',1,'V1',NULL,NULL,1),(4,'bmi',1,99999,'Y','Visit',2,'V1',NULL,NULL,1),(5,'tsi',150,210,'Y','Visit',1,'',NULL,'Y',NULL),(6,'tsi',300,420,'Y','Visit',2,'',NULL,'Y',NULL),(7,'tsi',150,420,'Y','Visit',3,'',NULL,'Y',NULL),(8,'aosi',1,1000,'Y','Visit',NULL,NULL,NULL,NULL,NULL),(9,'HandPreference',420,99999,'Y','Visit',NULL,'',NULL,NULL,NULL); +INSERT INTO `test_battery` (ID,Test_name,AgeMinDays,AgeMaxDays,Active,Stage,CohortID,Visit_label,CenterID,firstVisit,instr_order,DoubleDataEntryEnabled) VALUES (1,'radiology_review',0,99999,'Y','Visit',1,'V1',1,NULL,NULL,'Y'),(2,'radiology_review',0,99999,'Y','Visit',2,'V1',2,NULL,NULL,'Y'),(3,'bmi',1,99999,'Y','Visit',1,'V1',NULL,NULL,1,'Y'),(4,'bmi',1,99999,'Y','Visit',2,'V1',NULL,NULL,1,'Y'),(5,'tsi',150,210,'Y','Visit',1,'',NULL,'Y',NULL,'Y'),(6,'tsi',300,420,'Y','Visit',2,'',NULL,'Y',NULL,'Y'),(7,'tsi',150,420,'Y','Visit',3,'',NULL,'Y',NULL,'Y'),(8,'aosi',1,1000,'Y','Visit',NULL,NULL,NULL,NULL,NULL,'Y'),(9,'HandPreference',420,99999,'Y','Visit',NULL,'',NULL,NULL,NULL,'Y'); /*!40000 ALTER TABLE `test_battery` ENABLE KEYS */; UNLOCK TABLES; diff --git a/test/integrationtests/BatteryLookup_Test.php b/test/integrationtests/BatteryLookup_Test.php index ab0262a1443..7e1af3bf21a 100644 --- a/test/integrationtests/BatteryLookup_Test.php +++ b/test/integrationtests/BatteryLookup_Test.php @@ -99,88 +99,95 @@ function setUp(): void "test_battery", [ [ - 'ID' => 1, - 'Test_name' => 'ActiveTestByAge', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 100, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 1, - 'Visit_label' => null, - 'CenterID' => null, - 'firstVisit' => null, + 'ID' => 1, + 'Test_name' => 'ActiveTestByAge', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 100, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 1, + 'Visit_label' => null, + 'CenterID' => null, + 'firstVisit' => null, + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 2, - 'Test_name' => 'ActiveTestByAge2', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 100, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 1, - 'Visit_label' => null, - 'CenterID' => '1', - 'firstVisit' => null, + 'ID' => 2, + 'Test_name' => 'ActiveTestByAge2', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 100, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 1, + 'Visit_label' => null, + 'CenterID' => '1', + 'firstVisit' => null, + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 3, - 'Test_name' => 'InactiveTest', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 0, - 'Active' => 'N', - 'Stage' => 'Visit', - 'CohortID' => 2, - 'Visit_label' => 'V01', - 'CenterID' => '1', - 'firstVisit' => null, + 'ID' => 3, + 'Test_name' => 'InactiveTest', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 0, + 'Active' => 'N', + 'Stage' => 'Visit', + 'CohortID' => 2, + 'Visit_label' => 'V01', + 'CenterID' => '1', + 'firstVisit' => null, + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 4, - 'Test_name' => 'ActiveTestByVisit', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 0, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 2, - 'Visit_label' => 'V01', - 'CenterID' => null, - 'firstVisit' => null, + 'ID' => 4, + 'Test_name' => 'ActiveTestByVisit', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 0, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 2, + 'Visit_label' => 'V01', + 'CenterID' => null, + 'firstVisit' => null, + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 5, - 'Test_name' => 'ActiveTestByVisit2', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 0, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 2, - 'Visit_label' => 'V01', - 'CenterID' => '1', - 'firstVisit' => null, + 'ID' => 5, + 'Test_name' => 'ActiveTestByVisit2', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 0, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 2, + 'Visit_label' => 'V01', + 'CenterID' => '1', + 'firstVisit' => null, + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 6, - 'Test_name' => 'ActiveTestByFirstVisit', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 100, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 1, - 'Visit_label' => null, - 'CenterID' => '1', - 'firstVisit' => 'Y', + 'ID' => 6, + 'Test_name' => 'ActiveTestByFirstVisit', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 100, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 1, + 'Visit_label' => null, + 'CenterID' => '1', + 'firstVisit' => 'Y', + 'DoubleDataEntryEnabled' => 'Y' ], [ - 'ID' => 7, - 'Test_name' => 'ActiveTestByNotFirstVisit', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 100, - 'Active' => 'Y', - 'Stage' => 'Visit', - 'CohortID' => 1, - 'Visit_label' => null, - 'CenterID' => '1', - 'firstVisit' => 'N', + 'ID' => 7, + 'Test_name' => 'ActiveTestByNotFirstVisit', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 100, + 'Active' => 'Y', + 'Stage' => 'Visit', + 'CohortID' => 1, + 'Visit_label' => null, + 'CenterID' => '1', + 'firstVisit' => 'N', + 'DoubleDataEntryEnabled' => 'Y' ], ] ); diff --git a/test/unittests/NDB_BVL_Instrument_Test.php b/test/unittests/NDB_BVL_Instrument_Test.php index 3da0e0c8ad7..905971d08fe 100644 --- a/test/unittests/NDB_BVL_Instrument_Test.php +++ b/test/unittests/NDB_BVL_Instrument_Test.php @@ -1957,11 +1957,12 @@ private function _setTableData() "test_battery", [ [ - 'Active' => 'Y', - 'Test_name' => 'TestName1_proband', - 'CohortID' => '12', - 'AgeMinDays' => 0, - 'AgeMaxDays' => 100 + 'Active' => 'Y', + 'Test_name' => 'TestName1_proband', + 'CohortID' => '12', + 'AgeMinDays' => 0, + 'AgeMaxDays' => 100, + 'DoubleDataEntryEnabled' => 'Y' ] ] ); diff --git a/test/unittests/UtilityTest.php b/test/unittests/UtilityTest.php index 446e0903dd3..a38a61348c6 100644 --- a/test/unittests/UtilityTest.php +++ b/test/unittests/UtilityTest.php @@ -414,22 +414,16 @@ public function testGetInstruments() */ public function testGetAllDDEInstruments() { - $test_names = [ - ['Test_name' => 'test_name1', - 'Full_name' => 'full_name1' - ], - ['Test_name' => 'test_name2', + $test_battery = [ + [ + 'Test_name' => 'test_name2', 'Full_name' => 'full_name2' ] ]; - $doubleDataEntryInstruments = ['test_name2']; $this->_dbMock->expects($this->any()) ->method('pselect') - ->willReturn($test_names); - $this->_configMock->expects($this->any()) - ->method('getSetting') - ->willReturn($doubleDataEntryInstruments); + ->willReturn($test_battery); $this->assertEquals( ['test_name2' => 'full_name2'], diff --git a/tools/data_integrity/data_deletion/delete_ignored_conflicts.php b/tools/data_integrity/data_deletion/delete_ignored_conflicts.php index d521af436eb..ebc6b007c09 100755 --- a/tools/data_integrity/data_deletion/delete_ignored_conflicts.php +++ b/tools/data_integrity/data_deletion/delete_ignored_conflicts.php @@ -68,7 +68,9 @@ $instruments[0] = $argv[1]; $instrumentSpecified = true; } else { - $instruments = $config->getSetting('DoubleDataEntryInstruments'); + $instruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList($loris) + ); } if (isset($instruments)) { diff --git a/tools/detect_conflicts.php b/tools/detect_conflicts.php index f3b6954b7c1..0e6e9142579 100755 --- a/tools/detect_conflicts.php +++ b/tools/detect_conflicts.php @@ -121,7 +121,9 @@ /// Initialization $config = NDB_Config::singleton(); $db = $lorisInstance->getDatabaseConnection(); -$ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); +$ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList($lorisInstance) +); $db_config = $config->getSetting('database'); $paths = $config->getSetting('paths'); $dataDir = $paths['base'] . $config->getSetting('log'); diff --git a/tools/detect_duplicated_commentids.php b/tools/detect_duplicated_commentids.php index d3da47da503..dbc4684548c 100755 --- a/tools/detect_duplicated_commentids.php +++ b/tools/detect_duplicated_commentids.php @@ -75,11 +75,9 @@ /** * Initialization */ -$config = NDB_Config::singleton(); -$ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); -$dataDir = "logs"; -$diff = null; -$commentids = []; +$dataDir = "logs"; +$diff = null; +$commentids = []; //Check to see if the variable instrument is set if (($instrument=='all') ||($instrument=='All')) { $instruments = Utility::getAllInstruments(); diff --git a/tools/recreate_conflicts.php b/tools/recreate_conflicts.php index ba66aafbb7e..48818f205e0 100755 --- a/tools/recreate_conflicts.php +++ b/tools/recreate_conflicts.php @@ -48,7 +48,9 @@ if ($action=='all') { $allInstruments = NDB_BVL_Instrument::getInstrumentNamesList($lorisInstance); - $ddeInstruments = $config->getSetting('DoubleDataEntryInstruments'); + $ddeInstruments = array_keys( + \NDB_BVL_Instrument::getDDEInstrumentNamesList($lorisInstance) + ); } else { $allInstruments = [$action => $action]; $ddeInstruments = [$action => $action];