From 0a492b170f9dc1df4a9e02daa935bf085acd018d Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Sat, 22 Feb 2025 08:27:10 -0800 Subject: [PATCH 1/2] Add nonces to - + + - + - + Simple Editor Demo diff --git a/extscheduler/resources/views/weeklyTest.html b/extscheduler/resources/views/weeklyTest.html index 7fd846050..03dcb9e57 100644 --- a/extscheduler/resources/views/weeklyTest.html +++ b/extscheduler/resources/views/weeklyTest.html @@ -12,14 +12,14 @@ - - - - + + + + - - + + Scheduler Week View From 40e7798146b8e8c8674c0bd7fadb0f1a6c392792 Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli <69940873+kollil@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:07:35 -0800 Subject: [PATCH 2/2] USDA pain alert update (#1256) * Updated the USDA pain alert * Updated Code --- ...NewProcedures_missing_PainLevels.query.xml | 9 +++ .../NewProcedures_missing_PainLevels.sql | 11 +++ .../Procedures_Missing_PainLevels.query.xml | 9 +++ .../ColonyAlertsNotification.java | 68 ++++++++++++++++++- .../notification/USDAPainNotification.java | 1 + 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.query.xml create mode 100644 onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.sql create mode 100644 onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.query.xml diff --git a/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.query.xml b/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.query.xml new file mode 100644 index 000000000..15af59d96 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.query.xml @@ -0,0 +1,9 @@ + + + + + Procedures created with no USDA Pain Categories +
+
+
+
\ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.sql b/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.sql new file mode 100644 index 000000000..e94d44899 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/NewProcedures_missing_PainLevels.sql @@ -0,0 +1,11 @@ +-- This query extracts the active procedures that were created newly with missing USDA pain categories. +-- Set the date range to 1 year back from curr date +Select + Name as ProcedureName, + PainCategories as USDAPainCategories, + Category, + major as IsMajor, + Active +From ehr_lookups.procedures +Where active = 'true' + And PainCategories IS NULL diff --git a/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.query.xml b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.query.xml new file mode 100644 index 000000000..6187c39f8 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/Procedures_Missing_PainLevels.query.xml @@ -0,0 +1,9 @@ + + + + + Active procedures with no USDA Pain Categories +
+
+
+
\ No newline at end of file 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 7ab6b72ad..9aab54d31 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1289,7 +1289,7 @@ protected void pmicServicesRequestAlert(final Container c, User u, final StringB //End of PMIC alert /** - * Kollil, 12/22/2022 : Find the procedure entries where the PainCategory on the procedure is not defined (IS NULL). + * Kollil, 12/22/2022 : Find the procedure entries in the encounters table where the PainCategory on the procedure is not defined (IS NULL). * This email notification is sent to Jeff every Thursday at 7:30am. */ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final StringBuilder msg) @@ -1306,7 +1306,7 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final long count = ts.getRowCount(); if (count > 0) {//procedures count - msg.append("
Active procedures with missing USDA categories:

"); + msg.append("
The following procedures were performed with missing USDA pain categories:

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

Click here to view the procedures in PRIME

\n"); msg.append("
"); @@ -1330,7 +1330,7 @@ protected void proceduresWithoutUSDAPainLevels(final Container c, User u, final TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); // Table header - msg.append("

"); + msg.append("
"); msg.append(""); msg.append(""); @@ -1350,6 +1350,68 @@ public void exec(ResultSet object) throws SQLException msg.append(""); } }); + msg.append("
Id Center Project Date Procedure USDA Categories

"); + } + } + + /** + * Kollil, 2/12/2024 : Find the procedure entries where the PainCategory is not defined (IS NULL). + * This email notification is sent to Jeff every Thursday at 7:30am. + */ + protected void proceduresCreatedWithNoPainLevels(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("NewProcedures_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("
Procedures created with no USDA pain 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("Currently, there are no active procedures with no USDA pain categories!
"); + } + + //Display the daily report in the email + if (count > 0) + { + Set columns = new HashSet<>(); + columns.add(FieldKey.fromString("ProcedureName")); + columns.add(FieldKey.fromString("USDAPainCategories")); + columns.add(FieldKey.fromString("Category")); + columns.add(FieldKey.fromString("IsMajor")); + columns.add(FieldKey.fromString("Active")); + + final Map colMap = QueryService.get().getColumns(ti, columns); + TableSelector ts2 = new TableSelector(ti, colMap.values(), null, null); + + // Table header + msg.append(""); + msg.append(""); + msg.append(""); + + ts2.forEach(new Selector.ForEachBlock() + { + @Override + public void exec(ResultSet object) throws SQLException + { + Results rs = new ResultsImpl(object, colMap); + msg.append(""); + msg.append(""); + msg.append(""); + msg.append(""); + } + }); msg.append("
Procedure Name USDA Pain Categories Category
" + PageFlowUtil.filter(rs.getString("ProcedureName")) + "" + PageFlowUtil.filter(rs.getString("USDAPainCategories")) + "" + PageFlowUtil.filter(rs.getString("Category")) + "
"); } } 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 5b618450a..823a3c80c 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/USDAPainNotification.java @@ -95,6 +95,7 @@ public String getMessageBodyHTML(Container c, User u) StringBuilder msg = new StringBuilder(); proceduresWithoutUSDAPainLevels(c, u, msg); + proceduresCreatedWithNoPainLevels (c,u,msg); return msg.toString(); }