Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a9cfbbc
MOdified BSu Rounds to allow duplication of an
Ohsudev Aug 20, 2025
9e5bfed
Merge remote-tracking branch 'origin/24.11_fb_BSURoundsDuplication' i…
Ohsudev Aug 30, 2025
55f610b
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Sep 2, 2025
1902649
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev Sep 12, 2025
5cd622e
Modified BSU Rounds screen to allow user to add "Alopecia Grow" so th…
Ohsudev Sep 12, 2025
508c4d4
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Jan 15, 2026
adad93c
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Feb 1, 2026
1df746d
Merge branch 'release25.7-SNAPSHOT' into 25.7_fb_BehaviorRoundsDuplic…
Ohsudev Feb 27, 2026
ec9c80d
Merge remote-tracking branch 'refs/remotes/origin/25.7_fb_BehaviorRou…
Ohsudev Mar 13, 2026
52cc2b5
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 19, 2026
4f00354
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 20, 2026
8a69e2a
Modified BSU Rounds loading open cases to provide
Ohsudev Mar 21, 2026
2757482
Merge branch 'refs/heads/release25.11-SNAPSHOT' into 25.11_fb_BSURoun…
Ohsudev Mar 24, 2026
60b8697
Modified testing script codes to include Alopecia Regrowth.
Mar 31, 2026
b970dbd
Modified BSU Rounds test scripts
Apr 1, 2026
926b909
Modified BSU Rounds Test scripts to prevent testing errors.
Apr 7, 2026
31cd308
Modified BSU Rounds Test scripts to prevent testing errors.
Apr 7, 2026
87d6c04
Modified BSU Rounds syntex
Apr 10, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ EHR.model.DataModelManager.registerMetadata('BehaviorRounds', {
columnConfig: {
editable: false
}
},
caseid: {
hidden: false,
columnConfig: {
width: 10,
editable: false
}
}
}
}
Expand Down
202 changes: 202 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/window/AddBehaviorCasesWindow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/* Copyright (c) 2014-2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* This window will allow users to query open cases and add records to a task based on them
*/
Ext4.define('ONPRC_EHR.window.AddBehaviorCasesWindow', {
extend: 'EHR.window.AddSurgicalCasesWindow',
caseCategory: 'Behavior',
templateName: null,

allowNoSelection: true,
showAssignedVetCombo: false,
showAllowOpen: true,
defaultRemark: 'BSU Rounds Entered',

getCases: function(button){
Ext4.Msg.wait("Loading...");
this.hide();

var casesFilterArray = this.getCasesFilterArray();
var obsFilterArray = this.getBaseFilterArray();
obsFilterArray.push(LABKEY.Filter.create('caseCategory', this.caseCategory, LABKEY.Filter.Types.EQUAL));
var includeOpen = this.down('#includeOpen') ? this.down('#includeOpen').getValue() : false;
if (includeOpen){
obsFilterArray.push(LABKEY.Filter.create('caseIsOpen', true, LABKEY.Filter.Types.EQUAL));
}
else {
obsFilterArray.push(LABKEY.Filter.create('caseIsActive', true, LABKEY.Filter.Types.EQUAL));
}

//find distinct animals matching criteria
var multi = new LABKEY.MultiRequest();

multi.add(LABKEY.Query.selectRows, {
requiredVersion: 9.1,
schemaName: 'study',
queryName: 'latestObservationsForCase',
columns: 'Id,date,category,area,observation,remark,caseid',
filterArray: obsFilterArray,
scope: this,
success: function(results){
this.obsResults = results;
},
failure: LDK.Utils.getErrorCallback()
});

multi.add(LABKEY.Query.selectRows, {
requiredVersion: 9.1,
schemaName: 'study',
queryName: 'cases',
sort: 'Id/curLocation/location,Id,remark,allProblemCategories',
columns: 'Id,objectid,remark,allProblemCategories',
filterArray: casesFilterArray,
scope: this,
success: function(results){
this.casesResults = results;
},
failure: LDK.Utils.getErrorCallback()
});

multi.send(this.onSuccess, this);
},

//@Override. this is to skip the duplicate case check
addRecords: function(records){
this.doAddRecords(records);
},

//@Override. this is to skip the duplicate case check
doAddRecords: function(records){
this.processObservations(records);
},

//apply previous observations, or inser a blank obs record.
processObservations: function(caseRecords){
//find all distinct IDs with cases.
var distinctCaseIds = [];
if (caseRecords && caseRecords.length){
Ext4.Array.forEach(caseRecords, function(cr){
if (distinctCaseIds.indexOf(cr.get('caseid')) == -1){
distinctCaseIds.push(cr.get('caseid'));
}
}, this);
}

var previousObsMap = {};
if (this.obsResults && this.obsResults.rows && this.obsResults.rows.length){
Ext4.Array.forEach(this.obsResults.rows, function(sr){
//reset variable
var newobservation = '';
var newremark = '';
var row = new LDK.SelectRowsRow(sr);
newobservation = row.getValue('category');
newremark = row.getValue('remark');

//note: this has been changed to ensure 1 row per case
var key = row.getValue('caseid');
if (!previousObsMap[key])
previousObsMap[key] = [];

previousObsMap[key].push({
Id: row.getValue('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: row.getValue('caseid'),
category: row.getValue('category'),
area: row.getValue('area'),
allProblemCategories:row.getValue('allProblemCategories'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're calling this against this.obsResults, which doesn't have this column in the selectRows column list above.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I added that column to the query.

//dont copy value
//observation: row.getValue('observation'),
remark: row.getValue('remark')
});
if (newobservation == "Alopecia Score" && (newremark == null || newremark == "")) {
previousObsMap[key].push({
Id: row.getValue('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: row.getValue('caseid'),
category: 'Alopecia Regrowth',
area: row.getValue('area'),
allProblemCategories:row.getValue('allProblemCategories')
//dont copy value
//observation: row.getValue('observation'),
//remark: row.getValue('remark')
});

}
}, this);
}

var obsRecords = [];
var obsStore = this.targetStore.storeCollection.getClientStoreByName('Clinical Observations');
LDK.Assert.assertNotEmpty('Unable to find Clinical Observations store', obsStore);

var treatmentRecords = [];
var treatmentStore = this.targetStore.storeCollection.getClientStoreByName('Drug Administration');
LDK.Assert.assertNotEmpty('Unable to find Drug Administration store', treatmentStore);

Ext4.Array.forEach(caseRecords, function(cr){
if (previousObsMap[cr.get('caseid')]){
Ext4.Array.forEach(previousObsMap[cr.get('caseid')], function(r){
r = Ext4.apply(r, {
'Id/curLocation/location': cr.get('Id/curLocation/location')
});

obsRecords.push(obsStore.createModel(r));
}, this);
}
else {
obsRecords.push(obsStore.createModel({
'Id/curLocation/location': cr.get('Id/curLocation/location'),
Id: cr.get('Id'),
date: this.recordData.date,
performedby: this.recordData.performedby,
caseid: cr.get('caseid')
}));
}

treatmentRecords.push(treatmentStore.createModel({
Id: cr.get('Id'),
caseid: cr.get('caseid'),
date: this.recordData.date,
performedby: this.recordData.performedby
}));
}, this);

if (obsRecords.length){
obsStore.add(obsRecords);
}

if (treatmentRecords.length){
treatmentStore.add(treatmentRecords);
}

Ext4.Msg.hide();
this.close();
}
});

EHR.DataEntryUtils.registerGridButton('ADDBEHAVIORCASESAMENDED', function(config){
return Ext4.Object.merge({
text: 'Add Open Cases',
tooltip: 'Click to automatically add animals with open cases',
handler: function(btn){
var grid = btn.up('gridpanel');
if(!grid.store || !grid.store.hasLoaded()){
console.log('no store or store hasnt loaded');
return;
}

var cellEditing = grid.getPlugin('cellediting');
if(cellEditing)
cellEditing.completeEdit();

Ext4.create('ONPRC_EHR.window.AddBehaviorCasesWindow', {
targetStore: grid.store
}).show();
}
}, config);
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public BehaviorRoundsObservationsFormSection()

addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddClinicalCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddSurgicalCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/window/AddBehaviorCasesWindow.js"));
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/AddBehaviorCasesWindow.js"));
}

@Override
public List<String> getTbarButtons()
{
List<String> defaultButtons = super.getTbarButtons();
defaultButtons.add(0, "ADDBEHAVIORCASES");
defaultButtons.add(0, "ADDBEHAVIORCASESAMENDED");

return defaultButtons;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,16 @@ public void testBehaviorRounds() throws Exception
row.put("objectid", generateGUID());
row.put("taskid", generateGUID()); //required for latestObservationsForCase.sql to work
insertRowsCommand.addRow(row);

Map<String, Object> row2 = new HashMap<>();
row2.put("Id", SUBJECTS[0]);
row2.put("category", "Alopecia Regrowth");
row2.put("date", prepareDate(new Date(), -4, 0));
row2.put("caseid", caseId);
row2.put("observation", "Yes");
row2.put("objectid", generateGUID());
row2.put("taskid", generateGUID()); //required for latestObservationsForCase.sql to work
Copy link
Copy Markdown
Contributor

@labkey-martyp labkey-martyp Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comment above about the purpose of this test code. But if I'm misunderstanding and you do need it, I assume you would want the same taskid on this row as the row above so they show in the same form.

insertRowsCommand.addRow(row2);
insertRowsCommand.execute(getApiHelper().getConnection(), getContainerPath());
Comment on lines +1803 to 1812
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused why you're inserting this manually. Isn't your feature to have this created automatically?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally, when BSU open cases are loaded onto the form their entries appear on the main entry form. I updated the program so that every instances of "Alopecia Score", and they have
no remark information associated those entries I rewrote the program so that an "Alopecia Regrowth" will
be added automatically on the main form for every "Alopecia Score" instances that appear on the main
form.
For example: 34567 4/3/2026. Alopecia Score No remark showing}. ---> original part of open case entry
34567. 4/3/3026. Alopecia Regrowth ---> this part gets added when open case are added
on the main form.

That example repeats on the main form for BSU Prime users to enter the appropriate values. They will both
contain the same task id, and same case id for both, its just "Alopecia Reqrowth" was programmed to be included to that set.


Ext4GridRef obsGrid = _helper.getExt4GridForFormSection("Observations");
Expand Down
Loading