From 05d5e8be041de5c652535807fd3582ecf81791f5 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:11:57 -0800 Subject: [PATCH 1/7] Create parentDifferentSpecies.sql identify animals with parents of a different species --- .../queries/study/parentDifferentSpecies.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ehr/resources/queries/study/parentDifferentSpecies.sql diff --git a/ehr/resources/queries/study/parentDifferentSpecies.sql b/ehr/resources/queries/study/parentDifferentSpecies.sql new file mode 100644 index 000000000..a7062e34c --- /dev/null +++ b/ehr/resources/queries/study/parentDifferentSpecies.sql @@ -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 From f1a271d48c8e560680018cee5a9f809ac88d0aaf Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:24:49 -0800 Subject: [PATCH 2/7] Create parentsWrongGender.sql identify animals with a parent whose gender does not match their sire/dam designation --- .../queries/study/parentsWrongGender.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ehr/resources/queries/study/parentsWrongGender.sql diff --git a/ehr/resources/queries/study/parentsWrongGender.sql b/ehr/resources/queries/study/parentsWrongGender.sql new file mode 100644 index 000000000..7935cda24 --- /dev/null +++ b/ehr/resources/queries/study/parentsWrongGender.sql @@ -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 +) d2 +WHERE d2.parentSexMismatch = TRUE From 3e35ccb15fd2ffd71255d7af229437df92af2e67 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:40:19 -0800 Subject: [PATCH 3/7] Create parentsYoungerThanOffspring.sql identifies animals whose parents that are younger than their offspring --- .../queries/study/parentsYoungerThanOffspring.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ehr/resources/queries/study/parentsYoungerThanOffspring.sql diff --git a/ehr/resources/queries/study/parentsYoungerThanOffspring.sql b/ehr/resources/queries/study/parentsYoungerThanOffspring.sql new file mode 100644 index 000000000..76bc3589c --- /dev/null +++ b/ehr/resources/queries/study/parentsYoungerThanOffspring.sql @@ -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) From fc456d7f8a4d8c78c42486c35a312ec8152ddfe4 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Sun, 26 Feb 2023 11:27:06 -0800 Subject: [PATCH 4/7] Rename parentDifferentSpecies.sql to parentsDifferentSpecies.sql --- .../{parentDifferentSpecies.sql => parentsDifferentSpecies.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ehr/resources/queries/study/{parentDifferentSpecies.sql => parentsDifferentSpecies.sql} (100%) diff --git a/ehr/resources/queries/study/parentDifferentSpecies.sql b/ehr/resources/queries/study/parentsDifferentSpecies.sql similarity index 100% rename from ehr/resources/queries/study/parentDifferentSpecies.sql rename to ehr/resources/queries/study/parentsDifferentSpecies.sql From c59a4487f4b4075c9c364558e23d992329a73155 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Sun, 26 Feb 2023 11:29:59 -0800 Subject: [PATCH 5/7] create parentsBothDamAndSire.sql identify animals which are listed as both a dam and a sire --- .../queries/study/parentsBothDamAndSire.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 ehr/resources/queries/study/parentsBothDamAndSire.sql diff --git a/ehr/resources/queries/study/parentsBothDamAndSire.sql b/ehr/resources/queries/study/parentsBothDamAndSire.sql new file mode 100644 index 000000000..b7b34dc1e --- /dev/null +++ b/ehr/resources/queries/study/parentsBothDamAndSire.sql @@ -0,0 +1,30 @@ +SELECT t.Id as Parent, GROUP_CONCAT(t.DamChildren, ',') as DamChildren, GROUP_CONCAT(t.SireChildren, ',') as SireChildren FROM +( + +SELECT d.Id, d.DamChildren, s.SireChildren FROM ( + +SELECT Id as DamChildren, +dam as Id +FROM demographics +WHERE dam IN ( +SELECT Distinct dam as Id +FROM demographics +WHERE dam IN (SELECT Distinct sire FROM demographics)) +) d + +JOIN + +(SELECT * FROM ( + +SELECT Id as SireChildren, +sire as Id +FROM demographics +WHERE sire IN ( +SELECT Distinct dam as Id +FROM demographics +WHERE dam IN (SELECT Distinct sire FROM demographics)) +) si ) s + +ON s.Id = d.Id +) t +GROUP BY t.Id \ No newline at end of file From 005f83b58d2a3a42df63c5717014ca837eaa8a98 Mon Sep 17 00:00:00 2001 From: jryurkanin <104916543+jryurkanin@users.noreply.github.com> Date: Sun, 26 Feb 2023 11:36:29 -0800 Subject: [PATCH 6/7] create dataValidationReport page --- ehr/resources/views/dataValidationReport.html | 71 +++++++++++++++++++ .../views/dataValidationReport.view.xml | 5 ++ 2 files changed, 76 insertions(+) create mode 100644 ehr/resources/views/dataValidationReport.html create mode 100644 ehr/resources/views/dataValidationReport.view.xml diff --git a/ehr/resources/views/dataValidationReport.html b/ehr/resources/views/dataValidationReport.html new file mode 100644 index 000000000..32b4d0b39 --- /dev/null +++ b/ehr/resources/views/dataValidationReport.html @@ -0,0 +1,71 @@ +
+ Each of the below data grids identifies issues present in the animal colony data that would prevent the pedigree plots from working correctly.
+ To correct any data consistency issues, use this report as a reference for identifying the data issues, and then correct them on the demographics dataset, which can be access with the below button.
+
| + + | ++ + | +
| + + | ++ + | +