From 786959fe802a894da0b81ea371cde3deeeb78c66 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 5 Aug 2026 10:24:11 -0600 Subject: [PATCH 1/5] Track investigators as EHR data instead of server accounts Investigator references on projects and protocols resolved against core.Users, which required a LabKey account for every PI and could only display an account display name. They now point at a new ehr.investigators table with an admin entry form, and assignment views build the investigator name from its first and last name fields. --- .../queries/ehr/investigators.query.xml | 26 ++++++++++ .../resources/queries/ehr/project.query.xml | 8 ++-- .../resources/queries/ehr/protocol.query.xml | 8 ++-- .../queries/study/activeAssignments.sql | 2 +- .../org/labkey/nbri_ehr/NBRI_EHRModule.java | 1 + .../form/NBRIInvestigatorsFormType.java | 48 +++++++++++++++++++ 6 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 nbri_ehr/resources/queries/ehr/investigators.query.xml create mode 100644 nbri_ehr/src/org/labkey/nbri_ehr/dataentry/form/NBRIInvestigatorsFormType.java diff --git a/nbri_ehr/resources/queries/ehr/investigators.query.xml b/nbri_ehr/resources/queries/ehr/investigators.query.xml new file mode 100644 index 0000000..13d4973 --- /dev/null +++ b/nbri_ehr/resources/queries/ehr/investigators.query.xml @@ -0,0 +1,26 @@ + + + + + Investigators + + + + + + + Last Name + true + + + First Name + + + User + http://www.labkey.org/types#userId + + +
+
+
+
diff --git a/nbri_ehr/resources/queries/ehr/project.query.xml b/nbri_ehr/resources/queries/ehr/project.query.xml index 5b72f21..8ce9715 100644 --- a/nbri_ehr/resources/queries/ehr/project.query.xml +++ b/nbri_ehr/resources/queries/ehr/project.query.xml @@ -49,10 +49,10 @@ true - core - Users - UserId - DisplayName + ehr + investigators + rowid + lastName diff --git a/nbri_ehr/resources/queries/ehr/protocol.query.xml b/nbri_ehr/resources/queries/ehr/protocol.query.xml index 82667e7..e073a9b 100644 --- a/nbri_ehr/resources/queries/ehr/protocol.query.xml +++ b/nbri_ehr/resources/queries/ehr/protocol.query.xml @@ -9,10 +9,10 @@ PI false - core - Users - UserId - DisplayName + ehr + investigators + rowid + lastName diff --git a/nbri_ehr/resources/queries/study/activeAssignments.sql b/nbri_ehr/resources/queries/study/activeAssignments.sql index 990598c..9cd67a4 100644 --- a/nbri_ehr/resources/queries/study/activeAssignments.sql +++ b/nbri_ehr/resources/queries/study/activeAssignments.sql @@ -6,7 +6,7 @@ SELECT pa.Id, pa.protocol.title AS protocolTitle, pa.protocol.InvestigatorId AS investigatorId, - pa.protocol.InvestigatorId.DisplayName AS investigatorName, + initcap(pa.protocol.InvestigatorId.FirstName) || ' ' || initcap(pa.protocol.InvestigatorId.LastName) AS investigatorName, pa.protocol.InvestigatorId.LastName AS investigatorLastName, a.project.name AS project, a.isActive AS isActiveAssignment, diff --git a/nbri_ehr/src/org/labkey/nbri_ehr/NBRI_EHRModule.java b/nbri_ehr/src/org/labkey/nbri_ehr/NBRI_EHRModule.java index aa76225..674afdb 100644 --- a/nbri_ehr/src/org/labkey/nbri_ehr/NBRI_EHRModule.java +++ b/nbri_ehr/src/org/labkey/nbri_ehr/NBRI_EHRModule.java @@ -217,6 +217,7 @@ private void registerDataEntry() EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIMedicationTreatmentFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIProjectFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIProtocolFormType.class, this)); + EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIInvestigatorsFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIPregnancyFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIWeightFormType.class, this)); EHRService.get().registerFormType(new DefaultDataEntryFormFactory(NBRIFlagsFormType.class, this)); diff --git a/nbri_ehr/src/org/labkey/nbri_ehr/dataentry/form/NBRIInvestigatorsFormType.java b/nbri_ehr/src/org/labkey/nbri_ehr/dataentry/form/NBRIInvestigatorsFormType.java new file mode 100644 index 0000000..14055b2 --- /dev/null +++ b/nbri_ehr/src/org/labkey/nbri_ehr/dataentry/form/NBRIInvestigatorsFormType.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.nbri_ehr.dataentry.form; + +import org.labkey.api.ehr.dataentry.DataEntryFormContext; +import org.labkey.api.ehr.dataentry.forms.AdminLinksFormType; +import org.labkey.api.ehr.security.EHRDataAdminPermission; +import org.labkey.api.module.Module; +import org.labkey.api.view.ActionURL; + +import java.util.ArrayList; + +public class NBRIInvestigatorsFormType extends AdminLinksFormType +{ + public NBRIInvestigatorsFormType(DataEntryFormContext ctx, Module owner) + { + super(ctx, owner, "Investigators", "Investigators", "Admin", new ArrayList<>()); + } + + @Override + protected ActionURL dataEntryLink() + { + ActionURL url = new ActionURL("ldk", "updateQuery", getCtx().getContainer()); + url.addParameter("schemaName", "ehr"); + url.addParameter("query.queryName", "investigators"); + url.addParameter("showImport", "true"); + return url; + } + + @Override + public boolean isAvailable() + { + return (super.isAvailable() || getCtx().getContainer().hasPermission(getCtx().getUser(), EHRDataAdminPermission.class)); + } +} From 9a4ae62a177f14be2c94d71c7d348afc6292c2b6 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 5 Aug 2026 10:28:29 -0600 Subject: [PATCH 2/5] Drop unused protocol columns and the counts table template Neither the removed protocol fields nor the counts table are used at this institution. --- .../domain-templates/ehr.template.xml | 109 ------------------ 1 file changed, 109 deletions(-) diff --git a/nbri_ehr/resources/domain-templates/ehr.template.xml b/nbri_ehr/resources/domain-templates/ehr.template.xml index 281f4bd..3b976a8 100644 --- a/nbri_ehr/resources/domain-templates/ehr.template.xml +++ b/nbri_ehr/resources/domain-templates/ehr.template.xml @@ -6,118 +6,9 @@ - - From 50ac6f0de413a0b133593dcfc6b10e8ee6f6c995 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 5 Aug 2026 10:30:14 -0600 Subject: [PATCH 3/5] Add food, housing, and pairing exemption flags to protocols The three flags are added to the protocol domain and surfaced on the protocol grid. --- nbri_ehr/resources/domain-templates/ehr.template.xml | 9 +++++++++ nbri_ehr/resources/queries/ehr/protocol/.qview.xml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/nbri_ehr/resources/domain-templates/ehr.template.xml b/nbri_ehr/resources/domain-templates/ehr.template.xml index 3b976a8..a29a278 100644 --- a/nbri_ehr/resources/domain-templates/ehr.template.xml +++ b/nbri_ehr/resources/domain-templates/ehr.template.xml @@ -9,6 +9,15 @@ dateTime + + boolean + + + boolean + + + boolean + diff --git a/nbri_ehr/resources/queries/ehr/protocol/.qview.xml b/nbri_ehr/resources/queries/ehr/protocol/.qview.xml index e2e125f..4ec88b8 100644 --- a/nbri_ehr/resources/queries/ehr/protocol/.qview.xml +++ b/nbri_ehr/resources/queries/ehr/protocol/.qview.xml @@ -35,6 +35,9 @@ + + + From dc8151b347c2cf08cfdbb971e54678d2782bb2d5 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 5 Aug 2026 11:37:13 -0600 Subject: [PATCH 4/5] Prune protocol metadata to columns that still exist The earlier column drop left query metadata and the default view pointing at fields the domain template no longer provisions. --- .../resources/queries/ehr/protocol.query.xml | 65 +------------------ .../resources/queries/ehr/protocol/.qview.xml | 31 +-------- .../queries/ehr/protocol_counts.query.xml | 9 --- 3 files changed, 2 insertions(+), 103 deletions(-) diff --git a/nbri_ehr/resources/queries/ehr/protocol.query.xml b/nbri_ehr/resources/queries/ehr/protocol.query.xml index e073a9b..edf95db 100644 --- a/nbri_ehr/resources/queries/ehr/protocol.query.xml +++ b/nbri_ehr/resources/queries/ehr/protocol.query.xml @@ -18,69 +18,6 @@ true - - Author - - core - Users - UserId - DisplayName - - - - Owner - - core - Users - UserId - DisplayName - - - - Protocol Type - - ehr_lookups - protocol_type - value - title - - - - Protocol Category - - ehr_lookups - protocol_category - value - title - - - - Current State - - ehr_lookups - protocol_state - value - title - - - - Parent Protocol - - ehr - protocol - protocol - displayName - - - - Questionnaire - - ehr_lookups - questionnaire - value - title - - Approval Date @@ -88,4 +25,4 @@ - \ No newline at end of file + diff --git a/nbri_ehr/resources/queries/ehr/protocol/.qview.xml b/nbri_ehr/resources/queries/ehr/protocol/.qview.xml index 4ec88b8..62dfd8e 100644 --- a/nbri_ehr/resources/queries/ehr/protocol/.qview.xml +++ b/nbri_ehr/resources/queries/ehr/protocol/.qview.xml @@ -2,43 +2,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/nbri_ehr/resources/queries/ehr/protocol_counts.query.xml b/nbri_ehr/resources/queries/ehr/protocol_counts.query.xml index 6586f91..82b9060 100644 --- a/nbri_ehr/resources/queries/ehr/protocol_counts.query.xml +++ b/nbri_ehr/resources/queries/ehr/protocol_counts.query.xml @@ -14,15 +14,6 @@ scientific_name - - Euthanasia - - ehr_lookups - euthanasia_type - value - title - - From 921293afc876cf9e52b268c128571586c2717779 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Fri, 7 Aug 2026 13:31:11 -0600 Subject: [PATCH 5/5] Update end date visibility --- .../web/nbri_ehr/model/sources/Assignment.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nbri_ehr/resources/web/nbri_ehr/model/sources/Assignment.js b/nbri_ehr/resources/web/nbri_ehr/model/sources/Assignment.js index 4d38d3c..b055afb 100644 --- a/nbri_ehr/resources/web/nbri_ehr/model/sources/Assignment.js +++ b/nbri_ehr/resources/web/nbri_ehr/model/sources/Assignment.js @@ -5,13 +5,12 @@ */ EHR.model.DataModelManager.registerMetadata('Assignment', { - allQueries: { - endDate: { - hidden: true - } - }, byQuery: { 'study.assignment': { + // the dataset column is hidden by default; project assignments are ended by entering an end date + 'enddate': { + hidden: false + }, 'project': { xtype: 'combo', nullable: false, @@ -27,6 +26,9 @@ EHR.model.DataModelManager.registerMetadata('Assignment', { } }, 'study.protocolAssignment': { + 'enddate': { + hidden: true + }, 'project': { hidden: true },