Skip to content

Commit 8ecd08b

Browse files
committed
More qcstate checks
1 parent d802cff commit 8ecd08b

6 files changed

Lines changed: 6 additions & 3 deletions

File tree

nirc_ehr/resources/queries/study/demographicsCagemates.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ JOIN study.housing h2
2020
ON (h2.Id.demographics.calculated_status = 'Alive'
2121
AND (h.cage = h2.cage))
2222

23-
WHERE h.enddateTimeCoalesced >= now()
23+
WHERE h.enddateTimeCoalesced >= now() AND h.qcstate.publicdata = true AND h2.qcstate.publicdata = true
2424
GROUP BY h.id, h.room, h.cage
2525

2626
) t ON (t.id = d.id)

nirc_ehr/resources/queries/study/demographicsCurLocation.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ d2.performedBy.displayName AS performedBy
3333

3434
FROM study.housing d2
3535

36-
WHERE d2.enddate IS NULL
36+
WHERE d2.enddate IS NULL AND d2.qcstate.publicdata = true
3737
AND d2.qcstate.publicdata = true

nirc_ehr/resources/queries/study/demographicsOffspring.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ FROM study.Demographics d
1717

1818
INNER JOIN study.Demographics d2
1919
ON ((d2.sire = d.id OR d2.dam = d.id) AND d.id != d2.id)
20+
WHERE d.qcstate.publicdata = true
2021

2122
group by d.id, d2.id, d2.birth, d2.sire, d2.dam, d2.gender, d.qcstate

nirc_ehr/resources/queries/study/demographicsParents.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SELECT
2525
ELSE 0
2626
END as numParents
2727
FROM study.demographics d
28+
WHERE d.qcstate.publicdata = true
2829

2930
-- TODO: Incorporate fostering? Genetic testing?
3031

nirc_ehr/resources/queries/study/demographicsSiblings.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FROM study.Demographics d1
3030
JOIN study.Demographics d2
3131
ON ((d2.id.parents.sire = d1.id.parents.sire OR d2.id.parents.dam = d1.id.parents.dam) AND d1.id != d2.id)
3232

33-
WHERE d2.id is not null
33+
WHERE d2.id IS NOT NULL AND d1.qcstate.publicdata = true AND d2.qcstate.publicdata = true
3434

3535
-- ) t
3636

nirc_ehr/resources/queries/study/demographicsSource.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ LEFT JOIN
2727
ON (T1.Id = d.Id)
2828

2929
LEFT JOIN study.arrival T2 ON (t2.id = d.id AND t2.date = t1.earliestArrival)
30+
WHERE d.qcstate.publicdata = true AND t2.qcstate.publicdata = true AND t1.qcstate.publicdata = true
3031

0 commit comments

Comments
 (0)