Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace DoB/EDC with 'Derived Age'/'EDC Age' #8990

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
195cccb
Replace DoB/EDC with 'Derived Age'/'EDC Age'
Nov 30, 2023
e97f8a2
Changeing the instrument test
Dec 4, 2023
0337d8d
Replace 90000 with 300001
Dec 4, 2023
0d315d4
Revert the last chages on test_instrumentTest.php
Dec 5, 2023
3fd6e15
Replace the css code in candidate_profile
Dec 5, 2023
2e1bd80
Replace safeFindElement with safeClick
Dec 5, 2023
06d0019
modifing new changes
Dec 8, 2023
179df36
Adding DoB to configuration module
Dec 8, 2023
0736b50
Update instrument_list
Dec 14, 2023
67284b1
Adding DoB to RB_Config.sql
Dec 18, 2023
e4c65bc
Fix ConfigSettings for DoB
Dec 18, 2023
056b94f
Update instrument_html.tpl file under smarty
Dec 20, 2023
3cd3888
Update DoB
Feb 26, 2024
adcd615
Update the candidate Test
Feb 28, 2024
3131c21
Update raisinbread and test_instrument files
Apr 9, 2024
a602373
Merge branch 'main' into 2023-11-30_DoB_To_Derived_Age
GeorgeMurad Apr 9, 2024
fb821b1
Update RB_Config.sql
GeorgeMurad Apr 15, 2024
1992c80
change to 300001
kongtiaowang Apr 16, 2024
41a0fd5
fix
kongtiaowang Apr 16, 2024
3591288
fxi
kongtiaowang Apr 16, 2024
203d978
test
kongtiaowang Apr 16, 2024
dbec891
fix
kongtiaowang Apr 16, 2024
1254f71
debug
kongtiaowang Apr 16, 2024
d8f93d2
debug
kongtiaowang Apr 16, 2024
6b3216e
fix
kongtiaowang Apr 16, 2024
83f06d0
phpcs
kongtiaowang Apr 16, 2024
134cc42
phpcs
kongtiaowang Apr 16, 2024
42b8e8b
cs
kongtiaowang Apr 16, 2024
5eab4ba
debug
kongtiaowang Apr 16, 2024
1f62849
cs
kongtiaowang Apr 16, 2024
e6ebfee
rewrite
kongtiaowang Apr 16, 2024
cabdc02
phpcs
kongtiaowang Apr 16, 2024
0148aaa
final cs
kongtiaowang Apr 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion SQL/0000-00-03-ConfigTables.sql
Expand Up @@ -63,6 +63,7 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'dateDisplayFormat', 'The date format to use throughout LORIS for displaying date information - formats for date inputs are browser- and locale-dependent.', 1, 0, 'text', ID, 'Date display format', 28 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'adminContactEmail', 'An email address that users can write to in order to report issues or ask question', 1, 0, 'text', ID, 'Administrator Email', 29 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'UserMaximumDaysInactive', 'The maximum number of days since last login before making a user inactive', 1, 0, 'text', ID, 'Maximum Days Before Making User Inactive', 30 FROM ConfigSettings WHERE Name="study";
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useDoB', 'Use DoB (Date of Birth)', 1, 0, 'boolean', ID, 'Use DoB', 31 FROM ConfigSettings WHERE Name="study";

INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('paths', 'Specify directories where LORIS-related files are stored or created. Take care when editing these fields as changing them incorrectly can cause certain modules to lose functionality.', 1, 0, 'Paths', 2);
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'imagePath', 'Path to images for display in Imaging Browser (e.g. /data/$project/data/) ', 1, 0, 'text', ID, 'Images', 9 FROM ConfigSettings WHERE Name="paths";
Expand Down Expand Up @@ -188,6 +189,7 @@ INSERT INTO Config (ConfigID, Value) SELECT ID, "Example Study" FROM ConfigSetti
INSERT INTO Config (ConfigID, Value) SELECT ID, "<h3>Example Study Description</h3>\r\n <p>This is a sample description for this study, because it is a new LORIS install that has not yet customized this text.</p>\r\n <p>A LORIS administrator can customize this text in the configuration module, under the configuration option labeled \"Study Description\"</p>\r\n <h3>Useful Links</h3>\r\n <ul>\r\n <li><a href=\"https://github.com/aces/Loris\" >LORIS GitHub Repository</a></li>\r\n <li><a href=\"https://github.com/aces/Loris/wiki/Setup\" >LORIS Setup Guide</a></li>\r\n <li><a href=\"https://www.youtube.com/watch?v=2Syd_BUbl5A\" >A video of a loris on YouTube</a></li>\r\n </ul>" FROM ConfigSettings WHERE Name="StudyDescription";
INSERT INTO Config (ConfigID, Value) SELECT ID, "images/neurorgb_web.jpg" FROM ConfigSettings WHERE Name="studylogo";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useEDC";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useDoB";
INSERT INTO Config (ConfigID, Value) SELECT ID, 8 FROM ConfigSettings WHERE Name="ageMin";
INSERT INTO Config (ConfigID, Value) SELECT ID, 11 FROM ConfigSettings WHERE Name="ageMax";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useFamilyID";
Expand Down Expand Up @@ -288,4 +290,4 @@ INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Na
INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Name='bids_dataset_authors';
INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Name='bids_acknowledgments_text';
INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Name='bids_readme_text';
INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Name='bids_validator_options_to_ignore';
GeorgeMurad marked this conversation as resolved.
Show resolved Hide resolved
INSERT INTO Config (ConfigID, Value) SELECT ID, '' FROM ConfigSettings WHERE Name='bids_validator_options_to_ignore';
2 changes: 2 additions & 0 deletions SQL/New_patches/2023-12-08_useDoB.sql
@@ -0,0 +1,2 @@
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useDoB', 'Use DoB (Date of Birth)', 1, 0, 'boolean', ID, 'Use DoB', 31 FROM ConfigSettings WHERE Name="study";
INSERT INTO Config (ConfigID, Value) SELECT ID, "false" FROM ConfigSettings WHERE Name="useDoB";
43 changes: 11 additions & 32 deletions modules/candidate_profile/test/candidate_profileTest.php
Expand Up @@ -11,6 +11,7 @@
* @link https://github.com/aces/Loris
*/
use Facebook\WebDriver\WebDriverBy;

require_once __DIR__
. "/../../../test/integrationtests/LorisIntegrationTestWithCandidate.class.inc";
/**
Expand Down Expand Up @@ -91,45 +92,23 @@ function testCandidateProfileWithoutProjectPermissions()
$this->resetUserProject();
}
/**
* Test that the page instrument link works on card 2 section
* Test that the page instrument link works on card section
*
* @return void
*/
function testCandidateProfileInstrumentLink1()
function testCandidateProfileInstrumentLink()
{
$this->safeGet($this->url . "/candidate_profile/900000/");
$this->safeFindElement(
$this->setupPermissions(['superuser']);

$this->safeGet($this->url . "/candidate_profile/115788/");
$this->safeClick(
WebDriverBy::cssSelector(
"#card2 > div:nth-child(1) >".
"div:nth-child(1)>div:nth-child(1)>div:nth-child(1)>div:nth-".
"child(1)> div:nth-child(2) > h4:nth-child(1) > a:nth-child(1)"
'#card0 > div > div > div >'.
' dl > div:nth-child(9) > dd > div > a:nth-child(1)'
)
)->click();
$bodyText
= $this->safeFindElement(WebDriverBy::cssSelector("body"))
->getText();
$this->assertStringContainsString(
"Behavioural Battery of Instruments",
$bodyText
);
}
/**
* Test that the page instrument link works on card 1 section
*
* @return void
*/
function testCandidateProfileInstrumentLink2()
{
$this->safeGet($this->url . "/candidate_profile/900000/");
$this->safeFindElement(
WebDriverBy::cssSelector(
"#card0 > div:nth-child(1) >".
"div:nth-child(1)>div:nth-child(1)>dl:nth-child(1)>div:nth-".
"child(9)>dd:nth-child(2) > div:nth-child(1) > a:nth-child(1)"
)
)->click();
$bodyText
= $this->safeFindElement(WebDriverBy::cssSelector("body"))

$bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body"))
->getText();
$this->assertStringContainsString(
"Behavioural Battery of Instruments",
Expand Down
5 changes: 5 additions & 0 deletions modules/configuration/php/cohort.class.inc
Expand Up @@ -62,6 +62,11 @@ class Cohort extends \NDB_Form
'1' => 'Yes',
'0' => 'No',
];
$this->tpl_data['useDoBOptions']
= [
'1' => 'Yes',
'0' => 'No',
];

$this->tpl_data['WindowDifferenceOptions']
= [
Expand Down
20 changes: 20 additions & 0 deletions modules/instrument_list/php/instrument_list.class.inc
Expand Up @@ -297,6 +297,26 @@ class Instrument_List extends \NDB_Menu_Filter

$this->tpl_data['display']
= array_merge($this->candidate->getData(), $this->timePoint->getData());
// DoB to Derived Age
GeorgeMurad marked this conversation as resolved.
Show resolved Hide resolved
$dob = $this->candidate->getCandidateDoB();
if (is_string($dob) && strtotime($dob) !== false) {
$dob_date = new \DateTime($dob);
$current_date = new \DateTime();
$dob_year = abs($current_date->diff($dob_date)->y);
$dob_month = abs($current_date->diff($dob_date)->m);
$dob_age = $dob_year . " y / " . $dob_month . " m";
$this->tpl_data['dob_age'] = $dob_age;
}
// EDC to EDC Age
$edc = $this->candidate->getCandidateEDC();
if (is_string($edc) && strtotime($edc) !== false) {
$edc_date = new \DateTime($edc);
$current_date = new \DateTime();
$edc_year = abs($current_date->diff($edc_date)->y);
$edc_month = abs($current_date->diff($edc_date)->m);
$edc_age = $edc_year . " y / " . $edc_month . " m";
$this->tpl_data['edc_age'] = $edc_age;
}
}

/**
Expand Down
22 changes: 9 additions & 13 deletions modules/instrument_list/templates/menu_instrument_list.tpl
Expand Up @@ -5,13 +5,11 @@
<tr class="info">
{assign var="DoB" value=$candidate->getDisplayDoB()}
<th>
{$DoB['label']}
Derived Age
</th>
<th>
EDC Age
</th>
{if $display.EDC!=""}
<th>
EDC
</th>
{/if}
<th>
Biological Sex
</th>
Expand Down Expand Up @@ -69,13 +67,11 @@
<tbody>
<tr>
<td>
{$DoB['value']}
{$dob_age}
GeorgeMurad marked this conversation as resolved.
Show resolved Hide resolved
</td>
<td>
{$edc_age}
</td>
{if $display.EDC!=""}
<td>
{$display.EDC}
</td>
{/if}
<td>
{$display.Sex}
</td>
Expand Down Expand Up @@ -247,4 +243,4 @@
<button class="btn btn-primary" onclick="location.href='{$baseurl|default}/imaging_browser/viewSession/?sessionID={$sessionID}'">View Imaging data</button>
</div>
{/if}
</div>
</div>
25 changes: 24 additions & 1 deletion modules/timepoint_list/php/timepoint_list.class.inc
Expand Up @@ -80,8 +80,31 @@ class Timepoint_List extends \NDB_Menu
$this->tpl_data['candID'] = $this->candID;
$this->tpl_data['PSCID'] = $candidate->getPSCID();
$this->tpl_data['candidate'] = $candidate->getData();
$this->tpl_data['cand'] = $candidate;
// convert DoB date to age and months and rename it to Derived Age
$dob = $candidate->getData();
if (isset($dob['DoB']) && is_string($dob['DoB'])) {
$dob_date = date_create_from_format('Y-m-d', $dob['DoB']);
if ($dob_date !== false) {
$current_date = new \DateTime();
$dob_year = abs($current_date->diff($dob_date)->y);
$dob_month = abs($current_date->diff($dob_date)->m);
$dob_age = $dob_year . " y / " . $dob_month . " m";
$this->tpl_data['dob_age'] = $dob_age;
}

}
// convert EDC date to age and months and rename it to EDC Age
$edc = $candidate->getData();
if (isset($edc['EDC']) && is_string($edc['EDC'])) {
$edc_date = date_create_from_format('Y-m-d', $edc['EDC']);
if ($edc_date !== false) {
$current_date = new \DateTime();
$edc_year = abs($current_date->diff($edc_date)->y);
$edc_month = abs($current_date->diff($edc_date)->m);
$edc_age = $edc_year . " y / " . $edc_month . " m";
$this->tpl_data['edc_age'] = $edc_age;
}
}
$listOfSessionIDs = $candidate->getListOfTimePoints();

$user = \User::singleton();
Expand Down
23 changes: 9 additions & 14 deletions modules/timepoint_list/templates/menu_timepoint_list.tpl
Expand Up @@ -4,14 +4,11 @@
<thead>
<tr class="info">
<th>
{assign var="DoB" value=$cand->getDisplayDoB()}
{$DoB['label']}
Derived Age
</th>
<th>
EDC Age
</th>
{if $candidate.EDC!=""}
<th>
EDC
</th>
{/if}
<th>
Biological Sex
</th>
Expand All @@ -29,13 +26,11 @@
<tbody>
<tr>
<td>
{$DoB['value']}
{$dob_age}
</td>
<td>
{$edc_age}
</td>
{if $candidate.EDC!=""}
<td>
{$candidate.EDC}
</td>
{/if}
<td>
{$candidate.Sex}
</td>
Expand Down Expand Up @@ -159,4 +154,4 @@
<tr><td colspan="10">You do not have access to any timepoints registered for this candidate.</td></tr>
{/section}
</tbody>
</table>
</table>
21 changes: 21 additions & 0 deletions php/libraries/NDB_BVL_Instrument.class.inc
Expand Up @@ -390,6 +390,27 @@ abstract class NDB_BVL_Instrument extends NDB_Page

$this->tpl_data['candidate'] = $candidate->getData();
$this->tpl_data['timePoint'] = $timePoint->getData();
// convert DoB And EDC date to years and months
// DoB to Derived Age
$dob = $candidate->getCandidateDoB();
if (is_string($dob) && strtotime($dob) !== false) {
$dob_date = new \DateTime($dob);
$current_date = new \DateTime();
$dob_year = abs($current_date->diff($dob_date)->y);
$dob_month = abs($current_date->diff($dob_date)->m);
$dob_age = $dob_year . " y / " . $dob_month . " m";
$this->tpl_data['dob_age'] = $dob_age;
}
// EDC to EDC Age
$edc = $candidate->getCandidateEDC();
if (is_string($edc) && strtotime($edc) !== false) {
$edc_date = new DateTime($edc);
$current_date = new DateTime();
$edc_year = abs($current_date->diff($edc_date)->y);
$edc_month = abs($current_date->diff($edc_date)->m);
$edc_age = $edc_year . " y / " . $edc_month . " m";
$this->tpl_data['edc_age'] = $edc_age;
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions raisinbread/RB_files/RB_Config.sql
Expand Up @@ -111,6 +111,7 @@ INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (124,128,'');
INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (126,129,'365');
INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (127,130,'/var/www/loris/');
INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (128,131,'/data/EEGUploadIncomingPath/');
INSERT INTO `Config` (`ID`, `ConfigID`, `Value`) VALUES (129,132,'false');

UNLOCK TABLES;
SET FOREIGN_KEY_CHECKS=1;
5 changes: 2 additions & 3 deletions raisinbread/RB_files/RB_ConfigSettings.sql
Expand Up @@ -120,8 +120,7 @@ INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMult
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (128,'default_cohort','Default cohort used when creating scan visit',1,0,'text',69,'Default cohort',13);
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (129,'UserMaximumDaysInactive','The maximum number of days since last login before making a user inactive.',1,0,'text',1,'Maximum Days Before Making User Inactive',30);
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (130,'DownloadPath','Where files are downloaded',1,0,'text',26,'Downloads',4);
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (131,'EEGUploadIncomingPath','Path to the upload directory for incoming EEG studies',1,0,'text',45,'EEG Incoming Directory',15);
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (132,'EEGS3DataPath','EEG S3 data path for assembly data',1,0,'text',45,'EEG S3 data path',15);

INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (131,'EEGUploadIncomingPath', 'Path to the upload directory for incoming EEG studies', 1, 0, 'text', 26, 'EEG Incoming Directory', 15);
INSERT INTO `ConfigSettings` (`ID`, `Name`, `Description`, `Visible`, `AllowMultiple`, `DataType`, `Parent`, `Label`, `OrderNumber`) VALUES (132,'useDoB','Use DoB (Date of Birth)',1,0,'boolean',1,'Use DoB',12);
UNLOCK TABLES;
SET FOREIGN_KEY_CHECKS=1;
3 changes: 1 addition & 2 deletions raisinbread/test/api/LorisApiAuthenticatedTest.php
Expand Up @@ -235,10 +235,9 @@ public function tearDown(): void
"CenterID" => '4',
],
);

$this->DB->delete("flag", ['ID' => '999999']);
$this->DB->delete("session", ['CandID' => '900000']);
$this->DB->delete("candidate", ['CandID' => '900000']);
$this->DB->delete("flag", ['ID' => '999999']);
$this->DB->delete("test_names", ['ID' => '999999']);

$set = [
Expand Down
20 changes: 19 additions & 1 deletion raisinbread/test/api/LorisApiAuthenticated_v0_0_3_Test.php
Expand Up @@ -87,7 +87,25 @@ public function setUp(): void
'Active' => 'Y',
'UserID' => 1,
'Entity_type' => 'Human',
'Sex' => 'Female'
'Sex' => 'Female',
'ExternalID' => null,
'DoB' => '2003-10-31',
'DoD' => null,
'EDC' => '2003-11-30',
'Sex' => 'Male',
'Ethnicity' => null,
'Active' => 'Y',
'Date_active' => '2016-01-23',
'RegisteredBy' => null,
'Date_registered' => '2016-01-23',
'flagged_caveatemptor' => 'false',
'flagged_reason' => null,
'flagged_other' => null,
'flagged_other_status' => null,
'Testdate' => '2019-06-20 12:10:04',
'Entity_type' => 'Human',
'ProbandSex' => null,
'ProbandDoB' => null
]
);
$this->DB->insert(
Expand Down
22 changes: 11 additions & 11 deletions smarty/templates/instrument_html.tpl
Expand Up @@ -14,13 +14,11 @@
<thead>
<tr class="info">
<th>
DOB
Derived Age
</th>
<th>
EDC Age
</th>
{if $candidate.EDC!=""}
<th>
EDC
</th>
{/if}
<th>
Biological Sex
</th>
Expand Down Expand Up @@ -64,12 +62,14 @@
<!-- candidate data -->
<tbody>
<tr>
<td>
{$candidate.DoB}
</td>
{if $candidate.EDC!=""}
{if $dob_age!=""}
<td>
{$dob_age}
</td>
{/if}
{if $edc_age!=""}
<td>
{$candidate.EDC}
{$edc_age}
</td>
{/if}
<td>
Expand Down