From 44df3e1cdde4fc91faacae1ea071043254f11fea Mon Sep 17 00:00:00 2001 From: blasar Date: Mon, 6 Apr 2026 19:28:05 -0700 Subject: [PATCH 1/5] Modified demograhics query to include observed type from parentage data set. In addition as an option, created reporting to surrogate dam --- onprc_ehr/resources/queries/study/demographicsParents.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/onprc_ehr/resources/queries/study/demographicsParents.sql b/onprc_ehr/resources/queries/study/demographicsParents.sql index 91f7029d2..52e1fff32 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.sql +++ b/onprc_ehr/resources/queries/study/demographicsParents.sql @@ -31,6 +31,8 @@ SELECT END as sireType, p3.parent as fosterMom, p3.method as fosterType, + p4.parent as SurrogateMom, + p4.method as SurrogateType, (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END + @@ -58,5 +60,11 @@ LEFT JOIN ( WHERE p3.relationship = 'Foster Dam' AND p3.enddate IS NULL GROUP BY p3.Id ) p3 ON (d.Id = p3.id) +LEFT JOIN ( + select p4.id, min(p4.method) as method, max(p4.parent) as parent, max(p4.modified) as modified + FROM study.parentage p4 + WHERE p4.relationship = 'Surrogate Dam' AND p4.enddate IS NULL + GROUP BY p4.Id +) p4 ON (d.Id = p4.id) LEFT JOIN study.birth b ON (b.id = d.id) From fedd54d64e4ffc0e6e2d9e267c9494b6a3328f82 Mon Sep 17 00:00:00 2001 From: blasar Date: Mon, 6 Apr 2026 19:40:29 -0700 Subject: [PATCH 2/5] Modified demograhics query to include observed type from parentage data set. In addition as an option, created reporting to surrogate dam --- onprc_ehr/resources/queries/study/demographicsParents.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/onprc_ehr/resources/queries/study/demographicsParents.sql b/onprc_ehr/resources/queries/study/demographicsParents.sql index 52e1fff32..8cf1bec42 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.sql +++ b/onprc_ehr/resources/queries/study/demographicsParents.sql @@ -31,8 +31,6 @@ SELECT END as sireType, p3.parent as fosterMom, p3.method as fosterType, - p4.parent as SurrogateMom, - p4.method as SurrogateType, (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END + @@ -43,14 +41,14 @@ FROM study.demographics d LEFT JOIN ( select p1.id, min(p1.method) as method, max(p1.parent) as parent, max(p1.modified) as modified FROM study.parentage p1 - WHERE (p1.method = 'Genetic' OR p1.method = 'Provisional Genetic') AND p1.relationship = 'Sire' AND p1.enddate IS NULL + WHERE p1.method in ('Genetic','Provisional Genetic','Observed') AND p1.relationship = 'Sire' AND p1.enddate IS NULL GROUP BY p1.Id ) p1 ON (d.Id = p1.id) LEFT JOIN ( select p2.id, min(p2.method) as method, max(p2.parent) as parent, max(p2.modified) as modified FROM study.parentage p2 - WHERE (p2.method = 'Genetic' OR p2.method = 'Provisional Genetic') AND p2.relationship = 'Dam' AND p2.enddate IS NULL + WHERE p2.method in ('Genetic','Provisional Genetic','Observed') AND p2.relationship = 'Dam' AND p2.enddate IS NULL GROUP BY p2.Id ) p2 ON (d.Id = p2.id) @@ -66,5 +64,6 @@ LEFT JOIN ( WHERE p4.relationship = 'Surrogate Dam' AND p4.enddate IS NULL GROUP BY p4.Id ) p4 ON (d.Id = p4.id) + LEFT JOIN study.birth b ON (b.id = d.id) From f78cab4e15b3502e8bb5a2985ec43eee5905ff03 Mon Sep 17 00:00:00 2001 From: blasar Date: Wed, 8 Apr 2026 11:13:21 -0700 Subject: [PATCH 3/5] Modified demographics reporting. --- onprc_ehr/resources/queries/study/demographicsParents.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/demographicsParents.sql b/onprc_ehr/resources/queries/study/demographicsParents.sql index 8cf1bec42..d0b4aeae2 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.sql +++ b/onprc_ehr/resources/queries/study/demographicsParents.sql @@ -31,11 +31,14 @@ SELECT END as sireType, p3.parent as fosterMom, p3.method as fosterType, + p4.parent as SurrogateMom, + p4.method as SurrogateType, (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END + + CASE WHEN p4.parent IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents, - greatest(d.modified, p1.modified, p2.modified, p3.modified, b.modified) as modified + greatest(d.modified, p1.modified, p2.modified, p3.modified, p4.modified, b.modified) as modified FROM study.demographics d LEFT JOIN ( From 35cd3226bccf032a12d72d54fc79b6535657bc0e Mon Sep 17 00:00:00 2001 From: blasar Date: Thu, 9 Apr 2026 09:14:40 -0700 Subject: [PATCH 4/5] Modified demographics reporting. --- .../resources/queries/study/demographicsParents.query.xml | 8 ++++++++ onprc_ehr/resources/queries/study/demographicsParents.sql | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/onprc_ehr/resources/queries/study/demographicsParents.query.xml b/onprc_ehr/resources/queries/study/demographicsParents.query.xml index e3ef57f38..00cdb7b45 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.query.xml +++ b/onprc_ehr/resources/queries/study/demographicsParents.query.xml @@ -31,6 +31,14 @@ id + + Surrogate Dam + + study + animal + id + + Genetic Dam diff --git a/onprc_ehr/resources/queries/study/demographicsParents.sql b/onprc_ehr/resources/queries/study/demographicsParents.sql index d0b4aeae2..84e5c26e6 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.sql +++ b/onprc_ehr/resources/queries/study/demographicsParents.sql @@ -31,7 +31,7 @@ SELECT END as sireType, p3.parent as fosterMom, p3.method as fosterType, - p4.parent as SurrogateMom, + p4.parent as SurrogateDam, p4.method as SurrogateType, (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END + From e3da7751185dd84d0526f1ced71c9aa7ac81f6da Mon Sep 17 00:00:00 2001 From: blasar Date: Wed, 13 May 2026 20:01:21 -0700 Subject: [PATCH 5/5] Modified NHP Blood Processing program. --- .../queries/study/demographicsParents.query.xml | 12 ++++++++++-- .../resources/queries/study/demographicsParents.sql | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/onprc_ehr/resources/queries/study/demographicsParents.query.xml b/onprc_ehr/resources/queries/study/demographicsParents.query.xml index 00cdb7b45..43f12bfe3 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.query.xml +++ b/onprc_ehr/resources/queries/study/demographicsParents.query.xml @@ -8,7 +8,7 @@ true - Dam + Genetic Dam study animal @@ -40,7 +40,7 @@ - Genetic Dam + Genetic Dam Type study animal @@ -50,6 +50,14 @@ Number of Parents Known + + + Birth Record Dam + + + + Surrogate Dam + diff --git a/onprc_ehr/resources/queries/study/demographicsParents.sql b/onprc_ehr/resources/queries/study/demographicsParents.sql index 84e5c26e6..2979896f4 100644 --- a/onprc_ehr/resources/queries/study/demographicsParents.sql +++ b/onprc_ehr/resources/queries/study/demographicsParents.sql @@ -16,12 +16,11 @@ SELECT d.id, - coalesce(p2.parent, b.dam) as dam, + p2.parent as geneticdam, CASE WHEN p2.parent IS NOT NULL THEN p2.method - WHEN b.dam IS NOT NULL THEN 'Observed' - ELSE null - END as damType, + ELSE null + END as geneticdamType, coalesce(p1.parent, b.sire) as sire, CASE @@ -33,6 +32,7 @@ SELECT p3.method as fosterType, p4.parent as SurrogateDam, p4.method as SurrogateType, + b.dam as birthdam, (CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END + CASE WHEN p4.parent IS NOT NULL THEN 1 ELSE 0 END +