Skip to content

Commit 7c99d93

Browse files
committed
Update notification
1 parent 10f7c87 commit 7c99d93

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
SELECT
2-
t.Id,
3-
t.date,
4-
t.sampleType,
5-
t.assayType,
6-
t.target,
7-
t.result,
8-
t.dataSource
2+
t.Id,
3+
t.date,
4+
t.sampleType,
5+
t.assayType,
6+
t.target,
7+
t.result,
8+
t.resultOORIndicator,
9+
t.dataSource,
10+
t.lsid,
11+
t.created,
12+
v.maxLsid,
13+
CASE WHEN t.lsid = v.maxLsid THEN TRUE ELSE FALSE END as isMostRecent
914

1015
FROM study.viralLoads t
11-
12-
WHERE t.lsid IN (SELECT lsid FROM study.viralLoads v GROUP BY v.Id, v.date, v.sampleType, v.assayType HAVING count(*) > 1)
16+
INNER JOIN (
17+
SELECT v.Id, v.date, v.sampleType, v.assayType, max(v.lsid) as maxLsid
18+
FROM study.viralLoads v
19+
GROUP BY v.Id, v.date, v.sampleType, v.assayType
20+
HAVING count(*) > 1
21+
) v ON (v.Id = t.Id AND v.date = t.date AND v.sampleType = t.sampleType AND v.assayType = t.assayType)

SivStudies/src/org/labkey/sivstudies/notification/SivStudiesDataValidationNotification.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public String getEmailSubject(Container c)
7878
idsMissingFromDemographics(c, u, msg);
7979
missingArtRecord(c, u, msg);
8080
missingAnchorDates(c, u, msg);
81+
duplicatePVLs(c, u, msg);
8182

8283
if (!msg.isEmpty())
8384
{
@@ -175,6 +176,17 @@ private void missingAnchorDates(Container c, User u, StringBuilder msg)
175176
genericQueryCheck(c, u, msg, "study", "missingAnchorDates", "records missing from the anchor dates table");
176177
}
177178

179+
private void duplicatePVLs(Container c, User u, StringBuilder msg)
180+
{
181+
Study s = StudyService.get().getStudy(getTargetContainer(c));
182+
if (s == null)
183+
{
184+
return;
185+
}
186+
187+
genericQueryCheck(c, u, msg, "study", "duplicatePVLs", "duplicate PVL records");
188+
}
189+
178190
protected Container getTargetContainer(Container c)
179191
{
180192
return c.isWorkbookOrTab() ? c.getParent() : c;

0 commit comments

Comments
 (0)