-
Notifications
You must be signed in to change notification settings - Fork 3
Create data validation report for animal parentage #534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release22.11-SNAPSHOT
Are you sure you want to change the base?
Changes from 3 commits
05d5e8b
f1a271d
3e35ccb
fc456d7
c59a448
005f83b
e4f9256
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| SELECT * FROM ( | ||
| SELECT d1.Id, | ||
| d1.Dataset.Demographics.gender, | ||
| d1.Dataset.Demographics.species, | ||
| d1.Parents.dam, | ||
| d1.Parents.dam.Demographics.species as damSpecies, | ||
| d1.Parents.sire, | ||
| d1.Parents.sire.Demographics.species as sireSpecies, | ||
| CASE WHEN (d1.Parents.dam.Demographics.species IS NOT NULL AND d1.Parents.dam.Demographics.species != d1.Dataset.Demographics.species) OR (d1.Parents.sire.Demographics.species IS NOT NULL AND d1.Parents.sire.Demographics.species != d1.Dataset.Demographics.species) | ||
| THEN TRUE | ||
| ELSE FALSE | ||
| END as parentSpeciesMismatch | ||
| FROM study.Animal d1 | ||
| ) d2 | ||
| WHERE d2.parentSpeciesMismatch = TRUE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| SELECT * FROM ( | ||
| SELECT d1.Id, | ||
| d1.Dataset.Demographics.gender, | ||
| d1.Dataset.Demographics.species, | ||
| d1.Parents.dam, | ||
| d1.Parents.dam.Demographics.gender as damSex, | ||
| d1.Parents.sire, | ||
| d1.Parents.sire.Demographics.gender as sireSex, | ||
| CASE WHEN (d1.Parents.dam.Demographics.gender.code IS NOT NULL AND d1.Parents.dam.Demographics.gender.code != 'f') OR (d1.Parents.sire.Demographics.gender.code IS NOT NULL AND d1.Parents.sire.Demographics.gender.code != 'm') | ||
| THEN TRUE | ||
| ELSE FALSE | ||
| END as parentSexMismatch | ||
| FROM study.Animal d1 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is fine, but wouldnt it be a little better to just base this on study.demographicsParents rather than animal? you're filtering anything not present in animal, arent you?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, yes it would be better, but not all centers have study.demographicsParents working. I'm honestly just trying to keep things simple. we can always improve on it later if necessary.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it was my suggestion to use Animal. Only one center doesn't have demographicsParents, but this won't work for them anyway. We should probably look into bringing demographicsParents into core EHR and setting up the Parents column in DefaultEHRCustomizer. @jryurkanin we can sync on this.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like it might be useful to create a demographicsPedigree.sql in core EHR, and have this SQL select from study.demographics, and then merge in ehr.supplemental_pedigree. That would make columns consistent across EHR instances, and by default support supplemental_pedigree.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have something along those lines for the base demographicsParents in this PR. Most centers already have it overwritten, but we can use whatever version of demographicsParents is active for these queries. |
||
| ) d2 | ||
| WHERE d2.parentSexMismatch = TRUE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| SELECT * FROM ( | ||
| SELECT | ||
| dem.Id, | ||
| dem.gender, | ||
| dem.species, | ||
| dem.birth, | ||
| dem.dam, | ||
| damDem.birth as damBirth, | ||
| dem.sire, | ||
| sireDem.birth as sireBirth | ||
| FROM demographics dem | ||
| LEFT JOIN demographics damDem ON dem.dam = damDem.Id | ||
| LEFT JOIN demographics sireDem ON dem.sire = sireDem.Id | ||
| ) t | ||
| WHERE (t.birth <= t.damBirth OR t.birth <= t.sireBirth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment below about basing on another query besides animal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment replying to your comment