From d7b04af54b96c9e36c08aef73affea3d0c7237fe Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Sun, 2 Aug 2026 18:35:26 -0600 Subject: [PATCH] Display flag descriptions instead of flag values The study.flags lookup now keys on flag value and displays the description, so the snapshot panel, the data entry combo and the default grid all render : . Also seeds the flag category and value lookups from the module and allows future-dated flag records. --- nbri_ehr/resources/data/flag_categories.tsv | 11 ++++++++++ nbri_ehr/resources/data/flag_values.tsv | 11 ++++++++++ nbri_ehr/resources/data/lookupsManifest.tsv | 2 ++ .../resources/data/lookupsManifestTest.tsv | 3 +++ .../queries/ehr_lookups/flag_values.query.xml | 13 ++++++++++++ .../resources/queries/study/flags.query.xml | 4 ++-- .../resources/queries/study/flags/.qview.xml | 2 +- nbri_ehr/resources/scripts/nbri_triggers.js | 6 ++++++ .../web/nbri_ehr/model/sources/NBRIDefault.js | 4 ++-- .../web/nbri_ehr/panel/SnapshotPanel.js | 4 ++++ .../ActiveFlagsDemographicsProvider.java | 1 + .../study/study/datasets/datasetFlags.tsv | 20 +++++++++---------- 12 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 nbri_ehr/resources/data/flag_categories.tsv create mode 100644 nbri_ehr/resources/data/flag_values.tsv create mode 100644 nbri_ehr/resources/queries/ehr_lookups/flag_values.query.xml diff --git a/nbri_ehr/resources/data/flag_categories.tsv b/nbri_ehr/resources/data/flag_categories.tsv new file mode 100644 index 0000000..2e815bf --- /dev/null +++ b/nbri_ehr/resources/data/flag_categories.tsv @@ -0,0 +1,11 @@ +Category Description Enforce Single Flag Per Animal? Omit When Displaying Default Flags? Highlight Flags of This Category? Date Disabled +Behavioral Behavioral observations, abnormal-behavior designations and enrichment provided to the animal. false false false +Capture Restraint and handling limitations. false false true +Clinical Clinical conditions, procedures and veterinary designations. false false false +Experimental Experimental treatments, inoculations and implants. false false true +Genetics Genetic background, ancestry, inbreeding and genomic characterization. false true false +Hold Animal held or reserved for a specific project, investigator or shipment. false false false +Reproduction Breeding, contraception, pregnancy, fostering and rearing designations. false false false +Socially housed Social rank, pairing, group-formation and social-housing-exemption designations. false false false +Status Administrative status and availability designations. false false true +Training Training program participation and progress. false false false diff --git a/nbri_ehr/resources/data/flag_values.tsv b/nbri_ehr/resources/data/flag_values.tsv new file mode 100644 index 0000000..8a075a7 --- /dev/null +++ b/nbri_ehr/resources/data/flag_values.tsv @@ -0,0 +1,11 @@ +Category Meaning Description Date Disabled ObjectId +Behavioral Behavioral FLAG 1 Behavioral FLAG 1 +Capture Capture FLAG 1 Capture FLAG 1 +Clinical Clinical FLAG 1 Clinical FLAG 1 +Experimental Experimental FLAG 1 Experimental FLAG 1 +Genetics Genetics FLAG 1 Genetics FLAG 1 +Hold Hold FLAG 1 Hold FLAG 1 +Reproduction Reproduction FLAG 1 Reproduction FLAG 1 +Socially housed Socially housed FLAG 1 Socially housed FLAG 1 +Status Status FLAG 1 Status FLAG 1 +Training Training FLAG 1 Training FLAG 1 diff --git a/nbri_ehr/resources/data/lookupsManifest.tsv b/nbri_ehr/resources/data/lookupsManifest.tsv index 472d51d..1f6896d 100644 --- a/nbri_ehr/resources/data/lookupsManifest.tsv +++ b/nbri_ehr/resources/data/lookupsManifest.tsv @@ -54,6 +54,8 @@ expense_class fecal_score fecal_smear_score feed_assess_types +flag_categories +flag_values gastro_types gender_codes general_obs diff --git a/nbri_ehr/resources/data/lookupsManifestTest.tsv b/nbri_ehr/resources/data/lookupsManifestTest.tsv index b8946ef..131bdbc 100644 --- a/nbri_ehr/resources/data/lookupsManifestTest.tsv +++ b/nbri_ehr/resources/data/lookupsManifestTest.tsv @@ -12,6 +12,7 @@ amount_units app_score arrival_type arthritis_types +att_score bandage_observations bcs_score behavior_abnormality @@ -53,6 +54,8 @@ expense_class fecal_score fecal_smear_score feed_assess_types +flag_categories +flag_values gastro_types gender_codes general_obs diff --git a/nbri_ehr/resources/queries/ehr_lookups/flag_values.query.xml b/nbri_ehr/resources/queries/ehr_lookups/flag_values.query.xml new file mode 100644 index 0000000..c6531be --- /dev/null +++ b/nbri_ehr/resources/queries/ehr_lookups/flag_values.query.xml @@ -0,0 +1,13 @@ + + + + + + + Value + + +
+
+
+
diff --git a/nbri_ehr/resources/queries/study/flags.query.xml b/nbri_ehr/resources/queries/study/flags.query.xml index 570a645..00a8119 100644 --- a/nbri_ehr/resources/queries/study/flags.query.xml +++ b/nbri_ehr/resources/queries/study/flags.query.xml @@ -23,8 +23,8 @@ ehr_lookups flag_values - objectid - value + value + Description diff --git a/nbri_ehr/resources/queries/study/flags/.qview.xml b/nbri_ehr/resources/queries/study/flags/.qview.xml index bf12e57..68dece5 100644 --- a/nbri_ehr/resources/queries/study/flags/.qview.xml +++ b/nbri_ehr/resources/queries/study/flags/.qview.xml @@ -7,7 +7,7 @@ - + diff --git a/nbri_ehr/resources/scripts/nbri_triggers.js b/nbri_ehr/resources/scripts/nbri_triggers.js index 190f656..16b2ddc 100644 --- a/nbri_ehr/resources/scripts/nbri_triggers.js +++ b/nbri_ehr/resources/scripts/nbri_triggers.js @@ -115,6 +115,12 @@ exports.init = function (EHR) { }); }); + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.INIT, 'study', 'flags', function(event, helper) { + helper.setScriptOptions({ + allowFutureDates: true, + }); + }); + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.INIT, 'study', 'treatment_order', function(event, helper) { helper.setScriptOptions({ allowFutureDates: true, diff --git a/nbri_ehr/resources/web/nbri_ehr/model/sources/NBRIDefault.js b/nbri_ehr/resources/web/nbri_ehr/model/sources/NBRIDefault.js index c5971be..ea19076 100644 --- a/nbri_ehr/resources/web/nbri_ehr/model/sources/NBRIDefault.js +++ b/nbri_ehr/resources/web/nbri_ehr/model/sources/NBRIDefault.js @@ -327,7 +327,7 @@ EHR.model.DataModelManager.registerMetadata('Default', { flag: { allowBlank: false, lookup: { - columns: 'objectid,value,category,code', + columns: 'objectid,value,description,category,code', sort: 'category,code,value', filterArray: [LABKEY.Filter.create('datedisabled', null, LABKEY.Filter.Types.ISBLANK)] }, @@ -341,7 +341,7 @@ EHR.model.DataModelManager.registerMetadata('Default', { allowChooseOther: false })], listConfig: { - innerTpl: '{[(values.category ? ("" + LABKEY.Utils.encodeHtml(values.category) + ": ") : "") + LABKEY.Utils.encodeHtml(values.value)]}', + innerTpl: '{[(values.category ? ("" + LABKEY.Utils.encodeHtml(values.category) + ": ") : "") + LABKEY.Utils.encodeHtml(values.description || values.value)]}', getInnerTpl: function () { return this.innerTpl; } diff --git a/nbri_ehr/resources/web/nbri_ehr/panel/SnapshotPanel.js b/nbri_ehr/resources/web/nbri_ehr/panel/SnapshotPanel.js index dd59726..bfdb0fd 100644 --- a/nbri_ehr/resources/web/nbri_ehr/panel/SnapshotPanel.js +++ b/nbri_ehr/resources/web/nbri_ehr/panel/SnapshotPanel.js @@ -228,6 +228,10 @@ Ext4.define('NBRI_EHR.panel.SnapshotPanel', { toSet['flags'] = values.length ? '' + values.join('
') + '' : null; }, + getFlagDisplayValue: function(row) { + return row['flag/description'] || row['flag/value']; + }, + appendAssignments: function(toSet, results){ toSet['projectAssignment'] = null; diff --git a/nbri_ehr/src/org/labkey/nbri_ehr/demographics/ActiveFlagsDemographicsProvider.java b/nbri_ehr/src/org/labkey/nbri_ehr/demographics/ActiveFlagsDemographicsProvider.java index d327a44..f012b8a 100644 --- a/nbri_ehr/src/org/labkey/nbri_ehr/demographics/ActiveFlagsDemographicsProvider.java +++ b/nbri_ehr/src/org/labkey/nbri_ehr/demographics/ActiveFlagsDemographicsProvider.java @@ -47,6 +47,7 @@ protected Set getFieldKeys() keys.add(FieldKey.fromString("flag")); keys.add(FieldKey.fromString("flag/category")); keys.add(FieldKey.fromString("flag/value")); + keys.add(FieldKey.fromString("flag/description")); keys.add(FieldKey.fromString("performedby")); keys.add(FieldKey.fromString("remark")); diff --git a/nbri_ehr/test/sampledata/nbri_ehr/study/study/datasets/datasetFlags.tsv b/nbri_ehr/test/sampledata/nbri_ehr/study/study/datasets/datasetFlags.tsv index 45004d8..ce33d90 100644 --- a/nbri_ehr/test/sampledata/nbri_ehr/study/study/datasets/datasetFlags.tsv +++ b/nbri_ehr/test/sampledata/nbri_ehr/study/study/datasets/datasetFlags.tsv @@ -1,11 +1,11 @@ objectId Id date enddate flag QCStateLabel performedby -1 TEST3804589 -2187d -2178d 1 Completed 1004 -2 TEST4551032 -2243d -2213d 2 Completed 1004 -3 TEST5904521 -2215d -2186d 3 Completed 1004 -4 TEST1112911 -2215d 4 Completed 1004 -5 TEST1112911 -2215d 5 Completed 1004 -6 44444 -1423d -560d 3 Completed 1004 -7 44444 -1423d -560d 1 Completed 1004 -10 44444 -1208d 3 Completed 1004 -8 44446 -1208d 3 Completed 1004 -9 TSTCP -1423d -560d 3 Completed 1004 +1 TEST3804589 -2187d -2178d Behavioral FLAG 1 Completed 1004 +2 TEST4551032 -2243d -2213d Capture FLAG 1 Completed 1004 +3 TEST5904521 -2215d -2186d Clinical FLAG 1 Completed 1004 +4 TEST1112911 -2215d Experimental FLAG 1 Completed 1004 +5 TEST1112911 -2215d Genetics FLAG 1 Completed 1004 +6 44444 -1423d -560d Clinical FLAG 1 Completed 1004 +7 44444 -1423d -560d Behavioral FLAG 1 Completed 1004 +10 44444 -1208d Clinical FLAG 1 Completed 1004 +8 44446 -1208d Clinical FLAG 1 Completed 1004 +9 TSTCP -1423d -560d Clinical FLAG 1 Completed 1004