Skip to content
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 @@ -2,4 +2,5 @@ SELECT
d.id,
a.project.name as project
FROM study.demographics d
LEFT JOIN study.assignment a ON (a.id = d.id AND a.enddate IS NULL)
LEFT JOIN study.assignment a ON (a.id = d.id AND a.enddate IS NULL)
WHERE a.qcstate.publicdata = true
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ SELECT
END as varchar(500)) as protocolString

FROM study.demographics d
LEFT JOIN study.protocolAssignment a ON (a.id = d.id AND a.enddate IS NULL)
LEFT JOIN study.protocolAssignment a ON (a.id = d.id AND a.enddate IS NULL)
WHERE a.qcstate.publicdata = true
2 changes: 1 addition & 1 deletion nirc_ehr/resources/queries/study/demographicsCagemates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ JOIN study.housing h2
ON (h2.Id.demographics.calculated_status = 'Alive'
AND (h.cage = h2.cage))

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

) t ON (t.id = d.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ d2.performedBy.displayName AS performedBy

FROM study.housing d2

WHERE d2.enddate IS NULL
WHERE d2.enddate IS NULL AND d2.qcstate.publicdata = true
AND d2.qcstate.publicdata = true
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/study/demographicsOffspring.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ FROM study.Demographics d

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

group by d.id, d2.id, d2.birth, d2.sire, d2.dam, d2.gender, d.qcstate
1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/study/demographicsParents.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SELECT
ELSE 0
END as numParents
FROM study.demographics d
WHERE d.qcstate.publicdata = true

-- TODO: Incorporate fostering? Genetic testing?

2 changes: 1 addition & 1 deletion nirc_ehr/resources/queries/study/demographicsSiblings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FROM study.Demographics d1
JOIN study.Demographics d2
ON ((d2.id.parents.sire = d1.id.parents.sire OR d2.id.parents.dam = d1.id.parents.dam) AND d1.id != d2.id)

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

-- ) t

1 change: 1 addition & 0 deletions nirc_ehr/resources/queries/study/demographicsSource.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ LEFT JOIN
ON (T1.Id = d.Id)

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