Skip to content
Merged
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
82f861d
snprc - more jest changes - fixed build break
spamhurts Dec 6, 2018
44c1800
Item #4743: Update NPM build.
labkey-martyp Dec 11, 2018
af3fb3b
Item 4743: Missed a couple build targets
labkey-martyp Dec 11, 2018
849d576
snprc - additional work on CRUD operations
spamhurts Dec 11, 2018
c2c1988
snprc - Alopecia report removed from the behavior tab
spamhurts Dec 13, 2018
470e4d9
snprc - API changes
spamhurts Dec 13, 2018
c396e2e
Spec 36321: Updated layouts and accordion widget
labkey-martyp Dec 14, 2018
278fecd
snprc - Better filtering for research projects
spamhurts Dec 14, 2018
df6af9d
snprc - changed delete datasource for clinpath ETLs
spamhurts Dec 17, 2018
5dd63c9
snprc - changed Action permission to fix test
spamhurts Dec 17, 2018
6586595
snprc - Fixed type
spamhurts Dec 18, 2018
8e925fc
snprc - Added tests for access rights
spamhurts Dec 28, 2018
032ec83
Spec 36321: Procedure scheduler timeline grid
labkey-martyp Jan 3, 2019
96eb53d
snprc - added test setup code
spamhurts Jan 3, 2019
d90245a
snprc - Bug fix for TimelineProjectItems missing from Timeline json
spamhurts Jan 3, 2019
b62fbac
snprc - changed user name to user display name
spamhurts Jan 4, 2019
3358d80
Spec 36321: Procedure Scheduling Timeline
labkey-martyp Jan 8, 2019
3a2199f
snprc - Additional automated testing and bug fix
spamhurts Jan 9, 2019
94b5465
Added data validator class
charlesp210 Jan 9, 2019
e36e449
Timeline grid bug fix
labkey-martyp Jan 10, 2019
b83461b
snprc snprc_scheduler added column RC to timeline table
Jan 10, 2019
c508347
snprc - Additional timeline test cases + added study import
spamhurts Jan 11, 2019
42cc6ee
snprc - Added API support for RC column addition to Timeline table
spamhurts Jan 11, 2019
832f120
snprc - fixed typo
spamhurts Jan 11, 2019
cdd0072
snprc - Changes to controller redirect action
spamhurts Jan 24, 2019
1255dbb
snprc - Bug fixes in animal groups
spamhurts Jan 25, 2019
20c1ee7
snprc Changed Location to display cage as int
Jan 25, 2019
77c914a
snprc typo fixed. Changed Location to display cage as int
Jan 25, 2019
085313d
Spec 36321: Timeline save/cancel
labkey-martyp Jan 26, 2019
02e55a9
Update tests
labkey-martyp Jan 26, 2019
2f6e4d2
Update current location query
labkey-martyp Jan 28, 2019
ea6e268
Merge branch 'develop' into fb_snprc_scheduler_dev_server
labkey-martyp Jan 28, 2019
33e9f63
Update SNPRC test
labkey-martyp Jan 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ assaydata
/snprc_ehr/resources/referenceStudy/kinship.txt
snprc_scheduler/resources/web/snprc_scheduler/app/app.js
/snprc_ehr/resources/referenceStudy/*.log
app
/snprc_scheduler/resources/web/snprc_scheduler/app
snprc_scheduler/resources/web/snprc_scheduler/app/app.js
*.iml
1 change: 0 additions & 1 deletion snprc_ehr/resources/data/reports.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ clinObsBsu Behavior js Observations true study underDevelopment BSU Observation
clinremarks Clinical query Clinical Remarks true study Clinical Remarks date false false qcstate/publicdata This report contains the clinical remarks entered about each animal
Alopecia Clinical query Alopecia Scores true study Alopecia date false false qcstate/publicdata This report contains the alopecia scores for the animal
behaviorRemarks Behavior js Behavior Remarks true study underDevelopment Behavior Remarks date false false qcstate/publicdata This report contains the behavior remarks entered about each animal
Alopecia Behavior query Alopecia Scores true study Alopecia date false false qcstate/publicdata This report contains the alopecia scores for the anima
drug Behavior js Behavior Treatments true study underDevelopment Behavior Treatments date false false qcstate/publicdata This report contains the behavior treatments entered about each animal
treatments Clinical query Therapies true study Treatment Orders Therapies date false false qcstate/publicdata Contains a list of all orders for treatments
diets General query Diet History true study dietHistory DietHistory date false false qcstate/publicdata Contains a list of all orders for treatments
Expand Down
60 changes: 49 additions & 11 deletions snprc_ehr/resources/queries/snprc_ehr/animal_groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

require("ehr/triggers").initScript(this);
var snprcTriggerHelper = new org.labkey.snprc_ehr.query.SNPRC_EHRTriggerHelper(LABKEY.Security.currentUser.id, LABKEY.Security.currentContainer.id);
let snprcTriggerHelper = new org.labkey.snprc_ehr.query.SNPRC_EHRTriggerHelper(LABKEY.Security.currentUser.id, LABKEY.Security.currentContainer.id);


function onInit(event, helper) {
Expand All @@ -24,13 +24,13 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
row.code = snprcTriggerHelper.getNextAnimalGroup();
}

var message = undefined;
let message;

// if there is an endDate, it must be >= startDate (date)
if (row.enddate) {

var startDate = new Date(row.date);
var endDate = new Date(row.enddate);
let startDate = new Date(row.date);
let endDate = new Date(row.enddate);

if (startDate > endDate) {
message = 'End date must occur on or after the start date.';
Expand All @@ -48,14 +48,14 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
// }

// enddate changes
var old_enddate, new_enddate;
let old_enddate, new_enddate;
if (message === undefined && oldRow && row.enddate) {

if (oldRow.enddate === undefined) {
old_enddate = new Date(row.enddate)
}
else {
var d = oldRow.enddate.split("-");
let d = oldRow.enddate.split("-");
old_enddate = new Date(d[0], d[1] - 1, d[2]);
}

Expand All @@ -70,11 +70,13 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
scope: this,
filterArray: [
LABKEY.Filter.create('groupId', row.code, LABKEY.Filter.Types.EQUAL),
LABKEY.Filter.create('enddate', null, LABKEY.Filter.Types.MISSING)
LABKEY.Filter.create('enddate', row.enddate, LABKEY.Filter.Types.MISSING)
],
success: function (data) {
if (data.rows && data.rows.length) {
message = "Group has active members that must be end dated first."

console.log(JSON.stringify(data.rows));
message = "Cannot enter an end date for a group that has members that are not end dated.";
}
},
failure: function (error) {
Expand All @@ -90,11 +92,11 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
if (message === undefined) {
LABKEY.Query.selectRows({
schemaName: 'study',
queryName: 'MaxEndDateForAnimalGroup',
queryName: 'animal_group_members',
columns: 'groupid',
scope: this,
filterArray: [
LABKEY.Filter.create('groupId', row.groupId, LABKEY.Filter.Types.EQUAL),
LABKEY.Filter.create('groupId', row.code, LABKEY.Filter.Types.EQUAL),
LABKEY.Filter.create('enddate', row.enddate, LABKEY.Filter.Types.GREATER_THAN)
],
success: function (data) {
Expand All @@ -108,10 +110,46 @@ function onUpsert(helper, scriptErrors, row, oldRow) {
});

if (message) {
if (message) {
EHR.Server.Utils.addError(scriptErrors, 'enddate', message, 'ERROR');
}
}
}
}

// if start date changes, it must be less than or equal to the minimum start date for assigned group members

if (message === undefined && oldRow && row.date && oldRow.date) {

let oldStartDate, newStartDate;
oldStartDate = new Date(oldRow.date);
newStartDate = new Date(row.date);

if (newStartDate.getTime() !== oldStartDate.getTime()) {

LABKEY.Query.selectRows({
schemaName: 'study',
queryName: 'animal_group_members',
columns: 'groupid, date',
scope: this,
filterArray: [
LABKEY.Filter.create('groupid', oldRow.code, LABKEY.Filter.Types.EQUAL),
LABKEY.Filter.create('date', row.date, LABKEY.Filter.Types.DATE_LESS_THAN)
],
success: function (data) {
if (data.rows && data.rows.length > 0) {
message = "Start date must be greater than or equal to the minium start date for assigned group members.";
}
else {
console.log("no rows returned");
}
},
failure: function (error) {
message = 'Error reading from study.MinStartDateForAnimalGroup query';
}
});

if (message) {
EHR.Server.Utils.addError(scriptErrors, 'date', message, 'ERROR');
}
}
}
Expand Down
18 changes: 0 additions & 18 deletions snprc_ehr/resources/queries/study/MaxEndDateForAnimalGroup.sql

This file was deleted.

50 changes: 19 additions & 31 deletions snprc_ehr/resources/queries/study/demographicsCurLocation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,24 @@
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
SELECT

d2.id,

CASE
WHEN d2.cage is null then d2.room
ELSE (d2.room || '-' || d2.cage)
END AS Location,

d2.room.area,

d2.room,

d2.cage,

ifdefined(d2.housingCondition) as cond,

d2.date,

d2.reason,

d2.remark,

coalesce(d2.room, '') as room_order,
d2.room_sortValue @hidden,

coalesce(d2.cage, '') as cage_order,
d2.cage_sortValue @hidden,

/***********************************************
Changed Location to display cage as int.
i.e. 8.04-18.00 will not display as 8.04-18
srr 01/25/19
**********************************************/
SELECT d2.id,
CASE
WHEN d2.cage is null THEN d2.room
WHEN isnumeric(d2.cage) = 1 THEN (d2.room || '-' || cast(cast(d2.cage as DECIMAL) as varchar) )
ELSE (d2.room || '-' || d2.cage)
END AS Location,
d2.room.area, d2.room, d2.cage,
ifdefined(d2.housingCondition) AS cond,
d2.date, d2.reason, d2.remark,
coalesce(d2.room, '') AS room_order,
d2.room_sortValue @hidden,
coalesce(d2.cage, '') AS cage_order,
d2.cage_sortValue @hidden
FROM study.housing d2

WHERE d2.enddate IS NULL
AND d2.qcstate.publicdata = true
AND d2.qcstate.publicdata = true;
29 changes: 14 additions & 15 deletions snprc_ehr/resources/source_queries/create_v_delete_clinpathruns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@ GO


ALTER VIEW Labkey_etl.v_delete_clinPathRuns AS
-- ==========================================================================================
-- Author: Terry Hawkins
-- Create date: 6/26/2015
-- Description: Selects the ETL records for LabKey study.clinPathRuns dataset for deletes
-- Changes:
--
--
-- ==========================================================================================
SELECT log.MESSAGE_ID as objectid,
log.ENTRY_DATE_TM

FROM dbo.HL7_IMPORT_LOG AS log
WHERE log.RESULT_STATUS = 'X' -- 'X' = cancelled orders

-- ==========================================================================================
-- Author: Terry Hawkins
-- Create date: 6/26/2015
-- Description: Selects the ETL records for LabKey study.clinPathRuns dataset for deletes
-- Changes:
-- 12/17/2018 changed query delete source
--
-- ==========================================================================================
SELECT obr.message_id AS objectid, obr.entry_date_tm
FROM dbo.CLINICAL_PATH_OBR AS obr -- select primates only from the TxBiomed colony
INNER JOIN Labkey_etl.V_DEMOGRAPHICS AS d ON d.id = obr.ANIMAL_ID

WHERE obr.RESULT_STATUS IN ('X') -- 'X' = cancelled order

GO

GRANT SELECT ON Labkey_etl.v_delete_clinPathRuns TO z_labkey
GRANT SELECT ON dbo.HL7_IMPORT_LOG TO z_labkey

GO
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ GO


ALTER VIEW Labkey_etl.v_delete_labwork_results AS
-- ==========================================================================================
-- Author: Terry Hawkins
-- Create date: 6/26/2015
-- Description: Selects the ETL records for LabKey study.labwork_results dataset for deletes
-- Changes:
--
--
-- ==========================================================================================
SELECT log.MESSAGE_ID AS objectid,
log.ENTRY_DATE_TM

FROM dbo.HL7_IMPORT_LOG AS log
WHERE log.RESULT_STATUS = 'X' -- 'X' = cancelled orders
-- ==========================================================================================
-- Author: Terry Hawkins
-- Create date: 6/26/2015
-- Description: Selects the ETL records for LabKey study.labwork_results dataset for deletes
-- Changes:
-- 12/17/2018 changed query delete source
--
-- ==========================================================================================
SELECT obr.message_id AS objectid, obr.entry_date_tm
FROM dbo.CLINICAL_PATH_OBR AS obr -- select primates only from the TxBiomed colony
INNER JOIN Labkey_etl.V_DEMOGRAPHICS AS d ON d.id = obr.ANIMAL_ID

WHERE obr.RESULT_STATUS IN ('X') -- 'X' = cancelled order


GO

GRANT SELECT ON Labkey_etl.v_delete_labwork_results TO z_labkey
GRANT SELECT ON dbo.HL7_IMPORT_LOG TO z_labkey

GO
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
Ext4.define("GroupMemberModel", {
extend: "Ext.data.Model",
idProperty: 'rowId', // auto-generated values by EXT
fields: ['groupid', 'id', {name:'date', type: 'date'} , {name: 'enddate', type: 'date'}, 'objectid'],
proxy: {
type: 'ajax',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ Ext4.define("GroupCategoriesGridPanel", {
if (!selected[0]) {
return;
}
var categoryCode = selected[0].get("categoryCode");
Ext4.getCmp('group-category-form-panel').loadRecord(selected[0]);
Ext4.getCmp('groups-grid-panel').getStore().load({
params: {
'categoryCode': selected[0].get("categoryCode")
'categoryCode': categoryCode
}

});
Ext4.getCmp('groups-grid-panel').getStore().setCategory(selected[0].get("categoryCode"));
}
Ext4.getCmp('groups-grid-panel').getStore().setCategory(categoryCode);
},
buffer: 10
},
tbar: Ext4.create('Ext.toolbar.Toolbar', {
defaults: {
Expand Down Expand Up @@ -168,6 +169,9 @@ Ext4.define("GroupCategoriesGridPanel", {
failure: function () {
Ext4.Msg.alert("Error", "Unable to delete this Category");
grid.getStore().load();
},
success: function () {
grid.view.select(1);
}
});

Expand All @@ -180,7 +184,6 @@ Ext4.define("GroupCategoriesGridPanel", {
],

setFilter: function () {

this.getStore().clearFilter(true);
this.getStore().filter([{
property: 'description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Ext4.define("GroupMembersGridPanel", {
}
},
{
text: 'Objectif',
text: 'Objectid',
dataIndex: 'objectid',
hidden: true,
hideable: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ Ext4.define("AssignAnimalsToGroupWindow", {

}
else {
Ext4.MessageBox.alert('Something went wrong', 'Unable to update the record');

Ext4.MessageBox.alert('Something went wrong', response.error);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.labkey.snprc_ehr.domain.AnimalGroupCategory;
import org.labkey.snprc_ehr.domain.AnimalSpecies;
import org.labkey.snprc_ehr.domain.GroupMember;
import org.labkey.snprc_ehr.enums.AssignmentFailureReason;
import org.labkey.snprc_ehr.helpers.SortFilterHelper;
import org.labkey.snprc_ehr.security.ManageGroupMembersPermission;
import org.labkey.snprc_ehr.services.AnimalsGroupAssignor;
Expand Down Expand Up @@ -612,9 +613,7 @@ public ApiResponse execute(GroupMember groupMember, BindException errors)
Map props = new HashMap();
props.put("success", false);

Map dateFailure = new HashMap<>();
dateFailure.put("Invalid End Date", "End Date must be greater than Start Date");
props.put("failure", dateFailure);
props.put("message", AssignmentFailureReason.INVALID_START_OR_END_DATE.toString());

return new ApiSimpleResponse(props);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public enum AssignmentFailureReason
FUTURE_DATE_NOT_ALLOWED("Future Dates not allowed"),
NOT_APPLICABLE_SPECIES("Species Mismatch"),
GROUP_DOES_NOT_EXIST("Animal group does not exist"),
INVALID_DATE("Assignment start and end date must be between groups start and end date.");
INVALID_DATE("Assignment start and end date must be between groups start and end date."),
INVALID_START_OR_END_DATE("End Date must be greater than Start Date."),
END_DATE_REQUIRED("Group member must have an end date when the group has an end date.");

private String reason;

Expand Down
Loading