From fd0ed7fa164713be75d1b5a12a577ac9838550a5 Mon Sep 17 00:00:00 2001 From: kollil Date: Thu, 13 Oct 2022 17:44:29 -0700 Subject: [PATCH 01/14] Changed the notifications. --- .../web/onprc_ehr/model/sources/PMIC_PET.js | 4 +- .../ClinicalRoundsNotification.java | 115 +++++++++++++++++- .../notification/VetReviewNotification.java | 9 +- 3 files changed, 120 insertions(+), 8 deletions(-) diff --git a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js index 33402f046..4ad181461 100644 --- a/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js +++ b/onprc_ehr/resources/web/onprc_ehr/model/sources/PMIC_PET.js @@ -34,8 +34,8 @@ EHR.model.DataModelManager.registerMetadata('PET', { chargeType: { allowBlank: true, hidden: false, - defaultValue: 'PMIC' - + defaultValue: 'PMIC', + editable: false }, examNum: { diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java index 2c719c49d..fb3ad3192 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -62,21 +62,27 @@ public String getEmailSubject(Container c) } @Override +// public String getCronString() +// { +// return "0 0 15 * * ?"; +// } + + //Kollil 10/13: Changed the daily alert to Tuesdays and Thursdays public String getCronString() { - return "0 0 15 * * ?"; + return "0 0 15 ? * TUE,THU"; } @Override public String getScheduleDescription() { - return "every day at 3PM"; + return "every Tuesday & Thursday at 3PM"; } @Override public String getDescription() { - return "The report is designed alert if there are any animals without rounds observations entered or lacking vet review"; + return "The report is designed to alert if there are any animals without rounds observations entered or lacking vet review. Also, contains the report to alert for Clinical rounds observations entered today, and not entered recently"; } @Override @@ -88,6 +94,10 @@ public String getMessageBodyHTML(Container c, User u) animalsWithoutRounds(c, u, msg); //animalsWithoutVetReview(c, u, msg); + //Clinical process alerts : kollil byt 10/13 + animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa + animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + return msg.toString(); } @@ -188,4 +198,101 @@ public void exec(ResultSet object) throws SQLException msg.append("
\n"); } } -} + + //Clinical process alerts + protected void animalsWithoutRounds2(final Container c, User u, final StringBuilder msg) + { + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.GT); + filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); + + TableInfo ti = getStudySchema(c, u).getTable("cases"); + Set keys = new HashSet<>(); + keys.add(FieldKey.fromString("Id")); + keys.add(FieldKey.fromString("Id/curLocation/room")); + keys.add(FieldKey.fromString("Id/curLocation/cage")); + keys.add(FieldKey.fromString("daysSinceLastRounds")); + keys.add(FieldKey.fromString("assignedvet/DisplayName")); + keys.add(FieldKey.fromString("allProblemCategories")); + final Map cols = QueryService.get().getColumns(ti, keys); + + TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); + long count = ts.getRowCount(); + if (count > 0) + { + msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); + msg.append(""); + msg.append(""); + + ts.forEach(new Selector.ForEachBlock() + { + @Override + public void exec(ResultSet object) throws SQLException + { + Results rs = new ResultsImpl(object, cols); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + } + }); + + msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "
"); + msg.append("
\n"); + } + } + + //Modified: 8-15-2016 R.Blasa Show Clinical open cases that were entered + protected void animalsWithRounds(final Container c, User u, final StringBuilder msg) + { + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); + filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); + + TableInfo ti = getStudySchema(c, u).getTable("cases"); + Set keys = new HashSet<>(); + keys.add(FieldKey.fromString("Id")); + keys.add(FieldKey.fromString("Id/curLocation/room")); + keys.add(FieldKey.fromString("Id/curLocation/cage")); + keys.add(FieldKey.fromString("daysSinceLastRounds")); + keys.add(FieldKey.fromString("assignedvet/DisplayName")); + keys.add(FieldKey.fromString("allProblemCategories")); + final Map cols = QueryService.get().getColumns(ti, keys); + + TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); + long count = ts.getRowCount(); + if (count > 0) + { + msg.append("CONFIRMATION: There are " + count + " active cases that have their obs entered today.
"); + msg.append(""); + msg.append(""); + + ts.forEach(new Selector.ForEachBlock() + { + @Override + public void exec(ResultSet object) throws SQLException + { + Results rs = new ResultsImpl(object, cols); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + + msg.append(""); + } + }); + + msg.append("
RoomCageIdAssigned VetProblem(s)
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "
"); + msg.append("
\n"); + } + } + + } diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java index 3e30b8c7e..e454b213d 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java @@ -63,15 +63,20 @@ public String getEmailSubject(Container c) } @Override +// public String getCronString() +// { +// return "0 0 15 * * ?"; +// } + //Kollil 10/13: Changed the daily alert to once a week, Wednesdays public String getCronString() { - return "0 0 15 * * ?"; + return "0 0 15 ? * WED"; } @Override public String getScheduleDescription() { - return "daily at 3PM"; + return "every Wednesday at 3PM"; } @Override From 31394bb47742122edaaf0a932d0e8d61f15a9784 Mon Sep 17 00:00:00 2001 From: kollil Date: Mon, 17 Oct 2022 15:55:01 -0700 Subject: [PATCH 02/14] Update the alert code. --- .../ClinicalRoundsNotification.java | 109 ++++++++++-------- 1 file changed, 59 insertions(+), 50 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java index fb3ad3192..7bfbfce88 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -90,13 +90,13 @@ public String getMessageBodyHTML(Container c, User u) { StringBuilder msg = new StringBuilder(); - duplicateCases(c, u, msg); + //duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - //animalsWithoutVetReview(c, u, msg); + animalsWithoutVetReview(c, u, msg); - //Clinical process alerts : kollil byt 10/13 + //Clinical process alerts : Kollil, 10/13/22 animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa - animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 return msg.toString(); } @@ -122,6 +122,7 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild long count = ts.getRowCount(); if (count > 0) { + msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); msg.append(""); msg.append(""); @@ -173,6 +174,7 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu long count = ts.getRowCount(); if (count > 0) { + msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
"); msg.append(""); @@ -200,52 +202,7 @@ public void exec(ResultSet object) throws SQLException } //Clinical process alerts - protected void animalsWithoutRounds2(final Container c, User u, final StringBuilder msg) - { - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.GT); - filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); - - TableInfo ti = getStudySchema(c, u).getTable("cases"); - Set keys = new HashSet<>(); - keys.add(FieldKey.fromString("Id")); - keys.add(FieldKey.fromString("Id/curLocation/room")); - keys.add(FieldKey.fromString("Id/curLocation/cage")); - keys.add(FieldKey.fromString("daysSinceLastRounds")); - keys.add(FieldKey.fromString("assignedvet/DisplayName")); - keys.add(FieldKey.fromString("allProblemCategories")); - final Map cols = QueryService.get().getColumns(ti, keys); - - TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); - long count = ts.getRowCount(); - if (count > 0) - { - msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); - msg.append("
RoomCageIdAssigned VetProblem(s)Days Since last Vet Review
"); - msg.append(""); - - ts.forEach(new Selector.ForEachBlock() - { - @Override - public void exec(ResultSet object) throws SQLException - { - Results rs = new ResultsImpl(object, cols); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - } - }); - - msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "
"); - msg.append("
\n"); - } - } +// //Modified: 8-15-2016 R.Blasa Show Clinical open cases that were entered protected void animalsWithRounds(final Container c, User u, final StringBuilder msg) @@ -267,8 +224,10 @@ protected void animalsWithRounds(final Container c, User u, final StringBuilder TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); long count = ts.getRowCount(); + if (count > 0) { + msg.append("Clinical Rounds Process Alerts: Active cases that have observations.
"); msg.append("CONFIRMATION: There are " + count + " active cases that have their obs entered today.
"); msg.append(""); msg.append(""); @@ -295,4 +254,54 @@ public void exec(ResultSet object) throws SQLException } } + + // protected void animalsWithoutRounds2(final Container c, User u, final StringBuilder msg) +// { +// SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.GT); +// filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); +// filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); +// filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); +// +// TableInfo ti = getStudySchema(c, u).getTable("cases"); +// Set keys = new HashSet<>(); +// keys.add(FieldKey.fromString("Id")); +// keys.add(FieldKey.fromString("Id/curLocation/room")); +// keys.add(FieldKey.fromString("Id/curLocation/cage")); +// keys.add(FieldKey.fromString("daysSinceLastRounds")); +// keys.add(FieldKey.fromString("assignedvet/DisplayName")); +// keys.add(FieldKey.fromString("allProblemCategories")); +// final Map cols = QueryService.get().getColumns(ti, keys); +// +// TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); +// long count = ts.getRowCount(); +// +// if (count > 0) +// { +// msg.append("Clinical Rounds Process Alerts: Active cases that do not have observations entered today.
"); +// msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); +// msg.append("
RoomCageIdAssigned VetProblem(s)
"); +// msg.append(""); +// +// ts.forEach(new Selector.ForEachBlock() +// { +// @Override +// public void exec(ResultSet object) throws SQLException +// { +// Results rs = new ResultsImpl(object, cols); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// msg.append(""); +// } +// }); +// +// msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "
"); +// msg.append("
\n"); +// } +// } + } From 82b00476fb1703d37db40362454f319c809c28b3 Mon Sep 17 00:00:00 2001 From: kollil Date: Mon, 17 Oct 2022 18:29:48 -0700 Subject: [PATCH 03/14] Updated #2 --- .../notification/ClinicalRoundsNotification.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java index 7bfbfce88..e1324b62b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -90,9 +90,9 @@ public String getMessageBodyHTML(Container c, User u) { StringBuilder msg = new StringBuilder(); - //duplicateCases(c, u, msg); + duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - animalsWithoutVetReview(c, u, msg); + animalsWithoutVetReview(c, u, msg); //Clinical process alerts : Kollil, 10/13/22 animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa @@ -123,7 +123,7 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild if (count > 0) { msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); - msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); + msg.append("WARNING: " + count + " active case(s) found that do not have obs entered today.
"); msg.append(""); msg.append(""); @@ -175,7 +175,7 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu if (count > 0) { msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); - msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); + msg.append("WARNING: " + count + " active case(s) found that have not been vet reviewed in the past 7 days.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
"); msg.append(""); @@ -228,7 +228,7 @@ protected void animalsWithRounds(final Container c, User u, final StringBuilder if (count > 0) { msg.append("Clinical Rounds Process Alerts: Active cases that have observations.
"); - msg.append("CONFIRMATION: There are " + count + " active cases that have their obs entered today.
"); + msg.append("CONFIRMATION: " + count + " active case(s) found that have their obs entered today.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since last Vet Review
"); msg.append(""); From 77d2d5f49a6e9e3abc5e3fa0f15b809446d76295 Mon Sep 17 00:00:00 2001 From: kollil Date: Mon, 12 Dec 2022 11:37:30 -0800 Subject: [PATCH 04/14] This update deletes the hard table that was created to store the pain categories and used the ehr_lookups.lookups and ehr_lookups.lookupsets to create the data via UI. --- .../resources/queries/ehr_lookups/Procedure_Pain_Categories.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql diff --git a/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql b/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql new file mode 100644 index 000000000..ac32cfc85 --- /dev/null +++ b/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql @@ -0,0 +1 @@ +SELECT rowid, value FROM ehr_lookups.lookups l WHERE l.set_name = 'Procedure_Pain_Categories' order by sort_order \ No newline at end of file From 757b8a385c093baa922e1e02bf899ecc00b45d3a Mon Sep 17 00:00:00 2001 From: kollil Date: Fri, 30 Dec 2022 13:29:19 -0800 Subject: [PATCH 05/14] USDA pain level alert --- .../ehr_lookups/Procedure_Pain_Categories.sql | 1 - .../Procedures_Missing_PainLevels.sql | 9 ++ .../scripts/onprc_ehr/onprc_triggers.js | 34 ++++++ .../org/labkey/onprc_ehr/ONPRC_EHRModule.java | 3 + .../ColonyAlertsNotification.java | 34 +++++- .../notification/USDAPainNotification.java | 102 ++++++++++++++++++ 6 files changed, 180 insertions(+), 3 deletions(-) delete mode 100644 onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql create mode 100644 onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql create mode 100644 onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java diff --git a/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql b/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql deleted file mode 100644 index ac32cfc85..000000000 --- a/onprc_ehr/resources/queries/ehr_lookups/Procedure_Pain_Categories.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT rowid, value FROM ehr_lookups.lookups l WHERE l.set_name = 'Procedure_Pain_Categories' order by sort_order \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql new file mode 100644 index 000000000..0ed5ded83 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql @@ -0,0 +1,9 @@ +Select + e.id, + e.project, + e.date, + e.procedureid, + p.PainCategories +From study.encounters e, ehr_lookups.procedures p +Where e.procedureid = p.rowid +And p.PainCategories IS NULL \ No newline at end of file diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index f8d1f8ea6..d198ef090 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -379,6 +379,30 @@ exports.init = function(EHR){ } }); + // Added by Kollil, 12/22/2022: USDA Pain category validation: + /* This is user input validation for Procedures panel + 1. Stop the user if the user attempts to fill in USDA pain level while creating / modifying a procedure other than the IS team personnel. + */ + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'ehr_lookups', 'procedures', function(helper, scriptErrors, row, oldRow) { + //console.log(" 0. procedure: " + row.procedureid + ", ins: " + row.instructions); + + // When users other than IS team entering the procedure data, stop them until they clear the USDA pain level field data + /* + Lakshmi Kolli - 1008 + Gary Jones - 1011 + Raymond Blasa - 1007 + Lindsay Amor - 2217 + Brent Logan - 2933 + */ + if (row.PainCategories != null) { + if ( LABKEY.Security.currentUser.id !== 1008 || LABKEY.Security.currentUser.id !== 1007 || LABKEY.Security.currentUser.id !== 1011 || LABKEY.Security.currentUser.id !== 2217 || LABKEY.Security.currentUser.id !== 2933 ) + { + EHR.Server.Utils.addError(scriptErrors, 'PainCategories', 'The USDA Pain level field must be left blank if the user is not from IS team!', 'WARN'); + } + } + + }); + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'encounters', function(helper, scriptErrors, row, oldRow) { if (row.chargetype == 'Research Staff' && !row.assistingstaff && row.procedureid && triggerHelper.requiresAssistingStaff(row.procedureid)) @@ -1155,6 +1179,16 @@ exports.init = function(EHR){ } }); + //Added by Kollil, 12-22-2022 + EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'encounters', function (helper, scriptErrors, row, oldRow) { + + helper.decodeExtraContextProperty('MiscChargesInTransaction'); + var miscChargesInTransaction = helper.getProperty('MiscChargesInTransaction'); + + if (miscChargesInTransaction && miscChargesInTransaction['miscChargesEntered'] === 0) { + EHR.Server.Utils.addError(scriptErrors, 'Id', 'billing charges grid requires at least one row', 'WARN'); + } + }); //Added 3-5-2019 R.Blasa EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_INSERT, 'ehr', 'project', function(helper, scriptErrors, row, oldRow){ diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java index 90e2f2a96..fed9f9c61 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java @@ -200,6 +200,9 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext) //Added Mar 18th, 2021 Kollil ns.registerNotification(new HousingTransferNotification(this)); + //Added Dec 2022, Kollil + ns.registerNotification(new USDAPainNotification(this)); + //Added 8-7-2018 R.Blasa ns.registerNotification(new BirthHousingMismatchNotification(this)); diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 91540b6dc..890775494 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -722,7 +722,6 @@ protected void recordsEnteredMoreThan7DaysAfter(final Container c, User u, final } - /** * find the total finalized records with future dates */ @@ -1338,7 +1337,38 @@ protected void pmicServicesRequestAlert(final Container c, User u, final StringB msg.append("WARNING: There are no scheduled PMIC procedures!

"); } } - //End of PMIC services alert + //End of PMIC alert + + /** + * Kollil, 12/22/2022 : Find the procedure entries where the PainCategory on the procedure is not defined (IS NULL). + * This report is sent to Jeff once a week so he will fill in the missing pain category on the procedure. + */ + protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final StringBuilder msg) + { + if (QueryService.get().getUserSchema(u, c, "onprc_ehr") == null) { + msg.append("Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!


"); + return; + } + + //procedures query + TableInfo ti = QueryService.get().getUserSchema(u, c, "onprc_ehr").getTable("Procedures_Missing_PainLevels", ContainerFilter.Type.AllFolders.create(c, u)); + //((ContainerFilterable) ti).setContainerFilter(ContainerFilter.Type.AllFolders.create(c, u)); + TableSelector ts = new TableSelector(ti, null, null); + long count = ts.getRowCount(); + + if (count > 0) {//procedures count + msg.append("
Procedure with missing USDA pain levels:

"); + msg.append("" + count + " procedure(s) found:"); + msg.append("

Click here to view the transfers in PRIME

\n"); + msg.append("
"); + } + + if (count == 0) { + msg.append("There are no procedures with missing USDA pain levels!
"); + } + } + //End of USDA Pain levels alert + /** * Kollil, 03/18/2021 : Housing transfer notifications Daily diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java new file mode 100644 index 000000000..401177db1 --- /dev/null +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013-2016 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.onprc_ehr.notification; + +import org.apache.commons.lang3.StringUtils; +import org.labkey.api.data.AbstractTableInfo; +import org.labkey.api.data.CompareType; +import org.labkey.api.data.Container; +import org.labkey.api.data.Selector; +import org.labkey.api.data.SimpleFilter; +import org.labkey.api.data.Sort; +import org.labkey.api.data.TableInfo; +import org.labkey.api.data.TableSelector; +import org.labkey.api.ehr.EHRService; +import org.labkey.api.ldk.LDKService; +import org.labkey.api.module.Module; +import org.labkey.api.query.FieldKey; +import org.labkey.api.query.QueryService; +import org.labkey.api.query.UserSchema; +import org.labkey.api.security.User; +import org.labkey.api.settings.AppProps; +import org.labkey.api.util.PageFlowUtil; +import org.labkey.api.data.ColumnInfo; +import org.labkey.api.data.Results; +import org.labkey.api.data.ResultsImpl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Date; +import java.util.Map; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +/** + * User: Kollil + * Date: 12/19/2022 + * Time: 2:25 PM + */ +public class USDAPainNotification extends ColonyAlertsNotification +{ + public USDAPainNotification(Module owner) + { + super(owner); + } + + @Override + public String getName() + { + return "USDA Pain Categories"; + } + + @Override + public String getEmailSubject(Container c) + { + return "Procedure(s) with missing USDA Pain categories: " + getDateTimeFormat(c).format(new Date()); + } + + @Override + public String getCronString() + { + return "0 30 7 ? * THU"; + } + + @Override + public String getScheduleDescription() + { + return "every Thursday at 7:30Am"; + } + + @Override + public String getDescription() + { + return "The report is designed to provide a list of procedures with no USDA pain categories."; + } + + @Override + public String getMessageBodyHTML(Container c, User u) + { + StringBuilder msg = new StringBuilder(); + + proceduresWithoutUSDAPainLevels(c, u, msg); + + return msg.toString(); + } + +} From 31b891c51af78ae7f0a2e8c53e048c6271a316ac Mon Sep 17 00:00:00 2001 From: kollil Date: Thu, 5 Jan 2023 17:06:09 -0800 Subject: [PATCH 06/14] USDA pain level alert --- .../org/labkey/onprc_ehr/notification/USDAPainNotification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java index 401177db1..5506a3a99 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java @@ -68,7 +68,7 @@ public String getName() @Override public String getEmailSubject(Container c) { - return "Procedure(s) with missing USDA Pain categories: " + getDateTimeFormat(c).format(new Date()); + return "Procedure(s) with missing USDA pain categories: " + getDateTimeFormat(c).format(new Date()); } @Override From 59709d7c0f369076cb00b2b5fd37c076e5fb61de Mon Sep 17 00:00:00 2001 From: kollil Date: Tue, 10 Jan 2023 14:05:36 -0800 Subject: [PATCH 07/14] updated the alert to show the data in the email. --- .../Procedures_Missing_PainLevels.sql | 3 +- .../ColonyAlertsNotification.java | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql index 0ed5ded83..920b13844 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql @@ -1,8 +1,9 @@ +-- This query extracts the procedures that were used currently with missing USDA pain categories. Select e.id, e.project, e.date, - e.procedureid, + p.name, p.PainCategories From study.encounters e, ehr_lookups.procedures p Where e.procedureid = p.rowid diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 890775494..916a5f7bb 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1366,6 +1366,43 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final if (count == 0) { msg.append("There are no procedures with missing USDA pain levels!
"); } + + //Display the daily report in the email + if (count > 0) + { + Set columns = new HashSet<>(); + columns.add(FieldKey.fromString("Id")); + columns.add(FieldKey.fromString("project")); + columns.add(FieldKey.fromString("date")); + columns.add(FieldKey.fromString("name")); + columns.add(FieldKey.fromString("PainCategories")); + + final Map colMap = QueryService.get().getColumns(ti, columns); + TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); + + // Table header + msg.append("

RoomCageIdAssigned VetProblem(s)
"); + msg.append(""); + msg.append(""); + + ts2.forEach(new Selector.ForEachBlock() + { + @Override + public void exec(ResultSet object) throws SQLException + { + Results rs = new ResultsImpl(object, colMap); + String url = getParticipantURL(c, rs.getString("Id")); + + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + } + }); + msg.append("
Id Center Project Date Procedure USDA Pain Categories
" + PageFlowUtil.filter(rs.getString("Id")) + "" + PageFlowUtil.filter(rs.getString("project")) + "" + PageFlowUtil.filter(rs.getString("date")) + "" + PageFlowUtil.filter(rs.getString("name")) + "" + PageFlowUtil.filter(rs.getString("PainCategories")) + "
"); + } } //End of USDA Pain levels alert From 438aa0acc0d346311d8bae66160463755185ade0 Mon Sep 17 00:00:00 2001 From: kollil Date: Tue, 10 Jan 2023 17:09:08 -0800 Subject: [PATCH 08/14] updated the verbiage. --- .../labkey/onprc_ehr/notification/ColonyAlertsNotification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 916a5f7bb..14e6d4772 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1359,7 +1359,7 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final if (count > 0) {//procedures count msg.append("
Procedure with missing USDA pain levels:

"); msg.append("" + count + " procedure(s) found:"); - msg.append("

Click here to view the transfers in PRIME

\n"); + msg.append("

Click here to view the procedures in PRIME

\n"); msg.append("
"); } From 06d37c7e887b819b06f33ef8aefec3d92e55dfcd Mon Sep 17 00:00:00 2001 From: kollil Date: Fri, 13 Jan 2023 12:16:41 -0800 Subject: [PATCH 09/14] Added date range to the sql --- .../queries/onprc_ehr/Procedures_Missing_PainLevels.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql index 920b13844..036a8f843 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql @@ -1,4 +1,5 @@ -- This query extracts the procedures that were used currently with missing USDA pain categories. +-- Set the date range to 1 year back from curr date Select e.id, e.project, @@ -7,4 +8,5 @@ Select p.PainCategories From study.encounters e, ehr_lookups.procedures p Where e.procedureid = p.rowid -And p.PainCategories IS NULL \ No newline at end of file +And p.PainCategories IS NULL +And date > timestampadd(SQL_TSI_YEAR,-1,now()) \ No newline at end of file From e8860f67c74bf0a30bf5b4235542150b52e037fe Mon Sep 17 00:00:00 2001 From: kollil Date: Wed, 8 Feb 2023 15:30:42 -0800 Subject: [PATCH 10/14] updated USDA categories query --- .../queries/onprc_ehr/Procedures_Missing_PainLevels.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql index 036a8f843..e01609faf 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.sql @@ -1,4 +1,4 @@ --- This query extracts the procedures that were used currently with missing USDA pain categories. +-- This query extracts the active procedures with missing USDA pain categories. -- Set the date range to 1 year back from curr date Select e.id, @@ -8,5 +8,6 @@ Select p.PainCategories From study.encounters e, ehr_lookups.procedures p Where e.procedureid = p.rowid +And p.active = 'true' And p.PainCategories IS NULL And date > timestampadd(SQL_TSI_YEAR,-1,now()) \ No newline at end of file From c7463b4ffeb2bf1bd78a39a8cc86e3cd637be091 Mon Sep 17 00:00:00 2001 From: kollil Date: Thu, 9 Feb 2023 13:01:55 -0800 Subject: [PATCH 11/14] updated the notification. --- .../onprc_ehr/notification/ColonyAlertsNotification.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 14e6d4772..802ac660b 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1341,7 +1341,7 @@ protected void pmicServicesRequestAlert(final Container c, User u, final StringB /** * Kollil, 12/22/2022 : Find the procedure entries where the PainCategory on the procedure is not defined (IS NULL). - * This report is sent to Jeff once a week so he will fill in the missing pain category on the procedure. + * This email notification is sent to Jeff every Thursday at 7:30am. */ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final StringBuilder msg) { @@ -1357,14 +1357,14 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final long count = ts.getRowCount(); if (count > 0) {//procedures count - msg.append("
Procedure with missing USDA pain levels:

"); + msg.append("
Active procedures with missing USDA categories:

"); msg.append("" + count + " procedure(s) found:"); msg.append("

Click here to view the procedures in PRIME

\n"); msg.append("
"); } if (count == 0) { - msg.append("There are no procedures with missing USDA pain levels!
"); + msg.append("Currently, there are no active procedures with missing USDA categories!
"); } //Display the daily report in the email @@ -1383,7 +1383,7 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final // Table header msg.append("

"); msg.append(""); - msg.append(""); + msg.append(""); ts2.forEach(new Selector.ForEachBlock() { From d9ca87c5fbd05c5de117bddfb4debf85448c7ec5 Mon Sep 17 00:00:00 2001 From: kollil Date: Fri, 10 Feb 2023 12:49:53 -0800 Subject: [PATCH 12/14] updated the notification wording. --- .../onprc_ehr/notification/ColonyAlertsNotification.java | 1 - .../labkey/onprc_ehr/notification/USDAPainNotification.java | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java index 802ac660b..7306ef851 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1406,7 +1406,6 @@ public void exec(ResultSet object) throws SQLException } //End of USDA Pain levels alert - /** * Kollil, 03/18/2021 : Housing transfer notifications Daily */ diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java index 5506a3a99..0028ea098 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java @@ -62,13 +62,13 @@ public USDAPainNotification(Module owner) @Override public String getName() { - return "USDA Pain Categories"; + return "USDA Categories"; } @Override public String getEmailSubject(Container c) { - return "Procedure(s) with missing USDA pain categories: " + getDateTimeFormat(c).format(new Date()); + return "Procedure(s) with missing USDA categories: " + getDateTimeFormat(c).format(new Date()); } @Override @@ -86,7 +86,7 @@ public String getScheduleDescription() @Override public String getDescription() { - return "The report is designed to provide a list of procedures with no USDA pain categories."; + return "The report is designed to provide a list of procedures with no USDA categories."; } @Override From 0d6f8c71272e1d07b3dfbb4f861ae926f7f1e948 Mon Sep 17 00:00:00 2001 From: kollil Date: Wed, 15 Feb 2023 10:36:41 -0800 Subject: [PATCH 13/14] Shelving the unnecessary code changes. --- .../scripts/onprc_ehr/onprc_triggers.js | 13 +- .../ClinicalRoundsNotification.java | 130 +----------------- .../notification/VetReviewNotification.java | 9 +- 3 files changed, 10 insertions(+), 142 deletions(-) diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index d198ef090..417b1c01d 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -397,7 +397,7 @@ exports.init = function(EHR){ if (row.PainCategories != null) { if ( LABKEY.Security.currentUser.id !== 1008 || LABKEY.Security.currentUser.id !== 1007 || LABKEY.Security.currentUser.id !== 1011 || LABKEY.Security.currentUser.id !== 2217 || LABKEY.Security.currentUser.id !== 2933 ) { - EHR.Server.Utils.addError(scriptErrors, 'PainCategories', 'The USDA Pain level field must be left blank if the user is not from IS team!', 'WARN'); + EHR.Server.Utils.addError(scriptErrors, 'PainCategories', 'The USDA pain category field must be left blank if the user is not from ISE team!', 'WARN'); } } @@ -1179,17 +1179,6 @@ exports.init = function(EHR){ } }); - //Added by Kollil, 12-22-2022 - EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'encounters', function (helper, scriptErrors, row, oldRow) { - - helper.decodeExtraContextProperty('MiscChargesInTransaction'); - var miscChargesInTransaction = helper.getProperty('MiscChargesInTransaction'); - - if (miscChargesInTransaction && miscChargesInTransaction['miscChargesEntered'] === 0) { - EHR.Server.Utils.addError(scriptErrors, 'Id', 'billing charges grid requires at least one row', 'WARN'); - } - }); - //Added 3-5-2019 R.Blasa EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_INSERT, 'ehr', 'project', function(helper, scriptErrors, row, oldRow){ diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java index e1324b62b..2c719c49d 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ClinicalRoundsNotification.java @@ -62,27 +62,21 @@ public String getEmailSubject(Container c) } @Override -// public String getCronString() -// { -// return "0 0 15 * * ?"; -// } - - //Kollil 10/13: Changed the daily alert to Tuesdays and Thursdays public String getCronString() { - return "0 0 15 ? * TUE,THU"; + return "0 0 15 * * ?"; } @Override public String getScheduleDescription() { - return "every Tuesday & Thursday at 3PM"; + return "every day at 3PM"; } @Override public String getDescription() { - return "The report is designed to alert if there are any animals without rounds observations entered or lacking vet review. Also, contains the report to alert for Clinical rounds observations entered today, and not entered recently"; + return "The report is designed alert if there are any animals without rounds observations entered or lacking vet review"; } @Override @@ -92,11 +86,7 @@ public String getMessageBodyHTML(Container c, User u) duplicateCases(c, u, msg); animalsWithoutRounds(c, u, msg); - animalsWithoutVetReview(c, u, msg); - - //Clinical process alerts : Kollil, 10/13/22 - animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa - //animalsWithoutRounds2(c, u, msg); //Added 8-29-2016 + //animalsWithoutVetReview(c, u, msg); return msg.toString(); } @@ -122,8 +112,7 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild long count = ts.getRowCount(); if (count > 0) { - msg.append("Clinical Rounds Alerts: Active cases that do not have observations.
"); - msg.append("WARNING: " + count + " active case(s) found that do not have obs entered today.
"); + msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); msg.append("
Id Center Project Date Procedure USDA Pain Categories
Id Center Project Date Procedure USDA Categories
"); msg.append(""); @@ -174,8 +163,7 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu long count = ts.getRowCount(); if (count > 0) { - msg.append("Clinical Rounds Alerts: Active cases with no Vet review.
"); - msg.append("WARNING: " + count + " active case(s) found that have not been vet reviewed in the past 7 days.
"); + msg.append("WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.
"); msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
"); msg.append(""); @@ -200,108 +188,4 @@ public void exec(ResultSet object) throws SQLException msg.append("
\n"); } } - - //Clinical process alerts -// - - //Modified: 8-15-2016 R.Blasa Show Clinical open cases that were entered - protected void animalsWithRounds(final Container c, User u, final StringBuilder msg) - { - SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); - filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); - - TableInfo ti = getStudySchema(c, u).getTable("cases"); - Set keys = new HashSet<>(); - keys.add(FieldKey.fromString("Id")); - keys.add(FieldKey.fromString("Id/curLocation/room")); - keys.add(FieldKey.fromString("Id/curLocation/cage")); - keys.add(FieldKey.fromString("daysSinceLastRounds")); - keys.add(FieldKey.fromString("assignedvet/DisplayName")); - keys.add(FieldKey.fromString("allProblemCategories")); - final Map cols = QueryService.get().getColumns(ti, keys); - - TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); - long count = ts.getRowCount(); - - if (count > 0) - { - msg.append("Clinical Rounds Process Alerts: Active cases that have observations.
"); - msg.append("CONFIRMATION: " + count + " active case(s) found that have their obs entered today.
"); - msg.append("
RoomCageIdAssigned VetProblem(s)Days Since last Vet Review
"); - msg.append(""); - - ts.forEach(new Selector.ForEachBlock() - { - @Override - public void exec(ResultSet object) throws SQLException - { - Results rs = new ResultsImpl(object, cols); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - msg.append(""); - - msg.append(""); - } - }); - - msg.append("
RoomCageIdAssigned VetProblem(s)
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "
"); - msg.append("
\n"); - } - } - - - // protected void animalsWithoutRounds2(final Container c, User u, final StringBuilder msg) -// { -// SimpleFilter filter = new SimpleFilter(FieldKey.fromString("daysSinceLastRounds"), 0, CompareType.GT); -// filter.addCondition(FieldKey.fromString("isActive"), true, CompareType.EQUAL); -// filter.addCondition(FieldKey.fromString("category"), "Clinical", CompareType.EQUAL); -// filter.addCondition(FieldKey.fromString("Id/demographics/calculated_status"), "Alive", CompareType.EQUAL); -// -// TableInfo ti = getStudySchema(c, u).getTable("cases"); -// Set keys = new HashSet<>(); -// keys.add(FieldKey.fromString("Id")); -// keys.add(FieldKey.fromString("Id/curLocation/room")); -// keys.add(FieldKey.fromString("Id/curLocation/cage")); -// keys.add(FieldKey.fromString("daysSinceLastRounds")); -// keys.add(FieldKey.fromString("assignedvet/DisplayName")); -// keys.add(FieldKey.fromString("allProblemCategories")); -// final Map cols = QueryService.get().getColumns(ti, keys); -// -// TableSelector ts = new TableSelector(ti, cols.values(), filter, new Sort("Id/curLocation/room_sortValue,Id/curLocation/cage_sortValue")); -// long count = ts.getRowCount(); -// -// if (count > 0) -// { -// msg.append("Clinical Rounds Process Alerts: Active cases that do not have observations entered today.
"); -// msg.append("WARNING: There are " + count + " active cases that do not have obs entered today.
"); -// msg.append(""); -// msg.append(""); -// -// ts.forEach(new Selector.ForEachBlock() -// { -// @Override -// public void exec(ResultSet object) throws SQLException -// { -// Results rs = new ResultsImpl(object, cols); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// msg.append(""); -// } -// }); -// -// msg.append("
RoomCageIdAssigned VetProblem(s)Days Since Last Rounds
" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "" + rs.getString(FieldKey.fromString("Id")) + "" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "
"); -// msg.append("
\n"); -// } -// } - - } +} diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java index e454b213d..3e30b8c7e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/VetReviewNotification.java @@ -63,20 +63,15 @@ public String getEmailSubject(Container c) } @Override -// public String getCronString() -// { -// return "0 0 15 * * ?"; -// } - //Kollil 10/13: Changed the daily alert to once a week, Wednesdays public String getCronString() { - return "0 0 15 ? * WED"; + return "0 0 15 * * ?"; } @Override public String getScheduleDescription() { - return "every Wednesday at 3PM"; + return "daily at 3PM"; } @Override From 47022f17c455775ad6fd84e4d63741d2c6a1813a Mon Sep 17 00:00:00 2001 From: kollil Date: Thu, 16 Feb 2023 12:01:12 -0800 Subject: [PATCH 14/14] Alert title changed. --- .../org/labkey/onprc_ehr/notification/USDAPainNotification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java index 0028ea098..5b618450a 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java @@ -62,7 +62,7 @@ public USDAPainNotification(Module owner) @Override public String getName() { - return "USDA Categories"; + return "USDA Categories Notification"; } @Override