diff --git a/nbri_ehr/resources/domain-templates/ehr.template.xml b/nbri_ehr/resources/domain-templates/ehr.template.xml index 281f4bd..a29a278 100644 --- a/nbri_ehr/resources/domain-templates/ehr.template.xml +++ b/nbri_ehr/resources/domain-templates/ehr.template.xml @@ -6,118 +6,18 @@ - - 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..edf95db 100644 --- a/nbri_ehr/resources/queries/ehr/protocol.query.xml +++ b/nbri_ehr/resources/queries/ehr/protocol.query.xml @@ -9,78 +9,15 @@ PI false - core - Users - UserId - DisplayName + ehr + investigators + rowid + lastName 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 e2e125f..62dfd8e 100644 --- a/nbri_ehr/resources/queries/ehr/protocol/.qview.xml +++ b/nbri_ehr/resources/queries/ehr/protocol/.qview.xml @@ -2,40 +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 - - 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/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 }, 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)); + } +}