diff --git a/nirc_ehr/resources/data/editable_lookups.tsv b/nirc_ehr/resources/data/editable_lookups.tsv index 2381097e..291e96c3 100644 --- a/nirc_ehr/resources/data/editable_lookups.tsv +++ b/nirc_ehr/resources/data/editable_lookups.tsv @@ -114,6 +114,7 @@ respiratory_observations Clinical Respiratory Observations Used in clinical obse routes Clinical Treatment Routes Used in drug and treatment datasets. sib_score Behavior SIB Score Behavior observation fixed values. skin_problem Clinical Skin Problems Clinical observation fixed values. +source Colony Management Source species Colony Management Species snomed Research Treatments List of animal treatments. species_codes Colony Management Species Codes @@ -133,5 +134,6 @@ volume_units Clinical Volume Units Used in drug and treatment datasets. weight_ranges Clinical Weight Ranges Min/Max allowable weight per species. Used in various weight reports. wound_score Clinical Wound Score Clinical observation fixed values. wound_severity Clinical Wound Severity Clinical observation fixed values. -wound_status Clinical Wound Status Clinical observation fixed values. +wound_status_behavior Behavior Wound Status Behavioral observation fixed values. +wound_status_clinical Clinical Wound Status Clinical observation fixed values. yes_no_order Clinical Yes/No Values in Order Used for yes/no values in various datasets. Includes sort order. \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookup_sets.tsv b/nirc_ehr/resources/data/lookup_sets.tsv index 75a4c580..8fc0fb85 100644 --- a/nirc_ehr/resources/data/lookup_sets.tsv +++ b/nirc_ehr/resources/data/lookup_sets.tsv @@ -112,5 +112,6 @@ vendor_production_location Vendor Production Location value title weight_ranges Weight Ranges value wound_score Wound Score value wound_severity Wound Severity value -wound_status Wound Status value +wound_status_behavior Wound Status Behavior value +wound_status_clinical Wound Status Clinical value yes_no_order Yes/No Values in Order value \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookupsManifest.tsv b/nirc_ehr/resources/data/lookupsManifest.tsv index 651aabb7..300f7645 100644 --- a/nirc_ehr/resources/data/lookupsManifest.tsv +++ b/nirc_ehr/resources/data/lookupsManifest.tsv @@ -123,5 +123,6 @@ volume_units weight_ranges wound_score wound_severity -wound_status +wound_status_behavior +wound_status_clinical yes_no_order \ No newline at end of file diff --git a/nirc_ehr/resources/data/lookupsManifestTest.tsv b/nirc_ehr/resources/data/lookupsManifestTest.tsv index be1be46f..9a509028 100644 --- a/nirc_ehr/resources/data/lookupsManifestTest.tsv +++ b/nirc_ehr/resources/data/lookupsManifestTest.tsv @@ -125,5 +125,6 @@ volume_units weight_ranges wound_score wound_severity -wound_status +wound_status_behavior +wound_status_clinical yes_no_order \ No newline at end of file diff --git a/nirc_ehr/resources/data/observation_types.tsv b/nirc_ehr/resources/data/observation_types.tsv index d79b197c..aab145df 100644 --- a/nirc_ehr/resources/data/observation_types.tsv +++ b/nirc_ehr/resources/data/observation_types.tsv @@ -46,4 +46,5 @@ Temperament Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","quer Vaginal/Uterine Prolapse {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"vaginal_uterine_prolapse","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups vaginal_uterine_prolapse value Verified Id? {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"yes_no_order","forceSelection":true,"displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups yes_no_order value Wound Severity Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_severity","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups wound_severity value -Wound Status Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_status","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups wound_status value \ No newline at end of file +Wound Status Behavior {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_status_behavior","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups wound_status_behavior value +Clinical Wound Status {"xtype":"ehr-simplecombo","schemaName":"ehr_lookups","queryName":"wound_status_clinical","displayField":"value","valueField":"value","sortFields":"sort_order"} ehr_lookups wound_status_clinical value \ No newline at end of file diff --git a/nirc_ehr/resources/data/wound_status_behavior.tsv b/nirc_ehr/resources/data/wound_status_behavior.tsv new file mode 100644 index 00000000..c3dbc444 --- /dev/null +++ b/nirc_ehr/resources/data/wound_status_behavior.tsv @@ -0,0 +1,5 @@ +value sort_order +Completely healed 1 +Mostly healed 2 +Partially healed 3 +Not healed 4 \ No newline at end of file diff --git a/nirc_ehr/resources/data/wound_status.tsv b/nirc_ehr/resources/data/wound_status_clinical.tsv similarity index 100% rename from nirc_ehr/resources/data/wound_status.tsv rename to nirc_ehr/resources/data/wound_status_clinical.tsv diff --git a/nirc_ehr/resources/queries/dbo/q_cases.sql b/nirc_ehr/resources/queries/dbo/q_cases.sql index f9313665..dd5a957f 100644 --- a/nirc_ehr/resources/queries/dbo/q_cases.sql +++ b/nirc_ehr/resources/queries/dbo/q_cases.sql @@ -8,10 +8,20 @@ SELECT * FROM ( THEN 'unknown' ELSE (trim(anmEvt.STAFF_ID.STAFF_FIRST_NAME) || '|' || trim(anmEvt.STAFF_ID.STAFF_LAST_NAME)) END) AS performedby, - (CASE WHEN anmEvt.EVENT_ID = 1580 THEN anmCmt.TEXT ELSE NULL END) AS openRemark, - (CASE WHEN anmEvt.EVENT_ID = 1677 THEN anmCmt.TEXT ELSE NULL END) AS closeRemark, - (CASE WHEN anmEvt.EVENT_ID = 1580 THEN anmEvt.DIAGNOSIS ELSE NULL END) AS openDiagnosis, - (CASE WHEN anmEvt.EVENT_ID = 1677 THEN anmEvt.DIAGNOSIS ELSE NULL END) AS closeDiagnosis, + (CASE + WHEN anmEvt.EVENT_ID = 1580 + THEN 'Open Remark: ' || + (CASE WHEN anmCmt.TEXT IS NULL THEN 'None' ELSE anmCmt.TEXT END) || + '; Open Diagnosis: ' || + (CASE WHEN anmEvt.DIAGNOSIS IS NULL THEN 'None' ELSE anmEvt.DIAGNOSIS END) + END) AS openRemark, + (CASE + WHEN anmEvt.EVENT_ID = 1677 + THEN 'Close Remark: ' || + (CASE WHEN anmCmt.TEXT IS NULL THEN 'None' ELSE anmCmt.TEXT END) || + '; Close Diagnosis: ' || + (CASE WHEN anmEvt.DIAGNOSIS IS NULL THEN 'None' ELSE anmEvt.DIAGNOSIS END) + END) AS closeRemark, COALESCE(dea.deathDate, dep.eventDate) AS enddate, anmEvt.EVENT_ID.NAME AS category, CASE diff --git a/nirc_ehr/resources/queries/dbo/q_observations.sql b/nirc_ehr/resources/queries/dbo/q_observations.sql index 6f636439..82c5b6ff 100644 --- a/nirc_ehr/resources/queries/dbo/q_observations.sql +++ b/nirc_ehr/resources/queries/dbo/q_observations.sql @@ -6,6 +6,10 @@ SELECT anmEvt.ANIMAL_EVENT_ID ELSE (trim(anmEvt.STAFF_ID.STAFF_FIRST_NAME) || '|' || trim(anmEvt.STAFF_ID.STAFF_LAST_NAME)) END) AS performedby, anmEvt.EVENT_ID.NAME AS category, + (CASE + WHEN evtEvtGrp.EVENT_GROUP_ID = 30 THEN 'Clinical' + WHEN evtEvtGrp.EVENT_GROUP_ID = 40 THEN 'Behavior' + ELSE 'Unknown' END) AS type, (CASE WHEN anmEvt.DIAGNOSIS IS NOT NULL THEN (anmCmt.TEXT || ';' || anmEvt.DIAGNOSIS) ELSE anmCmt.TEXT END) AS remark, diff --git a/nirc_ehr/resources/queries/ehr_lookups/buildings.query.xml b/nirc_ehr/resources/queries/ehr_lookups/buildings.query.xml index 4f5be2da..d48f87e4 100644 --- a/nirc_ehr/resources/queries/ehr_lookups/buildings.query.xml +++ b/nirc_ehr/resources/queries/ehr_lookups/buildings.query.xml @@ -3,7 +3,11 @@ Buildings - + + Area diff --git a/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml b/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml index 38e4ed5e..70c5f5bb 100644 --- a/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml +++ b/nirc_ehr/resources/queries/study/cases/All Clinical Cases.qview.xml @@ -23,8 +23,6 @@ - - diff --git a/nirc_ehr/resources/queries/study/observationSchedule/.qview.xml b/nirc_ehr/resources/queries/study/observationSchedule/.qview.xml index 4811d807..5d3d219a 100644 --- a/nirc_ehr/resources/queries/study/observationSchedule/.qview.xml +++ b/nirc_ehr/resources/queries/study/observationSchedule/.qview.xml @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/prcSchedule/.qview.xml b/nirc_ehr/resources/queries/study/prcSchedule/.qview.xml index f96027d5..2f1a2f17 100644 --- a/nirc_ehr/resources/queries/study/prcSchedule/.qview.xml +++ b/nirc_ehr/resources/queries/study/prcSchedule/.qview.xml @@ -3,7 +3,7 @@ - + @@ -17,7 +17,7 @@ - + \ No newline at end of file diff --git a/nirc_ehr/resources/queries/study/treatmentSchedule/.qview.xml b/nirc_ehr/resources/queries/study/treatmentSchedule/.qview.xml index 2c883832..ae1cbb85 100644 --- a/nirc_ehr/resources/queries/study/treatmentSchedule/.qview.xml +++ b/nirc_ehr/resources/queries/study/treatmentSchedule/.qview.xml @@ -3,7 +3,7 @@ - + @@ -22,7 +22,7 @@ - + diff --git a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml index 3c70879e..277987f0 100644 --- a/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml +++ b/nirc_ehr/resources/referenceStudy/study/datasets/datasets_metadata.xml @@ -1127,14 +1127,6 @@ Case category varchar - - Open Diagnosis - varchar - - - Close Diagnosis - varchar - Open Remark varchar diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehavioralCase.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehavioralCase.js index 948eb813..89a6dce4 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/BehavioralCase.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/BehavioralCase.js @@ -91,12 +91,6 @@ EHR.model.DataModelManager.registerMetadata('BehavioralCase', { qcstate: { hidden: true }, - openDiagnosis: { - hidden: true - }, - closeDiagnosis: { - hidden: true - }, attachmentFile: { hidden: 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 29af7961..44b15645 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js @@ -91,12 +91,6 @@ EHR.model.DataModelManager.registerMetadata('ClinicalCase', { qcstate: { hidden: true }, - openDiagnosis: { - hidden: true - }, - closeDiagnosis: { - hidden: true - }, attachmentFile: { hidden: true }, diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js index c67457a4..6d9d0043 100644 --- a/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js +++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js @@ -139,12 +139,6 @@ EHR.model.DataModelManager.registerMetadata('ClinicalDefaults', { qcstate: { hidden: true }, - openDiagnosis: { - hidden: true - }, - closeDiagnosis: { - hidden: true - }, attachmentFile: { hidden: true }, diff --git a/nirc_ehr/resources/web/nirc_ehr/window/AddAnimalsWindow.js b/nirc_ehr/resources/web/nirc_ehr/window/AddAnimalsWindow.js index 07cea917..f0e939fd 100644 --- a/nirc_ehr/resources/web/nirc_ehr/window/AddAnimalsWindow.js +++ b/nirc_ehr/resources/web/nirc_ehr/window/AddAnimalsWindow.js @@ -1,6 +1,7 @@ Ext4.define('NIRC_EHR.window.AddAnimalsWindow', { extend: 'EHR.window.AddAnimalsWindow', + upperCaseAnimalId: true, initComponent: function(){ this.callParent(arguments); diff --git a/nirc_ehr/resources/web/nirc_ehr/window/FormBulkAddWindow.js b/nirc_ehr/resources/web/nirc_ehr/window/FormBulkAddWindow.js new file mode 100644 index 00000000..283d80ee --- /dev/null +++ b/nirc_ehr/resources/web/nirc_ehr/window/FormBulkAddWindow.js @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * @cfg targetStore + */ + +EHR.DataEntryUtils.registerGridButton('NIRC_FORM_BULK_ADD', function(config){ + return Ext4.Object.merge({ + text: 'Add From File', + tooltip: 'Click to bulk import records from an Excel or TSV file.', + handler: function(btn){ + const grid = btn.up('grid'); + LDK.Assert.assertNotEmpty('Unable to find grid in FORM_BULK_ADD button', grid); + + Ext4.create('EHR.window.FormBulkAddWindow', { + targetStore: grid.store, + upperCaseAnimalId: true, + }).show(); + } + }); +}); diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBirthFormType.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBirthFormType.java index 7e4279b6..bd170279 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBirthFormType.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/form/NIRCBirthFormType.java @@ -30,6 +30,7 @@ public NIRCBirthFormType (DataEntryFormContext ctx, Module owner) addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/plugin/RowEditor.js")); addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/NIRCDefault.js")); addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/model/sources/Birth.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/AddAnimalsWindow.js")); for (FormSection s : getFormSections()) { diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/BaseFormSection.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/BaseFormSection.java index 59ff77ad..5c6ea9a5 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/BaseFormSection.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/BaseFormSection.java @@ -70,6 +70,9 @@ public BaseFormSection(String schemaName, String queryName, String label, String addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/AddAnimalsWindow.js")); addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/field/LocationField.js")); addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/CopyFromSectionWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("ehr/window/FormBulkAddWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/FormBulkAddWindow.js")); + setSupportFormSort(false); } @@ -105,7 +108,7 @@ public List getTbarMoreActionButtons() { List defaultButtons = super.getTbarMoreActionButtons(); defaultButtons.remove("GUESSPROJECT"); -// defaultButtons.add("FORM_BULK_ADD"); + defaultButtons.add("NIRC_FORM_BULK_ADD"); return defaultButtons; } diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCBirthFormSection.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCBirthFormSection.java index 72c680ed..5ebfcd5c 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCBirthFormSection.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCBirthFormSection.java @@ -5,6 +5,7 @@ import org.labkey.api.ehr.dataentry.DataEntryFormContext; import org.labkey.api.ehr.dataentry.forms.NewAnimalFormSection; import org.labkey.api.query.FieldKey; +import org.labkey.api.view.template.ClientDependency; import java.util.List; @@ -13,6 +14,8 @@ public class NIRCBirthFormSection extends NewAnimalFormSection public NIRCBirthFormSection() { super("study", "birth", "Births", false); + addClientDependency(ClientDependency.supplierFromPath("ehr/window/FormBulkAddWindow.js")); + addClientDependency(ClientDependency.supplierFromPath("nirc_ehr/window/FormBulkAddWindow.js")); } @Override @@ -41,9 +44,16 @@ protected List getFieldKeys(TableInfo ti) @Override public List getTbarButtons() { - List defaults = super.getTbarButtons(); - defaults.remove("COPYFROMSECTION"); - return defaults; + List defaultButtons = super.getTbarButtons(); + + int idx = defaultButtons.indexOf("ADDANIMALS"); + if (idx > -1) + { + defaultButtons.remove(idx); + defaultButtons.add(idx, "NIRC_ADDANIMALS"); + } + defaultButtons.remove("COPYFROMSECTION"); + return defaultButtons; } @Override @@ -51,6 +61,7 @@ public List getTbarMoreActionButtons() { List defaultButtons = super.getTbarMoreActionButtons(); defaultButtons.remove("GUESSPROJECT"); + defaultButtons.add("NIRC_FORM_BULK_ADD"); return defaultButtons; } } \ No newline at end of file diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRSharedDatasetTrigger.java b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRSharedDatasetTrigger.java index a7c9c3c9..707796c9 100644 --- a/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRSharedDatasetTrigger.java +++ b/nirc_ehr/src/org/labkey/nirc_ehr/table/NIRC_EHRSharedDatasetTrigger.java @@ -16,7 +16,7 @@ public class NIRC_EHRSharedDatasetTrigger implements Trigger { private void transformAnimalIdToUpperCase(Map row) { - if (row != null && row.containsValue("Id")) + if (row != null && row.containsKey("Id")) { row.put("Id", ((String) row.get("Id")).toUpperCase()); }