From aca6ff3e87ff713ac94e2e891b0c9019454d4bbf Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Tue, 8 Apr 2025 15:48:04 -0700 Subject: [PATCH 1/8] Merge remove stack trace forward (#931) --- ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java b/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java index 5f43e97c0..73ca925ae 100644 --- a/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java +++ b/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java @@ -2558,8 +2558,7 @@ public int compare(Map o1, Map o2) Date date = _dateTimeFormat.parse(row.get("date").toString()); if (!dateOnly && date.getHours() == 0 && date.getMinutes() == 0) { - Exception e = new Exception(); - _log.warn("Attempting to terminate " + dataset + " records with a rounded date. This might indicate upstream code is rounding the date: " + _dateTimeFormat.format(date), e); + _log.warn("Attempting to terminate " + dataset + " records with a rounded date. This might indicate upstream code is rounding the date: " + _dateTimeFormat.format(date)); } SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), row.get("Id")); From e41326d8213d3153f3b12c632f04398d2c3bd571 Mon Sep 17 00:00:00 2001 From: Chad Sebranek Date: Thu, 17 Apr 2025 16:14:00 -0500 Subject: [PATCH 2/8] Fix for creating templates from selected records (#936) * fix for selecting records for a template * undo console log --- ehr/resources/web/ehr/window/SaveTemplateWindow.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ehr/resources/web/ehr/window/SaveTemplateWindow.js b/ehr/resources/web/ehr/window/SaveTemplateWindow.js index 6a727c2ac..63d222e80 100644 --- a/ehr/resources/web/ehr/window/SaveTemplateWindow.js +++ b/ehr/resources/web/ehr/window/SaveTemplateWindow.js @@ -204,7 +204,8 @@ Ext4.define('EHR.window.SaveTemplateWindow', { var rows = []; this.down('#theForm').items.each(function(tab){ - var selections = tab.down('#recordSelector').getValue().inputValue; + var radioGroup = tab.down('#recordSelector'); + var selections = radioGroup.getValue()[radioGroup.down('[name]').name]; var fields = tab.down('#fieldSelector').getValue().fields; if (!fields.length) @@ -220,7 +221,7 @@ Ext4.define('EHR.window.SaveTemplateWindow', { var records = []; if (selections == 'selected'){ - records = this.grid.getSelectionModel().getSelections(); + records = this.targetGrid.getSelectionModel().getSelection(); if (!records.length){ Ext4.Msg.hide(); From 1dfd53114c1828068ddc8a947440dd0749827a9b Mon Sep 17 00:00:00 2001 From: "F. Daniel Nicolalde" Date: Fri, 18 Apr 2025 15:05:44 -0500 Subject: [PATCH 3/8] Adding option to the navMenu to add a target when generating links in ExtJS. (#926) --- ehr/resources/web/ehr/navMenu.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ehr/resources/web/ehr/navMenu.js b/ehr/resources/web/ehr/navMenu.js index 74bbd49af..8f4d6048c 100644 --- a/ehr/resources/web/ehr/navMenu.js +++ b/ehr/resources/web/ehr/navMenu.js @@ -107,11 +107,19 @@ Ext4.define('EHR.NavMenu', { item = this.renderer(tmp.items[j]) } else { - //NOTE: this is the default renderer - item = { - //Creates links for the navigation panel - html: ''+tmp.items[j].name+'' + if (tmp.items[j].target){ + item = { + //Creates links for the navigation panel to a target + html: ''+tmp.items[j].name+'' + } + }else{ + item = { + //Creates links for the navigation panel + html: ''+tmp.items[j].name+'' + } } + //NOTE: this is the default renderer + } section.add(item) } From f00cc554d3c2eb3fce4477d8192a0e833187cd14 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Fri, 9 May 2025 04:13:39 -0700 Subject: [PATCH 4/8] Make EHRCompliance tables extensible starting with RequirementsPerEmployee (#950) * Add and register domain kind * Add fix for domainURI * Add LSID to RequirementsPerEmployee * Update general EHR page to add this schema including container field --- .../EHR_ComplianceDB-25.000-25.001.sql | 1 + .../EHR_ComplianceDB-25.000-25.001.sql | 1 + .../resources/schemas/ehr_compliancedb.xml | 11 ++++ .../EHR_ComplianceDBModule.java | 5 +- .../EHR_ComplianceDBUserSchema.java | 20 +++++++ .../model/EHRComplianceDBDomainKind.java | 57 +++++++++++++++++++ ehr/resources/views/ehrTemplates.html | 39 ++++++++++++- 7 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql create mode 100644 EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql create mode 100644 EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java diff --git a/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql b/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql new file mode 100644 index 000000000..52811f63a --- /dev/null +++ b/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql @@ -0,0 +1 @@ +ALTER TABLE ehr_compliancedb.requirementsperemployee ADD COLUMN LSID LSIDtype; \ No newline at end of file diff --git a/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql b/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql new file mode 100644 index 000000000..df2cbf19e --- /dev/null +++ b/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql @@ -0,0 +1 @@ +ALTER TABLE ehr_compliancedb.requirementsperemployee ADD Lsid LsidType null; \ No newline at end of file diff --git a/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml b/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml index 824de80e8..7ea7baa14 100644 --- a/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml +++ b/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml @@ -453,6 +453,17 @@ true Key + + lsidtype + true + true + false + + ObjectUri + Object + exp + + Employee Id diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java index b4616010b..c17ff3540 100644 --- a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java +++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java @@ -19,9 +19,11 @@ import org.jetbrains.annotations.Nullable; import org.labkey.api.data.DbSchema; import org.labkey.api.data.DbSchemaType; +import org.labkey.api.exp.property.PropertyService; import org.labkey.api.ldk.ExtendedSimpleModule; import org.labkey.api.ldk.LDKService; import org.labkey.api.ldk.notification.NotificationService; +import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind; import org.labkey.ehr_compliancedb.notification.EmployeeComplianceNotification; import org.labkey.api.module.ModuleContext; import org.labkey.ehr_compliancedb.api.EHR_ComplianceService; @@ -49,7 +51,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 12.44; + return 25.001; } @Override @@ -64,6 +66,7 @@ protected void init() addController(CONTROLLER_NAME, EHR_ComplianceDBController.class); EHR_ComplianceService.setInstance(new EHR_ComplianceServiceImpl()); + PropertyService.get().registerDomainKind(new EHRComplianceDBDomainKind()); } @Override diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java index 82af20161..370843787 100644 --- a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java +++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java @@ -25,8 +25,10 @@ import org.labkey.api.module.Module; import org.labkey.api.query.DefaultSchema; import org.labkey.api.query.QuerySchema; +import org.labkey.api.query.SimpleTableDomainKind; import org.labkey.api.query.SimpleUserSchema; import org.labkey.api.security.User; +import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind; /** * User: bimber @@ -36,6 +38,7 @@ public class EHR_ComplianceDBUserSchema extends SimpleUserSchema { public static final String TABLE_REQUIREMENTS = "requirements"; + private static final String TABLE_REQUIREMENTSPEREMPLOYEE = "requirementsperemployee"; public EHR_ComplianceDBUserSchema(User user, Container container, DbSchema dbschema) { @@ -50,6 +53,23 @@ public TableInfo createTable(String name, ContainerFilter cf) SchemaTableInfo table = _dbSchema.getTable(name); return new ContainerScopedTable<>(this, table, cf, "requirementname").init(); } + else if (TABLE_REQUIREMENTSPEREMPLOYEE.equalsIgnoreCase(name)) + { + SchemaTableInfo table = _dbSchema.getTable(name); + return new SimpleTable<>(this, table, cf) + { + // There are issues with the '_' in the name of this module and creating template domains. This addresses + // the domain URI by normalizing with the domain kind. + @Override + public String getDomainURI() + { + if (_objectUriCol == null) + return null; + + return SimpleTableDomainKind.getDomainURI(EHRComplianceDBDomainKind.KIND_NAME, getName(), getDomainContainer(), _userSchema.getUser()); + } + }.init(); + } return super.createTable(name, cf); } diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java new file mode 100644 index 000000000..e99f4860c --- /dev/null +++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java @@ -0,0 +1,57 @@ +package org.labkey.ehr_compliancedb.model; + +import org.labkey.api.data.Container; +import org.labkey.api.exp.property.Domain; +import org.labkey.api.gwt.client.model.GWTPropertyDescriptor; +import org.labkey.api.query.ExtendedTableDomainKind; +import org.labkey.api.security.User; +import org.labkey.api.security.permissions.AdminPermission; +import org.labkey.data.xml.domainTemplate.DomainTemplateType; +import org.labkey.data.xml.domainTemplate.EHRComplianceDBTemplateType; + + +import java.util.List; +import java.util.Set; + +public class EHRComplianceDBDomainKind extends ExtendedTableDomainKind +{ + public static final String KIND_NAME = "EHRComplianceDB"; + + @Override + public boolean canCreateDefinition(User user, Container container) + { + return container.hasPermission("EHRComplianceDBDomainKind.canCreateDefinition", user, AdminPermission.class); + } + + @Override + protected String getSchemaName() + { + return KIND_NAME.toLowerCase(); + } + + @Override + protected String getNamespacePrefix() + { + return KIND_NAME.toLowerCase(); + } + + @Override + public String getKindName() + { + return KIND_NAME; + } + + @Override + public Set getReservedPropertyNames(Domain domain, User user) + { + return super.getReservedPropertyNames(domain, user); + } + + @Override + public boolean matchesTemplateXML(String templateName, DomainTemplateType template, List properties) + { + return template instanceof EHRComplianceDBTemplateType; + } +} + + diff --git a/ehr/resources/views/ehrTemplates.html b/ehr/resources/views/ehrTemplates.html index a759d4d35..85e8be151 100644 --- a/ehr/resources/views/ehrTemplates.html +++ b/ehr/resources/views/ehrTemplates.html @@ -54,19 +54,52 @@ }); } + createEHRComplianceDomainHandler = function () { + var ctx = EHR.Utils.getEHRContext(); + var container = document.getElementById("ehrcompliance_container").value; + if (!container) { + LABKEY.Utils.alert("Error", "Must enter the container path of the compliance folder."); + } + else { + LABKEY.Domain.create({ + module: ctx ? ctx['EHRCustomModule'] : null, + domainKind: "EHRComplianceDB", + domainGroup: "ehrcompliancedb", + importData: false, + containerPath: container, + success: function () { + LABKEY.Utils.alert("Success", "EHR_ComplianceDB tables updated successfully."); + }, + failure: function (e) { + LABKEY.Utils.alert("Error", e.exception); + } + }); + } + } + LABKEY.Utils.onReady(function(){ document.getElementById('createEHRDomainHandler')['onclick'] = function(){ createEHRDomainHandler(); return false; } document.getElementById('createEHRLookupsDomainHandler')['onclick'] = function(){ createEHRLookupsDomainHandler(); return false; } document.getElementById('createEHRBillingDomainHandler')['onclick'] = function(){ createEHRBillingDomainHandler(); return false; } + document.getElementById('createEHRComplianceDomainHandler')['onclick'] = function(){ createEHRComplianceDomainHandler(); return false; } }); \ No newline at end of file From 167f7c065ee45e963ae2e2a1040b8c9c74439ac1 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Thu, 5 Jun 2025 02:39:03 -0700 Subject: [PATCH 5/8] Add inheritDefaultDateFromParent to encounter forms (#963) * Add inheritDefaultDateFromParent and conditionalize date default in encounters --- .../web/ehr/data/EncounterStoreCollection.js | 2 +- .../web/ehr/model/sources/EncounterChild.js | 3 ++- .../web/ehr/window/EncounterAddRecordWindow.js | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ehr/resources/web/ehr/data/EncounterStoreCollection.js b/ehr/resources/web/ehr/data/EncounterStoreCollection.js index 8239cbda5..a669ecef2 100644 --- a/ehr/resources/web/ehr/data/EncounterStoreCollection.js +++ b/ehr/resources/web/ehr/data/EncounterStoreCollection.js @@ -64,7 +64,7 @@ Ext4.define('EHR.data.EncounterStoreCollection', { model.set('Id', parentRec.get('Id')); } - if (model.fields.get('date') && !model.get('date') && parentRec.get('date')){ + if (model.fields.get('date')?.inheritDefaultDateFromParent && !model.get('date') && parentRec.get('date')){ model.set('date', parentRec.get('date')); } diff --git a/ehr/resources/web/ehr/model/sources/EncounterChild.js b/ehr/resources/web/ehr/model/sources/EncounterChild.js index 68ea4e3e1..d27cdc046 100644 --- a/ehr/resources/web/ehr/model/sources/EncounterChild.js +++ b/ehr/resources/web/ehr/model/sources/EncounterChild.js @@ -12,7 +12,8 @@ EHR.model.DataModelManager.registerMetadata('EncounterChild', { } }, date: { - inheritDateFromParent: true + inheritDateFromParent: true, + inheritDefaultDateFromParent: true }, project: { inheritFromParent: true diff --git a/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js b/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js index c6c52090a..4846e3deb 100644 --- a/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js +++ b/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js @@ -96,8 +96,16 @@ Ext4.define('EHR.window.EncounterAddRecordWindow', { var model = this.targetGrid.store.createModel({}); var obj = {}; Ext4.Array.forEach(['Id', 'date', 'parentid', 'project'], function(field){ - if (this.targetGrid.store.getFields().get(field)){ - obj[field] = rec.get(field); + const fieldConfig = this.targetGrid.store.getFields().get(field); + if (fieldConfig){ + if (field === 'date') { + if (fieldConfig.inheritDefaultDateFromParent) { + obj[field] = rec.get(field); + } + } + else { + obj[field] = rec.get(field); + } } }, this); From 90b0d4ee1b7c8bc5090ecd72c5e036998de58885 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Wed, 25 Jun 2025 20:52:37 -0700 Subject: [PATCH 6/8] Issue 52277: SNDTest.testSuperPackageApis fails with DB deadlock (#974) * Issue 52277: SNDTest.testSuperPackageApis fails with Transaction DeadLock * Restore original error checking --- .../org/labkey/test/tests/snd/SNDTest.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/snd/test/src/org/labkey/test/tests/snd/SNDTest.java b/snd/test/src/org/labkey/test/tests/snd/SNDTest.java index 824db2a20..f1ac6fa62 100644 --- a/snd/test/src/org/labkey/test/tests/snd/SNDTest.java +++ b/snd/test/src/org/labkey/test/tests/snd/SNDTest.java @@ -1048,6 +1048,7 @@ public void preTest() //TODO: once exp tables are exposed - do a full cleanup from snd.pkgs, exp.DomainDescriptor, exp.PropertyDomain, exp.PropertyDescriptor } + @SuppressWarnings("JUnit3StyleTestMethodInJUnit4Class") // Explicitly called as part of setup public void testSNDImport() { //go to SND Project @@ -1264,7 +1265,7 @@ public void cloneDraftPackage() assertEquals("2", fairReviewRow.getMin()); assertEquals("7", fairReviewRow.getMax()); assertEquals(":-)", fairReviewRow.getDefault()); - assertEquals(true, fairReviewRow.getRequired()); + assertTrue(fairReviewRow.getRequired()); assertEquals("lol", fairReviewRow.getRedactedText()); } @@ -1404,7 +1405,7 @@ public void saveNewPackage() assertEquals("2", reviewRow.getMin()); assertEquals("7", reviewRow.getMax()); assertEquals("men", reviewRow.getDefault()); - assertEquals(true, reviewRow.getRequired()); + assertTrue(reviewRow.getRequired()); assertEquals("and women", reviewRow.getRedactedText()); } @@ -1545,11 +1546,11 @@ public void editCategories() throws Exception CategoryEditRow surgeryRowCat = catPage.getCategory("Surgery"); assertNotNull("Surgery category should exist", surgeryRowCat); - assertEquals("Surgery category should be active", true, surgeryRowCat.getIsActive()); + assertTrue("Surgery category should be active", surgeryRowCat.getIsActive()); CategoryEditRow ourCat = catPage.getCategory(editedCategory); assertNotNull("test edit category should exist", ourCat); - assertEquals("test edit category should be inactive", false, ourCat.getIsActive()); + assertFalse("test edit category should be inactive", ourCat.getIsActive()); assertEquals("test edit category should have new description", editedCategory, ourCat.getDescription()); SelectRowsCommand catsCmd = new SelectRowsCommand("snd", "PkgCategories"); @@ -1803,12 +1804,17 @@ public void testProjectApis() throws Exception public void testSuperPackageApis() throws Exception { goToProjectHome(); - goToSchemaBrowser(); //insert super package runScript(SAVEPACKAGEAPI_CHILDREN); goToSchemaBrowser(); - viewQueryData("snd", "SuperPkgs"); + selectQuery("snd", "SuperPkgs"); + // Issue 52277: Be sure that the call to analyze the query has completed by waiting for the dependency report, + // ensuring it won't be chosen as a deadlock victim + waitForText("Dependency Report"); + Locator viewData = Locator.linkWithText("view data"); + waitAndClickAndWait(viewData); + assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_1, 1); checkResults(TEST_SUPER_PKG_DESCRIPTION_1, Arrays.asList(TEST_SUPER_PKG_START_ID1 + 1, // top-level super package is the + 0, so start at + 1 @@ -1818,8 +1824,7 @@ public void testSuperPackageApis() throws Exception //update super package without cloning, with children runScript(UPDATESUPERPACKAGEAPI_CHILDREN); - goToSchemaBrowser(); - viewQueryData("snd", "SuperPkgs"); + refresh(); assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_2, 1); assertTextNotPresent(TEST_SUPER_PKG_DESCRIPTION_1); checkResults(TEST_SUPER_PKG_DESCRIPTION_2, @@ -1832,8 +1837,7 @@ public void testSuperPackageApis() throws Exception //update super package with cloning runScript(UPDATESUPERPACKAGEAPI_CLONE); - goToSchemaBrowser(); - viewQueryData("snd", "SuperPkgs"); + refresh(); assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_3, 1); assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_2, 1); checkResults(TEST_SUPER_PKG_DESCRIPTION_3, @@ -1846,8 +1850,7 @@ public void testSuperPackageApis() throws Exception //update super package without cloning, without children runScript(UPDATESUPERPACKAGEAPI_NOCHILDREN); - goToSchemaBrowser(); - viewQueryData("snd", "SuperPkgs"); + refresh(); assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_4, 1); assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_3, 1); assertTextNotPresent(TEST_SUPER_PKG_DESCRIPTION_2); @@ -2170,7 +2173,7 @@ public void categoryPermissionsUI() throws Exception { value = getPermissionTableValue(i, 1); assertNotNull(value); - assertTrue(value.equals("None")); + assertEquals("None", value); categoryRows.add(i); } } @@ -2182,7 +2185,7 @@ public void categoryPermissionsUI() throws Exception { value = getPermissionTableValue(r, 1); assertNotNull(value); - assertTrue(value.equals("SND Reader")); + assertEquals("SND Reader", value); } findButton("Clear All").click(); @@ -2192,7 +2195,7 @@ public void categoryPermissionsUI() throws Exception { value = getPermissionTableValue(categoryRows.get(k), 1); assertNotNull(value); - assertTrue(value.equals("None")); + assertEquals("None", value); click(getSimpleTableCell(Locator.id("category-security"), categoryRows.get(k), 1)); clickRoleInOpenDropDown(permissions.get(k)); } @@ -2203,7 +2206,7 @@ public void categoryPermissionsUI() throws Exception { value = getPermissionTableValue(categoryRows.get(j), 1); assertNotNull(value); - assertTrue(value.equals(permissions.get(j))); + assertEquals(value, permissions.get(j)); } } From c015096de07aa69bb78475e5213eeca5cba2e8cb Mon Sep 17 00:00:00 2001 From: Dan Duffek Date: Tue, 8 Jul 2025 11:23:19 -0700 Subject: [PATCH 7/8] Wait before clicking. (#983) --- .../src/org/labkey/test/pages/ehr/NotificationAdminPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java b/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java index 7eba6ebe6..ef494bb64 100644 --- a/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java +++ b/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java @@ -97,7 +97,7 @@ public void clickRunReportInBrowser(String name) { log("Clicking Run Report in browser for " + name); name = name.replace(" ", ""); - clickAndWait(Locator.tagWithAttributeContaining("a", "href", name).withText("Run Report In Browser")); + waitAndClickAndWait(Locator.tagWithAttributeContaining("a", "href", name).withText("Run Report In Browser")); } public void clickManuallyTriggerEmail(String name) From 9138b77fb816979c4b53330ebbbefede11dd7378 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:06:14 -0700 Subject: [PATCH 8/8] Housing overlaps form changes (#1003) - Add Area field with multi select to pick rooms - Add Building field with multi select to pick rooms - Update to handle multi-room selection --------- Co-authored-by: Marty Pradere --- .../queries/study/HousingOverlaps.sql | 45 +- .../queries/study/HousingOverlapsById.sql | 31 -- .../study/HousingOverlapsById/.qview.xml | 64 --- .../study/HousingOverlapsByIdDateOnly.sql | 31 -- .../HousingOverlapsByIdDateOnly/.qview.xml | 64 --- ...ry.xml => HousingOverlapsReport.query.xml} | 10 +- .../queries/study/HousingOverlapsReport.sql | 27 ++ .../study/HousingOverlapsReport/.qview.xml | 6 + ...> HousingOverlapsReportDateOnly.query.xml} | 12 +- .../study/HousingOverlapsReportDateOnly.sql | 24 + ehr/resources/views/housingOverlaps.html | 436 ++++++++++-------- ehr/resources/web/ehr/ehr_api.lib.xml | 1 + .../web/ehr/form/field/BuildingField.js | 59 +++ ehr/resources/web/ehr/form/field/RoomField.js | 31 +- 14 files changed, 421 insertions(+), 420 deletions(-) delete mode 100644 ehr/resources/queries/study/HousingOverlapsById.sql delete mode 100644 ehr/resources/queries/study/HousingOverlapsById/.qview.xml delete mode 100644 ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql delete mode 100644 ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml rename ehr/resources/queries/study/{HousingOverlapsById.query.xml => HousingOverlapsReport.query.xml} (82%) create mode 100644 ehr/resources/queries/study/HousingOverlapsReport.sql create mode 100644 ehr/resources/queries/study/HousingOverlapsReport/.qview.xml rename ehr/resources/queries/study/{HousingOverlapsByIdDateOnly.query.xml => HousingOverlapsReportDateOnly.query.xml} (79%) create mode 100644 ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql create mode 100644 ehr/resources/web/ehr/form/field/BuildingField.js diff --git a/ehr/resources/queries/study/HousingOverlaps.sql b/ehr/resources/queries/study/HousingOverlaps.sql index a4efd7d90..2889b8eca 100644 --- a/ehr/resources/queries/study/HousingOverlaps.sql +++ b/ehr/resources/queries/study/HousingOverlaps.sql @@ -1,40 +1,21 @@ -/* - * Copyright (c) 2011-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - */ - /** * This query is designed to find housing records that overlap. In this query, the overlap to calculated based on both date and time * A record that ends at the same time that a second record begins is not considered an overlap. - */ -PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL) + Modified by Kollil on 7/23/25 - Added Area field to the query and the rooms are filtered by area(s) selected, refer to tkt # 12894 + */ SELECT -h.lsid, -h.id, -h.room, -h.cage, -h.date, -h.enddate, -h.reason, -h.remark, -h.qcstate - + h.lsid, + h.id, + h.room.area as area, -- Added by Kollil + h.room, + h.cage, + h.date, + h.enddate, + h.reason, + h.remark, + h.qcstate FROM study.housing h - WHERE + h.qcstate = 18 -(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND -(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND - -/* entered startdate must be <= entered enddate */ -coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now()) -and - -/* entered startdate must be less than record's enddate */ -coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now()) -and - -/* entered enddate must be greater than record's startdate */ -coalesce(ENDDATE, now()) >= coalesce(h.date, now()) \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsById.sql b/ehr/resources/queries/study/HousingOverlapsById.sql deleted file mode 100644 index 6296f7ef7..000000000 --- a/ehr/resources/queries/study/HousingOverlapsById.sql +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2011-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - */ - -PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL) - -SELECT -h.Id, -cast(StartDate as timestamp) as date - -FROM study.housing h - -WHERE - -(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND -(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND - -/* entered startdate must be <= enddate */ -coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now()) -and - -/* entered startdate must be less than record's enddate */ -coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now()) -and - -/* entered enddate must be greater than record's startdate */ -coalesce(ENDDATE, now()) >= coalesce(h.date, now()) - -GROUP BY h.Id \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsById/.qview.xml b/ehr/resources/queries/study/HousingOverlapsById/.qview.xml deleted file mode 100644 index 603b1f172..000000000 --- a/ehr/resources/queries/study/HousingOverlapsById/.qview.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql b/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql deleted file mode 100644 index a6fa7185e..000000000 --- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - */ - -PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL) - -SELECT -h.Id, -cast(StartDate as timestamp) as date - -FROM study.housing h - -WHERE - -(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND -(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND - -/* entered startdate must be <= enddate */ -cast(coalesce(STARTDATE , cast('1900-01-01' as DATE)) as DATE) <= cast(coalesce(ENDDATE, now()) as DATE) -and - -/* entered startdate must be less than record's enddate */ -cast(coalesce(STARTDATE , cast('1900-01-01' as DATE)) as DATE) < cast(coalesce(h.enddate, now()) as DATE) -and - -/* entered enddate must be greater than record's startdate */ -cast(coalesce(ENDDATE, now()) as DATE) >= cast(coalesce(h.date, now()) as DATE) - -GROUP BY h.Id \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml b/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml deleted file mode 100644 index 32b8acce5..000000000 --- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsById.query.xml b/ehr/resources/queries/study/HousingOverlapsReport.query.xml similarity index 82% rename from ehr/resources/queries/study/HousingOverlapsById.query.xml rename to ehr/resources/queries/study/HousingOverlapsReport.query.xml index 1f1321218..1256b36ac 100644 --- a/ehr/resources/queries/study/HousingOverlapsById.query.xml +++ b/ehr/resources/queries/study/HousingOverlapsReport.query.xml @@ -1,17 +1,15 @@ - +
Housing Overlaps - This query identifies distinct animal IDs that overlapped with given housing records, accounting for date and time + This query identifies distinct housing records that overlapped with the given housing records, accounting for date and time - + true - - - Start Date + true diff --git a/ehr/resources/queries/study/HousingOverlapsReport.sql b/ehr/resources/queries/study/HousingOverlapsReport.sql new file mode 100644 index 000000000..f2cb68596 --- /dev/null +++ b/ehr/resources/queries/study/HousingOverlapsReport.sql @@ -0,0 +1,27 @@ +PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP) + +SELECT + h.lsid, + h.id, + h.room, + h.cage, + h.date, + h.enddate, + h.reason, + h.remark, + h.qcstate + +FROM study.housing h + +WHERE + +/* entered startdate must be <= entered enddate */ + coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now()) + and + +/* entered startdate must be less than record's enddate */ + coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now()) + and + +/* entered enddate must be greater than record's startdate */ + coalesce(ENDDATE, now()) >= coalesce(h.date, now()) \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml b/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml new file mode 100644 index 000000000..7edf3755c --- /dev/null +++ b/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml similarity index 79% rename from ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml rename to ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml index 967758d1c..ae23c19fe 100644 --- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml +++ b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml @@ -1,17 +1,15 @@ -
+
- Housing Overlaps - This query identifies all distinct animal IDs that overlapped with housing records, accounting for date only, not date/time + Housing Overlaps (Date Only) + This query identifies overlapping housing records, accounting for date only, not date/time - + true - - - Start Date + true diff --git a/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql new file mode 100644 index 000000000..65847cacd --- /dev/null +++ b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql @@ -0,0 +1,24 @@ +PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP) + +SELECT + h.lsid, + h.id, + h.room, + h.cage, + h.date, + h.enddate, + h.reason, + h.remark, + h.qcstate + +FROM study.housing h + +WHERE + + ( + (cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) >= cast(h.date AS DATE) AND cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) < cast(COALESCE(h.enddate, now()) AS DATE)) + OR + (cast(COALESCE(ENDDATE, now()) AS DATE) > cast(h.date AS DATE) AND cast(COALESCE(ENDDATE, now()) AS DATE) <= cast(COALESCE(h.enddate, now()) AS DATE)) + OR + (cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) <= cast(h.date AS DATE) AND cast(COALESCE(ENDDATE, now()) AS DATE) >= cast(COALESCE(h.enddate, now()) AS DATE)) + ) \ No newline at end of file diff --git a/ehr/resources/views/housingOverlaps.html b/ehr/resources/views/housingOverlaps.html index 9736656cc..48f211317 100644 --- a/ehr/resources/views/housingOverlaps.html +++ b/ehr/resources/views/housingOverlaps.html @@ -1,210 +1,278 @@ + + \ No newline at end of file diff --git a/ehr/resources/web/ehr/ehr_api.lib.xml b/ehr/resources/web/ehr/ehr_api.lib.xml index 59f74effe..ead5f3356 100644 --- a/ehr/resources/web/ehr/ehr_api.lib.xml +++ b/ehr/resources/web/ehr/ehr_api.lib.xml @@ -63,6 +63,7 @@