From a19f80403f5b0c4060b14a467a16936ee8acc540 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Mon, 11 Aug 2025 13:26:47 -0700 Subject: [PATCH 1/5] last project and protocol --- .../study/demographicsLastProject.query.xml | 13 +++++++++++++ .../queries/study/demographicsLastProject.sql | 10 ++++++++++ .../study/demographicsLastProtocol.query.xml | 13 +++++++++++++ .../queries/study/demographicsLastProtocol.sql | 10 ++++++++++ .../labkey/nirc_ehr/table/NIRC_EHRCustomizer.java | 14 ++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 nirc_ehr/resources/queries/study/demographicsLastProject.query.xml create mode 100644 nirc_ehr/resources/queries/study/demographicsLastProject.sql create mode 100644 nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml create mode 100644 nirc_ehr/resources/queries/study/demographicsLastProtocol.sql diff --git a/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml b/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml new file mode 100644 index 00000000..d01971e9 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProject.query.xml @@ -0,0 +1,13 @@ + + + + + + + Last Project + + +
+
+
+
diff --git a/nirc_ehr/resources/queries/study/demographicsLastProject.sql b/nirc_ehr/resources/queries/study/demographicsLastProject.sql new file mode 100644 index 00000000..e4870630 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProject.sql @@ -0,0 +1,10 @@ + +SELECT + d2.id, + d2.project, + h.enddate as enddate + +FROM study.assignment d2 + JOIN (SELECT id, max(date) as maxDate, max(enddate) as enddate FROM study.assignment h GROUP BY id) h + ON (h.id = d2.id and d2.date = h.maxdate) +WHERE d2.qcstate.publicdata = true \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml b/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml new file mode 100644 index 00000000..94265b7c --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProtocol.query.xml @@ -0,0 +1,13 @@ + + + + + + + Last Protocol + + +
+
+
+
\ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql b/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql new file mode 100644 index 00000000..d72da760 --- /dev/null +++ b/nirc_ehr/resources/queries/study/demographicsLastProtocol.sql @@ -0,0 +1,10 @@ + +SELECT + d2.id, + d2.protocol, + h.enddate as enddate + +FROM study.protocolAssignment d2 + JOIN (SELECT id, max(date) as maxDate, max(enddate) as enddate FROM study.protocolAssignment h GROUP BY id) h + ON (h.id = d2.id and d2.date = h.maxdate) +WHERE d2.qcstate.publicdata = true \ No newline at end of file diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java index a5951343..ef34eaa1 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRCustomizer.java @@ -974,6 +974,20 @@ private void customizeAnimalTable(AbstractTableInfo ds) col.setLabel("Alias"); ds.addColumn(col); } + if (ds.getColumn("lastProtocol") == null) + { + var col = getWrappedCol(us, ds, "lastProtocol", "demographicsLastProtocol", "Id", "Id"); + col.setLabel("Assignment - Final Protocol"); + col.setDescription("This calculates the final protocol assignment for the animal. This is distinct from active protocol assignment because it will return a protocol assignment for dead animals"); + ds.addColumn(col); + } + if (ds.getColumn("lastProject") == null) + { + var col = getWrappedCol(us, ds, "lastProject", "demographicsLastProject", "Id", "Id"); + col.setLabel("Assignment - Final Project"); + col.setDescription("This calculates the final project assignment for the animal. This is distinct from active project assignment because it will return a project assignment for dead animals"); + ds.addColumn(col); + } } private void customizeProtocolTable(AbstractTableInfo ti) From eb7f6a0b0176731e32728d044823c52ed7a7598e Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Mon, 11 Aug 2025 13:27:16 -0700 Subject: [PATCH 2/5] Necropsy print report --- .../queries/study/tissueDisposition.query.xml | 4 +- .../study/tissueDisposition/.qview.xml | 1 + nirc_ehr/resources/views/necropsy.html | 140 ++++++++++++++++++ nirc_ehr/resources/views/necropsy.view.xml | 3 + .../org/labkey/nirc_ehr/NIRC_EHRModule.java | 4 + 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 nirc_ehr/resources/views/necropsy.html create mode 100644 nirc_ehr/resources/views/necropsy.view.xml diff --git a/nirc_ehr/resources/queries/study/tissueDisposition.query.xml b/nirc_ehr/resources/queries/study/tissueDisposition.query.xml index 18a0c90a..494a4ab1 100644 --- a/nirc_ehr/resources/queries/study/tissueDisposition.query.xml +++ b/nirc_ehr/resources/queries/study/tissueDisposition.query.xml @@ -5,6 +5,7 @@ Tissue + 80 ehr_lookups necropsy_tissue @@ -12,7 +13,8 @@ - Tissue Disposition Codes + Tissue Disposition Code + 180 ehr_lookups necropsy_disposition_codes diff --git a/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml b/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml index 6289bd39..428b9371 100644 --- a/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml +++ b/nirc_ehr/resources/queries/study/tissueDisposition/.qview.xml @@ -7,5 +7,6 @@ + \ No newline at end of file diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html new file mode 100644 index 00000000..b544429a --- /dev/null +++ b/nirc_ehr/resources/views/necropsy.html @@ -0,0 +1,140 @@ + + +
+ + +
+
+
+
+ +
+
+
+
+
+ + diff --git a/nirc_ehr/resources/views/necropsy.view.xml b/nirc_ehr/resources/views/necropsy.view.xml new file mode 100644 index 00000000..37cdfd93 --- /dev/null +++ b/nirc_ehr/resources/views/necropsy.view.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java index e80bd590..dff28c58 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/NIRC_EHRModule.java @@ -37,6 +37,7 @@ import org.labkey.api.module.Module; import org.labkey.api.module.ModuleContext; import org.labkey.api.query.DefaultSchema; +import org.labkey.api.query.DetailsURL; import org.labkey.api.query.QuerySchema; import org.labkey.api.resource.Resource; import org.labkey.api.security.roles.RoleManager; @@ -188,6 +189,9 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext) NotificationService.get().registerNotification(new NIRCProcedureOverdueNotification()); NotificationService.get().registerNotification(new NIRCPregnancyOutcomeNotification()); + EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.moreReports, "Printable Necropsy Report", this, DetailsURL.fromString("/nirc_ehr-necropsy.view"), "Pathology"); + + // Ensure N: is mounted if it's configured, as it's being mapped in via a symlink/shortcut, so we can't // recognize paths using it based solely on their drive letter and mount just-in-time if (NetworkDrive.getNetworkDrive("N:\\") != null) From 9a2e01fbbfb51b6a5c1fb3675b410b678abc36a9 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Mon, 11 Aug 2025 13:27:35 -0700 Subject: [PATCH 3/5] Inactive users not in performedby dropdowns --- nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js index 90e99cbc..aa445ecc 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('Default', { // from the display when a value is selected from the dropdown even though the 'userid' value gets saved as a text (this behavior was only seen // in the form panel but not in the grid panel). // casting it as a varchar when loading the store fixes this issue. - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE', autoLoad: true } } From 3f4dc71d925f82e6773a9cc32c2042cadb08b34f Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 13 Aug 2025 08:40:53 -0700 Subject: [PATCH 4/5] Performed by updates --- .../resources/web/nirc_ehr/model/sources/BehaviorDefaults.js | 2 +- nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js | 2 +- nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js index f225153d..efdde47b 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehaviorDefaults.js @@ -51,7 +51,7 @@ EHR.model.DataModelManager.registerMetadata('BehaviorDefaults', { store: { type: 'labkey-store', schemaName: 'core', - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js index 9567f57b..7be9323e 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js @@ -134,7 +134,7 @@ EHR.model.DataModelManager.registerMetadata('ClinicalCase', { store: { type: 'labkey-store', schemaName: 'core', - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js index aa445ecc..2f734dc3 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js @@ -24,7 +24,7 @@ EHR.model.DataModelManager.registerMetadata('Default', { // from the display when a value is selected from the dropdown even though the 'userid' value gets saved as a text (this behavior was only seen // in the form panel but not in the grid panel). // casting it as a varchar when loading the store fixes this issue. - sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE', + sql: "SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.PrincipalsWithoutAdmin WHERE active = TRUE AND Type = 'u'", autoLoad: true } } From bbf2979b7762dc29bc3fcc8594a3735055595ef4 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 13 Aug 2025 09:18:06 -0700 Subject: [PATCH 5/5] remove commented code --- nirc_ehr/resources/views/necropsy.html | 46 -------------------------- 1 file changed, 46 deletions(-) diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html index b544429a..f7390155 100644 --- a/nirc_ehr/resources/views/necropsy.html +++ b/nirc_ehr/resources/views/necropsy.html @@ -71,7 +71,6 @@ schemaName: 'study', queryName: 'necropsy', filterArray: filterArray, - // columns: 'cage,room,room/floor,room/floor/building,room/floor/building/area,outdoor', }, title: 'Necropsy', renderTo: 'animalNecropsy', @@ -83,7 +82,6 @@ schemaName: 'study', queryName: 'grossPathology', filterArray: filterArray, - // sort: '-Date' }).render('grossPathology'); LDK.Utils.getReadOnlyQWP({ @@ -91,50 +89,6 @@ schemaName: 'study', queryName: 'tissueDisposition', filterArray: filterArray, - // sort: '-Date' }).render('tissueDisposition'); - - // var multi = new LABKEY.MultiRequest(); - // multi.add(LABKEY.Query.selectRows({ - // schemaName: 'study', - // queryName: 'necropsy', - // filterArray: filterArray, - // scope: this, - // failure: function(err) { - // document.getElementById('animalIdError').innerHTML += ('
' + err.response.message); - // }, - // success: function(data){ - // if(!data.rows.length){ - // document.getElementById('animalIdError').innerHTML = "Animal Id necropsy not found."; - // return; - // } - // - // const necropsy = data.rows[0]; - // formType = row.formtype; - // renderTaskForm(formType); - // } - // }); - // - // multi.send(this.onLoad, this); - // - // LABKEY.Query.selectRows({ - // schemaName: 'study', - // queryName: 'necropsy', - // filterArray: [LABKEY.Filter.create('Id', animalId, LABKEY.Filter.Types.EQUAL)], - // scope: this, - // failure: function(err) { - // document.getElementById('animalIdError').innerHTML = err.response.message; - // }, - // success: function(data){ - // if(!data.rows.length){ - // document.getElementById('animalIdError').innerHTML = "Animal Id necropsy not found."; - // return; - // } - // - // const necropsy = data.rows[0]; - // formType = row.formtype; - // renderTaskForm(formType); - // } - // }); }