Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24.3 fb notification revamps #720

Merged
merged 42 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4ca3949
- In Blood Draws Today (All, Animal Care, and Vet Staff), I changed '…
aschmidt34 Jul 11, 2024
cef7f29
Migrated automated test changes from 23.11 to 24.3. 23.11_notificati…
aschmidt34 Jul 18, 2024
6b183f3
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Jul 23, 2024
223ac88
Added blood overdraw trigger notification.
aschmidt34 Jul 24, 2024
c51cd23
Registered new notification.
aschmidt34 Jul 25, 2024
503747b
Updated code so message sends when testing/running in browser. Updat…
aschmidt34 Jul 26, 2024
8c02d59
Updated overdraw notification. Notification is now created everytime…
aschmidt34 Jul 31, 2024
1940d47
Fixed issue where 'Animal Replacement Fee' showed incorrectly in the …
aschmidt34 Aug 2, 2024
f43ccc2
Reordered messages in BloodDrawReviewDailyNotification.java so overdr…
aschmidt34 Aug 2, 2024
27e8973
-NotificationToolkit.java: Updated getWeightFromAnimalID() and getSex…
aschmidt34 Aug 8, 2024
8e1c364
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Aug 8, 2024
cb1aa1a
Removed automated tests that don't aren't finished.
aschmidt34 Aug 8, 2024
12e34ee
Added 2 new functions to NotificationToolkit for creating URL's. Thi…
aschmidt34 Aug 8, 2024
90a923b
Adding automated tests for notifications.
aschmidt34 Aug 16, 2024
feb43b8
- WNPRC_EHRTest.java: Added notification setup function, multiple not…
aschmidt34 Aug 28, 2024
162b199
- DeathNotificationRevamp.java: Added a null check to make sure class…
aschmidt34 Aug 28, 2024
3c7c099
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Aug 29, 2024
06a322d
Added null check before sending blood overdraw trigger manually. The…
aschmidt34 Aug 29, 2024
5394f7d
Moved the automated tests to the end of the list and removed the @Tes…
aschmidt34 Aug 30, 2024
acb6cc7
Disabled site-wide notifications. Also disable individual notificati…
aschmidt34 Aug 30, 2024
2fcd5f1
Re-added 'test' tag before function. Originally removed this because…
aschmidt34 Aug 30, 2024
ecc9f76
Added try/catch for insertValueIntoBloodBilledByDataset due to duplic…
aschmidt34 Sep 3, 2024
44ba184
Added try/catch for remaining functions that insert into datasets.
aschmidt34 Sep 3, 2024
4768468
Changed a query function in checkIfAnimalIsAlive() so it no longer re…
aschmidt34 Sep 3, 2024
22939c7
Removing migrated alerts from ehrcron to Java based notifications
dnicolalde Sep 3, 2024
c311ac0
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Sep 4, 2024
051bb94
Added comment to leave commented-out code block alone. This will be …
aschmidt34 Sep 5, 2024
8690123
Removed function call for notification tests in doSetup(). This was …
aschmidt34 Sep 16, 2024
47084a5
- TriggerScriptHelper.java: Added trigger call for new AnimalRequestU…
aschmidt34 Sep 25, 2024
de299ac
- TriggerScriptHelper.java: Added 'sendManually' function call that I…
aschmidt34 Sep 26, 2024
3f95248
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Sep 26, 2024
dd4be9e
- animal_requests.js: Added fix for fatal issue with qcstatus being d…
aschmidt34 Oct 7, 2024
21b13c3
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Oct 11, 2024
1bc7ea8
- WNPRC_EHRModule.java: Registered new notification.
aschmidt34 Oct 30, 2024
64c61a3
Removed joda time import statement because it was unused.
aschmidt34 Nov 22, 2024
7c46f29
ClinpathRefRange.sql - Added units column to table for data retrieval…
aschmidt34 Nov 25, 2024
5cde29b
ClinpathResultAlertsRevamp.java: Created new revamp notification.
aschmidt34 Dec 4, 2024
d54449e
LargeInfantAlertsRevamp.java: Created new revamped notification.
aschmidt34 Dec 10, 2024
6591ce4
ClinpathAbnormalResultsAlertsRevamp.java: Fixed text display, typos, …
aschmidt34 Dec 12, 2024
b2ffe03
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Dec 13, 2024
5917b0c
TreatmentAlertsNotificationRevamp.java: Fixed line spacing before & a…
aschmidt34 Dec 20, 2024
383b06e
Merge branch 'release24.3-SNAPSHOT' into 24.3_fb_notificationRevamps
aschmidt34 Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public String getMessageBodyHTML(Container c, User u) {

// Creates filter.
SimpleFilter myFilter = new SimpleFilter("qcstate/PublicData", true, CompareType.EQUAL);
myFilter.addCondition("taskid/datecompleted", lastRunDate, CompareType.DATE_GTE);
myFilter.addCondition("taskid/datecompleted", lastRunDate, CompareType.GTE);
myFilter.addCondition("taskid/datecompleted", "", CompareType.NONBLANK);
myFilter.addCondition("date", lastRunMinusWeek, CompareType.DATE_GTE);
myFilter.addCondition("date", lastRunMinusWeek, CompareType.GTE);
// Creates columns to retrieve.
String[] targetColumns = new String[]{"Id", "date", "Id/curLocation/area", "Id/curLocation/room", "Id/curLocation/cage", "alertStatus", "taskid/datecompleted", "testid", "result", "units", "status", "ref_range_min", "ref_range_max", "ageAtTime"};
// Runs query.
Expand All @@ -102,52 +102,54 @@ public String getMessageBodyHTML(Container c, User u) {
for (HashMap<String, String> result : returnArray) {
// Verifies 'alert status' exists before adding results.
if (!result.get("alertStatus").isEmpty()) {
// Updates current location.
if (result.get("Id/curLocation/area").isEmpty()) {
result.put("Id/curLocation/area", "No Active Housing");
}
// Updates current room.
if (result.get("Id/curLocation/room").isEmpty()) {
result.put("Id/curLocation/room", "No Room");
}
if (result.get("alertStatus").equals("t")) {
// Updates current location.
if (result.get("Id/curLocation/area").isEmpty()) {
result.put("Id/curLocation/area", "No Active Housing");
}
// Updates current room.
if (result.get("Id/curLocation/room").isEmpty()) {
result.put("Id/curLocation/room", "No Room");
}

// Adds to list if area does not exist yet.
if (!filteredResults.containsKey(result.get("Id/curLocation/area"))) {
// Creates new room results list.
ArrayList<HashMap<String, String>> newRoomList = new ArrayList<>();
newRoomList.add(result);
// Creates new room map.
HashMap<String, ArrayList<HashMap<String, String>>> newRoom = new HashMap<>();
newRoom.put(result.get("Id/curLocation/room"), newRoomList);
// Creates new area map and adds to the filtered results.
filteredResults.put(result.get("Id/curLocation/area"), newRoom);
}
// Adds to list if room does not exist yet.
else if (!filteredResults.get(result.get("Id/curLocation/area")).containsKey(result.get("Id/curLocation/room"))) {
// Creates new room results list.
ArrayList<HashMap<String, String>> newRoomList = new ArrayList<>();
newRoomList.add(result);
// Creates new room map and adds to the areas list.
filteredResults.get(result.get("Id/curLocation/area")).put(result.get("Id/curLocation/room"), newRoomList);
}
// Adds to list if area and room exist already.
else {
filteredResults.get(result.get("Id/curLocation/area")).get(result.get("Id/curLocation/room")).add(result);
// Adds to list if area does not exist yet.
if (!filteredResults.containsKey(result.get("Id/curLocation/area"))) {
// Creates new room results list.
ArrayList<HashMap<String, String>> newRoomList = new ArrayList<>();
newRoomList.add(result);
// Creates new room map.
HashMap<String, ArrayList<HashMap<String, String>>> newRoom = new HashMap<>();
newRoom.put(result.get("Id/curLocation/room"), newRoomList);
// Creates new area map and adds to the filtered results.
filteredResults.put(result.get("Id/curLocation/area"), newRoom);
}
// Adds to list if room does not exist yet.
else if (!filteredResults.get(result.get("Id/curLocation/area")).containsKey(result.get("Id/curLocation/room"))) {
// Creates new room results list.
ArrayList<HashMap<String, String>> newRoomList = new ArrayList<>();
newRoomList.add(result);
// Creates new room map and adds to the areas list.
filteredResults.get(result.get("Id/curLocation/area")).put(result.get("Id/curLocation/room"), newRoomList);
}
// Adds to list if area and room exist already.
else {
filteredResults.get(result.get("Id/curLocation/area")).get(result.get("Id/curLocation/room")).add(result);
}
}
}
}

// Prints text.
messageBody.append("There have been " + returnArray.size() + " clinpath tasks completed since " + lastRunDate + "<br>");
messageBody.append(notificationToolkit.createHyperlink("Click here to view them", clinpathTasksUrlView) + "</a><p>\n");
messageBody.append("<p>Listed below are the abnormal records.</p>\n");
messageBody.append(notificationToolkit.createHyperlink("Click here to view them", clinpathTasksUrlView) + "<p>\n");
messageBody.append("<p>Listed below are the abnormal records.<br>\n");

// Prints table with all records.
String[] tableColumns = new String[]{"Id", "Collect Date", "Date Completed", "Test ID", "Result", "Units", "Status", "Ref Range Min", "Ref Range Max", "Age At Time"};
for (String currentArea : notificationToolkit.sortSetWithNulls(filteredResults.keySet())) {
messageBody.append("<b>" + currentArea + ":</b><br>\n");
messageBody.append("<br>\n<b>" + currentArea + ":</b><br>\n");
for (String currentRoom : notificationToolkit.sortSetWithNulls(filteredResults.get(currentArea).keySet())) {
messageBody.append(currentRoom + ":<br>\n");
messageBody.append("<br>\n" + currentRoom + ":\n");
// Reformats the hashmap into a String[] List (to be compatible with the table creation function).
ArrayList<String []> currentTableData = new ArrayList<>();
ArrayList<String> rowColorsList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public ClinpathAlertsObject(Container currentContainer, User currentUser, Date l
private void getRecordsRequestedSinceLastEmail() {
// Creates filter.
SimpleFilter myFilter = new SimpleFilter("qcstate/label", "Request: Pending", CompareType.EQUAL);
myFilter.addCondition("created", dateLastRun, CompareType.DATE_GTE);
myFilter.addCondition("created", dateLastRun, CompareType.GTE);
// Creates columns to retrieve.
String[] targetColumns = new String[]{"created"};
// Runs query.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ else if (!filteredResults.get(result.get("Id/curLocation/area")).containsKey(res
// Creates a table from the data.
String[] tableColumns = new String[]{"Id", "Collect Date", "Service Requested", "Requestor", "Date Reviewed", "Reviewed By"};
for (String currentArea : notificationToolkit.sortSetWithNulls(filteredResults.keySet())) {
messageBody.append("<b>" + currentArea + ":</b><br>\n");
messageBody.append("<br>\n<b>" + currentArea + ":</b><br>\n");
for (String currentRoom : notificationToolkit.sortSetWithNulls(filteredResults.get(currentArea).keySet())) {
messageBody.append(currentRoom + ":<br>\n");
messageBody.append("<br>\n" + currentRoom + ":\n");
// Reformats the hashmap into a String[] List (to be compatible with the table creation function).
ArrayList<String []> currentTableData = new ArrayList<>();
ArrayList<String> rowColorsList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public String getMessageBodyHTML(Container c, User u) {
// 1. Shows all rooms lacking observations today.
if (!myTreatmentAlertsObject.roomsLackingObservationsToday.isEmpty()) {
messageBody.append("<b>WARNING: The following rooms do not have any obs for today as of: " + dateToolkit.getCurrentTime() + ".</b>");
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view them.</a><p>\n", myTreatmentAlertsObject.roomsLackingObservationsTodayUrlView));
messageBody.append("" + notificationToolkit.createHyperlink(" Click here to view them.<p>\n", myTreatmentAlertsObject.roomsLackingObservationsTodayUrlView));
for (HashMap<String, String> result : myTreatmentAlertsObject.roomsLackingObservationsToday) {
messageBody.append(result.get("room") + "<br>");
}
Expand All @@ -94,7 +94,7 @@ public String getMessageBodyHTML(Container c, User u) {
// 2. Shows all treatments where the animal is not assigned to that project.
if (!myTreatmentAlertsObject.treatmentsWithAnimalNotAssignedToProject.isEmpty()) {
messageBody.append("<b>WARNING: There are " + myTreatmentAlertsObject.treatmentsWithAnimalNotAssignedToProject.size() + " scheduled treatments where the animal is not assigned to the project.</br><br>");
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view them.</a><br>\n", myTreatmentAlertsObject.treatmentsWithAnimalNotAssignedToProjectUrlView));
messageBody.append("" + notificationToolkit.createHyperlink(" Click here to view them.<br>\n", myTreatmentAlertsObject.treatmentsWithAnimalNotAssignedToProjectUrlView));
messageBody.append("<hr>\n");
}
// 3. Shows treatments for each time of day.
Expand All @@ -106,7 +106,7 @@ public String getMessageBodyHTML(Container c, User u) {
Integer totalTreatments = myTreatmentAlertsObject.incompleteTreatmentsForEachTimeOfDay.get(timeOfDay).size() + myTreatmentAlertsObject.completedTreatmentCountsForEachTimeOfDay.get(timeOfDay);
if (totalTreatments > 0) {
messageBody.append("There are " + totalTreatments + " scheduled " + timeOfDay + " treatments. " + myTreatmentAlertsObject.completedTreatmentCountsForEachTimeOfDay.get(timeOfDay) + " have been completed. ");
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view them.</a></p>\n", myTreatmentAlertsObject.treatmentsForEachTimeOfDayUrlView.get(timeOfDay)));
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view them.<br>\n", myTreatmentAlertsObject.treatmentsForEachTimeOfDayUrlView.get(timeOfDay)));

// Creates the current timeOfDay results sorted by (area --> room --> result).
HashMap<String, HashMap<String, ArrayList<HashMap<String, String>>>> resultsByArea = new HashMap<>();
Expand Down Expand Up @@ -141,10 +141,10 @@ else if (!resultsByArea.get(currentArea).containsKey(currentRoom)) {

// Iterates through each area (sorted alphabetically).
for (String currentArea : notificationToolkit.sortSetWithNulls(resultsByArea.keySet())) {
messageBody.append("<b>" + currentArea + ":</b><br>\n");
messageBody.append("<br>\n<b>" + currentArea + ":</b><br>\n");
// Iterates through each room (sorted alphabetically)
for (String currentRoom : notificationToolkit.sortSetWithNulls(resultsByArea.get(currentArea).keySet())) {
messageBody.append(currentRoom + ": " + resultsByArea.get(currentArea).get(currentRoom).size() + "<br>\n");
messageBody.append("<br>\n" + currentRoom + ": " + resultsByArea.get(currentArea).get(currentRoom).size() + "\n");
// Reformats the treatment hashmap into a String[] List (to be compatible with the table creation function).
ArrayList<String []> formattedResults = new ArrayList<>();
for (HashMap<String, String> currentTreatment : resultsByArea.get(currentArea).get(currentRoom)) {
Expand Down Expand Up @@ -188,13 +188,13 @@ else if (!resultsByArea.get(currentArea).containsKey(currentRoom)) {
// 5. Shows any treatments where the animal is not alive.
if (!myTreatmentAlertsObject.treatmentsWhereAnimalIsNotAlive.isEmpty()) {
messageBody.append("<b>WARNING: There are " + myTreatmentAlertsObject.treatmentsWhereAnimalIsNotAlive.size() + " active treatments for animals not currently at WNPRC.</b>");
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view and update them.</a><br>\n", myTreatmentAlertsObject.treatmentsWhereAnimalIsNotAliveURLView));
messageBody.append("" + notificationToolkit.createHyperlink(" Click here to view and update them.<br>\n", myTreatmentAlertsObject.treatmentsWhereAnimalIsNotAliveURLView));
messageBody.append("<hr>\n");
}
// 6. Find any problems where the animal is not alive.
if (!myTreatmentAlertsObject.problemsWhereAnimalIsNotAlive.isEmpty()) {
messageBody.append("<b>WARNING: There are " + myTreatmentAlertsObject.problemsWhereAnimalIsNotAlive.size() + " unresolved problems for animals not currently at WNPRC.</b>");
messageBody.append("" + notificationToolkit.createHyperlink("Click here to view and update them.</a><br>\n", myTreatmentAlertsObject.problemsWhereAnimalIsNotAliveUrlView));
messageBody.append("" + notificationToolkit.createHyperlink(" Click here to view and update them.<br>\n", myTreatmentAlertsObject.problemsWhereAnimalIsNotAliveUrlView));
messageBody.append("<hr>\n");
}
// 7. Checks for missing In Rooms after 2:30pm, as specified in the SOP.
Expand Down
Loading