Skip to content

Commit 33811ef

Browse files
authored
BSU Assignment dashboard alert update (#1588)
* Updated the queries as per Isabel's input * updated the query clauses one last time * updated the query clauses one last time
1 parent 70f673d commit 33811ef

8 files changed

+41
-10
lines changed

onprc_ehr/resources/queries/study/AssignmentsCreatedInPast1Day.query.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<tables xmlns="http://labkey.org/data/xml">
55
<table tableName="AssignmentsCreatedInPast1Day" tableDbType="TABLE">
6-
<tableTitle>Assignments created in past 24 hrs</tableTitle>
6+
<tableTitle>Assignments created in the past 24 hrs</tableTitle>
77
</table>
88
</tables>
99
</metadata>

onprc_ehr/resources/queries/study/AssignmentsCreatedInPast1Day.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* Created by Kollil, Dec, 2025
2+
Tkt # 13618
3+
Priority 1: Add Grid 1 ("Assignments Created in the Past Day ") to daily Behavior Alerts email - display full grid in email
4+
*/
15
SELECT
26
Id,
37
Id.demographics.gender as Sex,
@@ -16,4 +20,4 @@ SELECT
1620
releaseCondition.meaning as ConditionAtRelease
1721

1822
FROM Assignment
19-
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
23+
WHERE CAST(created AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, CAST(NOW() AS DATE))

onprc_ehr/resources/queries/study/AssignmentsReleasedInPast1Day.query.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<tables xmlns="http://labkey.org/data/xml">
55
<table tableName="AssignmentsReleasedInPast1Day" tableDbType="TABLE">
6-
<tableTitle>Assignments released in past 24 hrs</tableTitle>
6+
<tableTitle>Assignments released in the past 24 hrs</tableTitle>
77
</table>
88
</tables>
99
</metadata>

onprc_ehr/resources/queries/study/AssignmentsReleasedInPast1Day.sql

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* Created by Kollil, Dec, 2025
2+
Tkt # 13618
3+
Priority 2: Create new Grid 2 (Assignments ended in the Past 1 Day):
4+
- List of records with new “Release date” added within the last 24hrs (omitting day leases). I am not omitting day leases for now as per Isabel's request.
5+
*/
16
SELECT
27
Id,
38
Id.demographics.gender as Sex,
@@ -16,4 +21,9 @@ SELECT
1621
releaseCondition.meaning as ConditionAtRelease
1722

1823
FROM Assignment
19-
WHERE CAST(enddate AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
24+
/* this condition: >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW()) → not older than 24 hours
25+
and this one: <= NOW() → not in the future
26+
Together, they produce exactly the last 24 hours, nothing more.
27+
*/
28+
WHERE CAST(enddate AS DATE) = TIMESTAMPADD('SQL_TSI_DAY', -1, CAST(NOW() AS DATE))
29+
AND CAST(enddate AS DATE) <= CAST(NOW() AS DATE)

onprc_ehr/resources/queries/study/AssignmentsStartedPast1to7Days.query.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<tables xmlns="http://labkey.org/data/xml">
55
<table tableName="AssignmentsStartedPast1to7Days" tableDbType="TABLE">
6-
<tableTitle>Assignments started in past 1-7 days</tableTitle>
6+
<tableTitle>Assignments started in the past 1-7 days</tableTitle>
77
</table>
88
</tables>
99
</metadata>

onprc_ehr/resources/queries/study/AssignmentsStartedPast1to7Days.sql

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* Created by Kollil, Dec, 2025
2+
Tkt # 13618
3+
Priority 4: Add links to grids 3 and 4 in daily Behavior Alerts email (do not need to display full grid in email)
4+
- for grid 3 - There were __ assignments started in the past 1-7 days" with a link, including today's date
5+
6+
*/
17
SELECT
28
Id,
39
Id.demographics.gender as Sex,
@@ -16,5 +22,10 @@ SELECT
1622
releaseCondition.meaning as ConditionAtRelease
1723

1824
FROM Assignment
19-
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
20-
AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', -7, NOW())
25+
--including today
26+
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -7, CAST(NOW() AS DATE))
27+
AND CAST(date AS DATE) <= CAST(NOW() AS DATE);
28+
--excluding today
29+
-- WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', -1, NOW())
30+
-- AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', -7, NOW())
31+

onprc_ehr/resources/queries/study/AssignmentsStartingNext1to14Days.query.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata>
44
<tables xmlns="http://labkey.org/data/xml">
55
<table tableName="AssignmentsStartingNext1to14Days" tableDbType="TABLE">
6-
<tableTitle>Assignments starting in next 1 to 14 days</tableTitle>
6+
<tableTitle>Assignments starting in the next 1 to 14 days</tableTitle>
77
</table>
88
</tables>
99
</metadata>

onprc_ehr/resources/queries/study/AssignmentsStartingNext1to14Days.sql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* Created by Kollil, Dec, 2025
2+
Tkt # 13618
3+
Priority 4: Add links to grids 3 and 4 in daily Behavior Alerts email (do not need to display full grid in email)
4+
- for grid 4 - There are __ assignments starting in the Next 1-14 days" with a link, including today's date
5+
*/
6+
17
SELECT
28
Id,
39
Id.demographics.gender as Sex,
@@ -16,5 +22,5 @@ SELECT
1622
releaseCondition.meaning as ConditionAtRelease
1723

1824
FROM Assignment
19-
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', 1, NOW())
20-
AND CAST(date AS DATE) < TIMESTAMPADD('SQL_TSI_DAY', 14, NOW())
25+
WHERE CAST(date AS DATE) >= TIMESTAMPADD('SQL_TSI_DAY', 1, CAST(NOW() AS DATE))
26+
AND CAST(date AS DATE) <= TIMESTAMPADD('SQL_TSI_DAY', 14, CAST(NOW() AS DATE))

0 commit comments

Comments
 (0)