Skip to content
Closed
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
55 changes: 55 additions & 0 deletions onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<query xmlns="http://labkey.org/data/xml/query">
<metadata>
<tables xmlns="http://labkey.org/data/xml">
<table tableName="NewBirthTasks" tableDbType="TABLE">
<tableTitle>New Birth tasks created in last 7 days</tableTitle>
<columns>
<column columnName="taskid">
<columnTitle>Task ID</columnTitle>
<url>/ehr/dataEntryForm.view?formType=${formtype}&amp;taskid=${taskid}</url>
</column>
<column columnName="title">
<columnTitle>Title</columnTitle>
</column>
<column columnName="TaskType">
<columnTitle>Task Type</columnTitle>
</column>
<column columnName="assignedto">
<columnTitle>Assigned To</columnTitle>
<nullable>true</nullable>
<fk>
<fkDbSchema>core</fkDbSchema>
<fkTable>PrincipalsWithoutAdmin</fkTable>
<fkColumnName>UserId</fkColumnName>
</fk>
</column>
<column columnName="duedate">
<columnTitle>Due Date</columnTitle>
<nullable>true</nullable>
<formatString>yyyy-MM-dd HH:mm</formatString>
</column>
<column columnName="createdby">
<columnTitle>Created By</columnTitle>
<fk>
<fkDbSchema>core</fkDbSchema>
<fkTable>users</fkTable>
<fkColumnName>userid</fkColumnName>
</fk>
</column>
<column columnName="created">
<columnTitle>Created</columnTitle>
<nullable>true</nullable>
<formatString>yyyy-MM-dd HH:mm</formatString>
</column>
<column columnName="Status">
<columnTitle>Status</columnTitle>
<isHidden>false</isHidden>
<shownInDetailsView>true</shownInDetailsView>
<columnTitle>Status</columnTitle>
<displayWidth>50</displayWidth>
</column>
</columns>
</table>
</tables>
</metadata>
</query>
21 changes: 21 additions & 0 deletions onprc_ehr/resources/queries/onprc_ehr/NewBirthTasks.sql
Original file line number Diff line number Diff line change
@@ -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'


Original file line number Diff line number Diff line change
Expand Up @@ -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("<b>Warning: The study schema has not been enabled in this folder, so the alert cannot run!<p><hr>");
msg.append("<b>Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!<p><hr>");
return;
}

Expand Down Expand Up @@ -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("<b>Warning: The onprc_ehr schema has not been enabled in this folder, so the alert cannot run!<p><hr>");
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("<b>WARNING: There are " + count + " new birth(s) found in last 7 days.</b><br>");
msg.append("<p><a href='" + getExecuteQueryUrl(c, "onprc_ehr", "NewBirthTasks", null) + "'>Click here to view them</a></p>\n");
msg.append("<hr>");
}

}

/**
* Created by Kollil, 9/6/23
* Get the new animals found with the flag, "NHPR NOTE: BCG Vaccinated".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ 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())
Expand Down
Loading