diff --git a/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/.qview.xml b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/.qview.xml index 17d0f4476..7b0d6af85 100644 --- a/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/.qview.xml +++ b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/.qview.xml @@ -2,7 +2,5 @@ - - - + \ No newline at end of file diff --git a/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/Active.qview.xml b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/Active.qview.xml new file mode 100644 index 000000000..8c3f3c04f --- /dev/null +++ b/ONPRC_EHR_ComplianceDB/resources/queries/EHR_ComplianceDB/requirements/Active.qview.xml @@ -0,0 +1,8 @@ + diff --git a/ogasync/src/org/labkey/ogasync/OGASyncRunner.java b/ogasync/src/org/labkey/ogasync/OGASyncRunner.java index 3f7f9985f..9dc312afd 100644 --- a/ogasync/src/org/labkey/ogasync/OGASyncRunner.java +++ b/ogasync/src/org/labkey/ogasync/OGASyncRunner.java @@ -178,8 +178,8 @@ public void doMergeGrantProjects(User u, Container c, TableInfo sourceTable, DbS public void updateStats(DbSchema targetSchema) throws SQLException { TableInfo aliases = DbSchema.get("onprc_billing").getTable("aliases"); - String analyze = targetSchema.getSqlDialect().getAnalyzeCommandForTable(aliases.getSelectName()); - new SqlExecutor(aliases.getSchema()).execute(new SQLFragment(analyze)); + SQLFragment analyze = targetSchema.getSqlDialect().getAnalyzeCommandForTable(aliases.getSelectName()); + new SqlExecutor(aliases.getSchema()).execute(analyze); } public void doMergeOtherAccounts(User u, Container c, TableInfo sourceTable, DbSchema targetSchema) throws SQLException diff --git a/onprc_ehr/resources/queries/onprc_ehr/MedsEndDateAlert.sql b/onprc_ehr/resources/queries/onprc_ehr/MedsEndDateAlert.sql index 196f647b5..a6dc2db26 100644 --- a/onprc_ehr/resources/queries/onprc_ehr/MedsEndDateAlert.sql +++ b/onprc_ehr/resources/queries/onprc_ehr/MedsEndDateAlert.sql @@ -6,6 +6,9 @@ Added these two Diets to the list by Kollil on 4/15/25. Refer to tkt #12363 3. E-X0500 - Diet, L-Phyto (Low-phytoestrogen) 4. E-Y9750 - Diet, 5047 High Protein, Jumbo + + Added Diet to the list by Kollil on 5/14/25. Refer to tkt #12506 +5. E-X1380 - Diet Daily (Non-standard), 5LOP (TAD) */ SELECT Id, @@ -27,5 +30,5 @@ SELECT category, taskid.rowid as TaskId FROM study.treatment_order -WHERE code NOT IN ('E-85760', 'E-Y7735', 'E-X0500', 'E-Y9750') +WHERE code NOT IN ('E-85760', 'E-Y7735', 'E-X0500', 'E-Y9750', 'E-X1380') AND enddate is null \ No newline at end of file diff --git a/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.query.xml b/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.query.xml new file mode 100644 index 000000000..d12c41f86 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.query.xml @@ -0,0 +1,54 @@ + + + + + New Birth tasks created in last 7 days + + + Task ID + /ehr/dataEntryForm.view?formType=${formtype}&taskid=${taskid} + + + Title + + + Task Type + + + Assigned To + true + + core + PrincipalsWithoutAdmin + UserId + + + + Due Date + true + yyyy-MM-dd HH:mm + + + Created By + + core + users + userid + + + + Created + true + yyyy-MM-dd HH:mm + + + Status + false + true + 50 + + +
+
+
+
diff --git a/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.sql b/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.sql new file mode 100644 index 000000000..841349e66 --- /dev/null +++ b/onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.sql @@ -0,0 +1,21 @@ +/** + * Created by Kollil, 10/25 + * Get a list of tasks daily on a rolling 7 day window to review for QC. + * This will allow techs to see what new IDs were created by whom, and review for accuracy, + * housing history, group ids and flags. + * Refer tkt # 13504 + */ +SELECT + t.taskid, + t.title, + t.formType as TaskType, + t.assignedto, + t.duedate, + t.createdby, + t.created, + t.qcstate as Status +FROM ehr.tasks t +WHERE t.created >= TIMESTAMPADD('day', -7, NOW()) +And t.formtype = 'birth' + + diff --git a/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql b/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql index 8d4cc1842..61727ec5c 100644 --- a/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql +++ b/onprc_ehr/resources/queries/study/demographicsAssignedVet.sql @@ -2,34 +2,24 @@ study.demographicsAssignedVet * Returns one or more assigned vets per animal ID -* Note to future self: don't be tempted to add more fields to this view. It will likely - result in additional rows per animal as they won't be distinct. - +* Note to future self: be very careful when adding more fields to this view. It can easily + result in additional rows per animal if they're distinct. */ --- Step 1: Find the minimum matchedRule for each ID -WITH MinMatchedRules AS ( - SELECT - VAF2.Id, - MIN(VAF2.matchedRule) AS MinRule - FROM - vetAssignment_Filter AS VAF2 - GROUP BY - VAF2.Id +SELECT + f.Id, + f.AssignedVet, + f.AssignmentType, + GROUP_CONCAT( + CASE WHEN f.matchedRule = 0 THEN f.ActiveMasterProblems ELSE NULL END, + ', ' + ) AS MasterProblems, + f.Area, + f.Room +FROM vetAssignment_filter f +WHERE f.matchedRule = ( + SELECT min(matchedRule) + FROM vetAssignment_filter sub + WHERE sub.Id = f.Id ) - --- Step 2: Join the original table with the filtered minimum matched rules -SELECT DISTINCT - VAF1.Id, - VAF1.AssignedVet, - VAF1.AssignmentType, - VAF1.Room, - VAF1.Area, - VAF1.Species - -FROM - vetAssignment_Filter AS VAF1 - INNER JOIN - MinMatchedRules AS MMR - ON VAF1.Id = MMR.Id - AND VAF1.matchedRule = MMR.MinRule \ No newline at end of file +GROUP BY f.Id, f.AssignedVet, f.AssignmentType, f.Area, f.Room \ No newline at end of file diff --git a/onprc_ehr/resources/queries/study/demographicsAssignedVet/.qview.xml b/onprc_ehr/resources/queries/study/demographicsAssignedVet/.qview.xml index 5a5a03550..9a4beb10c 100644 --- a/onprc_ehr/resources/queries/study/demographicsAssignedVet/.qview.xml +++ b/onprc_ehr/resources/queries/study/demographicsAssignedVet/.qview.xml @@ -4,11 +4,9 @@ - - - - - + + + diff --git a/onprc_ehr/resources/queries/study/demographicsAssignedVet/NHPsWithoutAnAssignedVet.qview.xml b/onprc_ehr/resources/queries/study/demographicsAssignedVet/NHPsWithoutAnAssignedVet.qview.xml index bb6014336..dc34659b9 100644 --- a/onprc_ehr/resources/queries/study/demographicsAssignedVet/NHPsWithoutAnAssignedVet.qview.xml +++ b/onprc_ehr/resources/queries/study/demographicsAssignedVet/NHPsWithoutAnAssignedVet.qview.xml @@ -4,11 +4,9 @@ - - - - - + + + diff --git a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js index d6f8da6ac..6a96e4701 100644 --- a/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js +++ b/onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js @@ -1053,7 +1053,7 @@ exports.init = function(EHR){ } //Added by Kollil, 8/1/24 - /* User can bypass the enddate for these two medications, as per ticket #11016 + /* User can bypass the enddate for the following meddications, as per ticket #11016 Validation code on the Prime side to bypass the following two medications without entering the end dates. 1. E-85760 - Medroxyprogesterone injectable (150mg/ml) 2. E-Y7735 - Diet - Weekly Multivitamin @@ -1061,11 +1061,13 @@ exports.init = function(EHR){ Added these two Diets to the list by Kollil on 4/15/25. Refer to tkt #12363 3. E-X0500 - Diet, L-Phyto (Low-phytoestrogen) 4. E-Y9750 - Diet, 5047 High Protein, Jumbo + + Added Diet to the list by Kollil on 5/14/25. Refer to tkt #12506 + 5. E-X1380 - Diet Daily (Non-standard), 5LOP (TAD) */ - if (row.code != 'E-85760' && row.code != 'E-Y7735' && row.code != 'E-X0500' && row.code != 'E-Y9750'){ - if (!row.enddate) { - EHR.Server.Utils.addError(scriptErrors, 'enddate', 'Must enter enddate', 'WARN'); - } + if (row.code != 'E-85760' && row.code != 'E-Y7735' && row.code != 'E-X0500' && + row.code != 'E-Y9750' && row.code != 'E-X1380' && !row.enddate) { + EHR.Server.Utils.addError(scriptErrors, 'enddate', 'Must enter enddate', 'WARN'); } //Added by Kollil, 9/15/25 diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/NHPTrainingFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/NHPTrainingFormType.java index 54bd16e60..8faf1cba8 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/NHPTrainingFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/NHPTrainingFormType.java @@ -21,7 +21,11 @@ import org.labkey.api.ehr.dataentry.TaskFormSection; import org.labkey.api.ehr.security.EHRBehaviorEntryPermission; import org.labkey.api.module.Module; +import org.labkey.api.security.Group; +import org.labkey.api.security.GroupManager; +import org.labkey.api.security.permissions.AdminPermission; import org.labkey.api.view.template.ClientDependency; +import org.labkey.security.xml.GroupEnumType; import java.util.Arrays; diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java index 19b877428..abf1da752 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/dataentry/PairingFormType.java @@ -66,19 +66,7 @@ public PairingFormType(DataEntryFormContext ctx, Module owner) addClientDependency(ClientDependency.supplierFromPath("/onprc_ehr/form/field/PairedAdultsEntryField.js")); - - - - - } - @Override - protected boolean canInsert() - { - if (!getCtx().getContainer().hasPermission(getCtx().getUser(), EHRBehaviorEntryPermission.class)) - return false; - return super.canInsert(); - } } diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/AdminNotifications.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/AdminNotifications.java index 427f50039..d9fc7fd8e 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/AdminNotifications.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/AdminNotifications.java @@ -101,19 +101,18 @@ private void MedsEndDateAlert(Container c, User u, final StringBuilder msg, fina TableSelector ts = new TableSelector(ti, null, new Sort("date")); long count = ts.getRowCount(); if (count == 0) { - //msg.append("There are no meds ordered except E-85760 (Medroxyprogesterone injectable 150mg/ml) and E-Y7735 (Diet - Weekly Multivitamin) with missing end dates!
"); - msg.append("No medication orders found with missing end date except the following approved list:" + + msg.append("No treatment orders found with missing end date except the following approved list:" + "
1. E-85760 (Medroxyprogesterone injectable 150mg/ml) " + "
2. E-Y7735 (Diet - Weekly Multivitamin)" + "
3. E-X0500 (Diet, L-Phyto (Low-phytoestrogen)) " + - "
4. E-Y9750 (Diet, 5047 High Protein, Jumbo)

"); + "
4. E-Y9750 (Diet, 5047 High Protein, Jumbo) " + + "
5. E-X1380 (Diet Daily (Non-standard), 5LOP (TAD))
"); } else if (count > 0) { //Display the report link on the notification page - msg.append("
Meds with missing end date:

"); - msg.append("" + count + " meds found with missing end dates:"); - msg.append("

Click here to view the meds/diets

\n"); + msg.append("
" + count + " treatment order(s) found with missing end dates

"); + msg.append("

Click here to view the treatments

\n"); msg.append("
"); //Display the report in the email 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 0a40e50fa..8a5363df3 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/ColonyAlertsNotification.java @@ -1551,7 +1551,7 @@ else if (rs.getString("ActiveClinicalTreatment") != null && rs.getString("Active protected void LongTermMedsAlert(final Container c, User u, final StringBuilder msg) { if (QueryService.get().getUserSchema(u, c, "onprc_ehr") == null) { - msg.append("Warning: The study schema has not been enabled in this folder, so the alert cannot run!


"); + msg.append("Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!


"); return; } @@ -2333,6 +2333,33 @@ protected void duplicateFlags(Container c, User u, final StringBuilder msg) } } + /** + * Created by Kollil, 10/25 + * Get a list of tasks daily on a rolling 7 day window to review for QC. + * This will allow techs to see what new IDs were created by whom, and review for accuracy, + * housing history, group ids and flags. + * Refer tkt # 13504 + */ + protected void newBirthTasks(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; + } + + //Get birth tasks + TableInfo ti = QueryService.get().getUserSchema(u, c, "onprc_ehr").getTable("NewBirthTasks", ContainerFilter.Type.AllFolders.create(c, u)); + TableSelector ts = new TableSelector(ti, null, null); + long count = ts.getRowCount(); + + if (count > 0) { + msg.append("WARNING: There are " + count + " new birth(s) found in last 7 days.
"); + msg.append("

Click here to view them

\n"); + msg.append("
"); + } + + } + /** * Created by Kollil, 9/6/23 * Get the new animals found with the flag, "NHPR NOTE: BCG Vaccinated". diff --git a/onprc_ehr/src/org/labkey/onprc_ehr/notification/DataValidationNotification.java b/onprc_ehr/src/org/labkey/onprc_ehr/notification/DataValidationNotification.java index 79b34ea4c..6e5cda088 100644 --- a/onprc_ehr/src/org/labkey/onprc_ehr/notification/DataValidationNotification.java +++ b/onprc_ehr/src/org/labkey/onprc_ehr/notification/DataValidationNotification.java @@ -48,19 +48,19 @@ public String getEmailSubject(Container c) @Override public String getCronString() { - return "0 25 6 * * ?"; + return "0 50 6/15 * * ?"; } @Override public String getScheduleDescription() { - return "every day at 6:25AM"; + return "every day at 6:50AM and 3:50PM"; } @Override public String getDescription() { - return "The report is designed to identify potential problems with the EHR data. It is similar to Colony Alerts, except it is limited to alerts that indicate a true problem in the data itself."; + return "The report identifies potential problems with the EHR data. Although similar to Colony Alerts, it is limited to problems in the data itself."; } @Override @@ -112,11 +112,14 @@ public String getMessageBodyHTML(Container c, User u) birthRecordsNotMatchingHousing(c, u, msg); duplicateGroupMembership(c, u, msg); duplicateFlags(c, u, msg); + //Added by Kolli, Oct 2025 + //Tasks list alert for the new animal births, Refer to # 13504 + newBirthTasks(c, u, msg); //only send if there are alerts if (!msg.isEmpty()) { - msg.insert(0, "This email contains a series of automatic alerts designed to identify problems in the EHR data. It was run on: " + getDateFormat(c).format(now) + " at " + _timeFormat.format(now) + ".

"); + msg.insert(0, "This email contains a series of automatic alerts identifying problems in the EHR data. It was run on: " + getDateFormat(c).format(now) + " at " + _timeFormat.format(now) + ".

"); } return msg.toString(); diff --git a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index e1313a66f..bdf812dd0 100644 --- a/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -1073,7 +1073,6 @@ public void testExamEntry() throws Exception Assert.assertEquals("mg/kg", ordersGrid.getFieldValue(3, "dosage_units")); //note: amount calculation testing handled in surgery test - //blood draws waitAndClick(Ext4Helper.Locators.ext4Tab("Blood Draws")); Ext4GridRef bloodGrid = _helper.getExt4GridForFormSection("Blood Draws");