+ 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:
");
+ }
+ }
+
+ /**
+ * 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: