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

Notification changes #545

Open
wants to merge 5 commits into
base: release22.7-SNAPSHOT
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -62,21 +62,27 @@ public String getEmailSubject(Container c)
}

@Override
// public String getCronString()
// {
// return "0 0 15 * * ?";
// }

//Kollil 10/13: Changed the daily clinical rounds 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
Expand All @@ -86,7 +92,12 @@ public String getMessageBodyHTML(Container c, User u)

duplicateCases(c, u, msg);
animalsWithoutRounds(c, u, msg);
//animalsWithoutVetReview(c, u, msg);
animalsWithoutVetReview(c, u, msg);

//Clinical process alerts : Kollil, 10/13/22
//Merging two alerts into one.
animalsWithRounds(c, u, msg); //Added: 8-22-2016 R.Blasa
//animalsWithoutRounds2(c, u, msg); //Added 8-29-2016

return msg.toString();
}
Expand All @@ -112,7 +123,8 @@ protected void animalsWithoutRounds(final Container c, User u, final StringBuild
long count = ts.getRowCount();
if (count > 0)
{
msg.append("<b>WARNING: There are " + count + " active cases that do not have obs entered today.</b><br>");
msg.append("<b>Clinical Rounds Alerts: Active cases that do not have observations.</b><br>");
msg.append("<b>WARNING: " + count + " active case(s) found that do not have obs entered today.</b><br>");
msg.append("<table border=1 style='border-collapse: collapse;'>");
msg.append("<tr style='font-weight: bold;'><td>Room</td><td>Cage</td><td>Id</td><td>Assigned Vet</td><td>Problem(s)</td><td>Days Since Last Rounds</td></tr>");

Expand Down Expand Up @@ -163,7 +175,8 @@ protected void animalsWithoutVetReview(final Container c, User u, final StringBu
long count = ts.getRowCount();
if (count > 0)
{
msg.append("<b>WARNING: There are " + count + " active cases that have not been vet reviewed in the past 7 days.</b><br>");
msg.append("<b>Clinical Rounds Alerts: Active cases with no Vet review.</b><br>");
msg.append("<b>WARNING: " + count + " active case(s) found that have not been vet reviewed in the past 7 days.</b><br>");
msg.append("<table border=1 style='border-collapse: collapse;'>");
msg.append("<tr style='font-weight: bold;'><td>Room</td><td>Cage</td><td>Id</td><td>Assigned Vet</td><td>Problem(s)</td><td>Days Since last Vet Review</td></tr>");

Expand All @@ -188,4 +201,108 @@ public void exec(ResultSet object) throws SQLException
msg.append("<hr>\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<FieldKey> 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<FieldKey, ColumnInfo> 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("<b>Clinical Rounds Process Alerts: Active cases that have observations.</b><br>");
msg.append("<b>CONFIRMATION: " + count + " active case(s) found that have their obs entered today.</b><br>");
msg.append("<table border=1 style='border-collapse: collapse;'>");
msg.append("<tr style='font-weight: bold;'><td>Room</td><td>Cage</td><td>Id</td><td>Assigned Vet</td><td>Problem(s)</td></tr>");

ts.forEach(new Selector.ForEachBlock<ResultSet>()
{
@Override
public void exec(ResultSet object) throws SQLException
{
Results rs = new ResultsImpl(object, cols);
msg.append("<tr>");
msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "</td>");
msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "</td>");
msg.append("<td>" + rs.getString(FieldKey.fromString("Id")) + "</td>");
msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "</td>");
msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "</td>");

msg.append("</tr>");
}
});

msg.append("</table>");
msg.append("<hr>\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<FieldKey> 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<FieldKey, ColumnInfo> 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("<b>Clinical Rounds Process Alerts: Active cases that do not have observations entered today.</b><br>");
// msg.append("<b>WARNING: There are " + count + " active cases that do not have obs entered today.</b><br>");
// msg.append("<table border=1 style='border-collapse: collapse;'>");
// msg.append("<tr style='font-weight: bold;'><td>Room</td><td>Cage</td><td>Id</td><td>Assigned Vet</td><td>Problem(s)</td><td>Days Since Last Rounds</td></tr>");
//
// ts.forEach(new Selector.ForEachBlock<ResultSet>()
// {
// @Override
// public void exec(ResultSet object) throws SQLException
// {
// Results rs = new ResultsImpl(object, cols);
// msg.append("<tr>");
// msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/room")), "None") + "</td>");
// msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("Id/curLocation/cage")), "") + "</td>");
// msg.append("<td>" + rs.getString(FieldKey.fromString("Id")) + "</td>");
// msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("assignedvet/DisplayName")), "None") + "</td>");
// msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("allProblemCategories")), "None") + "</td>");
// msg.append("<td>" + safeAppend(rs.getString(FieldKey.fromString("daysSinceLastRounds")), "") + "</td>");
// msg.append("</tr>");
// }
// });
//
// msg.append("</table>");
// msg.append("<hr>\n");
// }
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down