Skip to content

Commit 6ec78a5

Browse files
Merge 25.11 to develop
2 parents 25fdaa4 + 2fb0cbb commit 6ec78a5

17 files changed

Lines changed: 841 additions & 22 deletions

File tree

ONPRC_EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/onprc_ehr_compliancedb-25.000-25.001.sql

Lines changed: 579 additions & 0 deletions
Large diffs are not rendered by default.

ONPRC_EHR_ComplianceDB/src/org/labkey/ONPRCEHR_ComplianceDB/ONPRC_EHR_ComplianceDBModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public String getName()
5555
@Override
5656
public Double getSchemaVersion()
5757
{
58-
return 24.012;
58+
return 25.001;
5959
} //Modified: 9-8-025
6060

6161
@Override

onprc_ehr/resources/queries/study/demographicsOffspringBSU.query.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
<column columnName="fosterMom">
4444
<columnTitle>Foster Dam</columnTitle>
4545
</column>
46+
<column columnName="surrogateMom">
47+
<columnTitle>Surrogate Dam</columnTitle>
48+
<fk>
49+
<fkDbSchema>study</fkDbSchema>
50+
<fkTable>animal</fkTable>
51+
<fkColumnName>id</fkColumnName>
52+
</fk>
53+
</column>
4654

4755
<column columnName="sire">
4856
<columnTitle>Sire</columnTitle>

onprc_ehr/resources/queries/study/demographicsOffspringBSU.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ d2.status,
1717
d2.geneticdam,
1818
d2.observeddam,
1919
d2.fosterMom,
20+
d2.surrogateMom,
2021
d2.sire,
2122
d2.sireType,
2223
d.qcstate
@@ -25,7 +26,7 @@ FROM study.Demographics d
2526

2627
INNER JOIN study.demographicsParentsBSU d2
2728

28-
ON ((d2.sire = d.id OR d2.geneticdam = d.id OR d2.fostermom = d.id OR d2.observeddam = d.id) AND d.id != d2.id)
29+
ON ((d2.sire = d.id OR d2.geneticdam = d.id OR d2.fosterMom = d.id OR d2.observeddam = d.id) AND d.id != d2.id)
2930

3031

3132

onprc_ehr/resources/queries/study/demographicsOffspringBSU/.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<column name="geneticdam"/>
1616
<column name="observeddam"/>
1717
<column name="fosterMom"/>
18+
<column name="surrogateMom"/>
1819
<column name="sire"/>
1920
<column name="sireType"/>
2021

onprc_ehr/resources/queries/study/demographicsParents/.qview.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<column name="sire"/>
77
<column name="sireType"/>
88
<column name="fostermom"/>
9+
<column name="surrogateMom"/>
910
<column name="fosterType"/>
1011
<column name="numParents"/>
1112
</columns>

onprc_ehr/resources/queries/study/demographicsParentsBSU.query.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
<fkColumnName>id</fkColumnName>
4949
</fk>
5050
</column>
51+
<column columnName="surrogateMom">
52+
<columnTitle>Surrogate Dam</columnTitle>
53+
<fk>
54+
<fkDbSchema>study</fkDbSchema>
55+
<fkTable>animal</fkTable>
56+
<fkColumnName>id</fkColumnName>
57+
</fk>
58+
</column>
5159

5260
<column columnName="numParents">
5361
<columnTitle>Number of Parents Known</columnTitle>

onprc_ehr/resources/queries/study/demographicsParentsBSU.sql

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,23 @@ SELECT
3939
ELSE null
4040
END as sireType,
4141

42-
p3.parent as fosterMom,
43-
p3.method as fosterType,
4442

45-
(CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END +
46-
CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END +
47-
CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents
43+
coalesce(p3.parent, '') as fosterMom,
44+
CASE
45+
WHEN p3.parent IS NOT NULL THEN p3.method
46+
ELSE null
47+
END as fosterType,
48+
49+
coalesce(p4.parent, '') as surrogateMom,
50+
CASE
51+
WHEN p4.parent IS NOT NULL THEN p4.method
52+
ELSE null
53+
END as surrogateType,
54+
55+
(CASE WHEN p4.parent IS NOT NULL THEN 1 ELSE 0 END +
56+
CASE WHEN p3.parent IS NOT NULL THEN 1 ELSE 0 END +
57+
CASE WHEN coalesce(p2.parent, b.dam) IS NOT NULL THEN 1 ELSE 0 END +
58+
CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents
4859

4960
FROM study.demographics d
5061

@@ -68,5 +79,12 @@ LEFT JOIN (
6879
WHERE p3.relationship = 'Foster Dam' AND p3.enddate IS NULL
6980
GROUP BY p3.Id
7081
) p3 ON (d.Id = p3.id)
82+
83+
LEFT JOIN (
84+
select p4.id, min(p4.method) as method, max(p4.parent) as parent
85+
FROM study.parentage p4
86+
WHERE p4.relationship = 'Surrogate Dam' AND p4.enddate IS NULL
87+
GROUP BY p4.Id
88+
) p4 ON (d.Id = p4.id)
7189
LEFT JOIN study.birth b ON (b.id = d.id)
7290

onprc_ehr/resources/queries/study/parentageSummary.query.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
<table tableName="parentageSummary" tableDbType="TABLE">
55
<tableTitle>Parentage Summary</tableTitle>
66
<columns>
7+
<column columnName="Id">
8+
<columnTitle>Id</columnTitle>
9+
</column>
10+
<column columnName="date">
11+
<columnTitle>Date</columnTitle>
12+
</column>
713
<column columnName="parent">
814
<columnTitle>Parent</columnTitle>
915
<fk>
@@ -18,6 +24,12 @@
1824
<column columnName="method">
1925
<columnTitle>Method</columnTitle>
2026
</column>
27+
<column columnName="remark">
28+
<columnTitle>Comments</columnTitle>
29+
</column>
30+
<column columnName="source">
31+
<columnTitle>Data Source</columnTitle>
32+
</column>
2133
</columns>
2234
</table>
2335
</tables>

onprc_ehr/resources/queries/study/parentageSummary.sql

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ SELECT
1818
p.date,
1919
p.parent,
2020
p.relationship,
21-
p.method
21+
p.method,
22+
p.remark,
23+
'Parentage' as source
2224

2325
FROM study.parentage p
2426
WHERE p.qcstate.publicdata = true and p.enddate is null
27+
And p.date in (select max(t.date) from study.parentage t where p.Id = t.Id And p.parent = t.parent
28+
And p.relationship =t.relationship And p.method = t.method And t.enddate is null and p.enddate is null and t.qcstate.publicdata = true)
2529

2630
UNION
2731

@@ -30,20 +34,23 @@ SELECT
3034
b.date,
3135
b.dam,
3236
'Dam' as relationship,
33-
'Observed' as method
37+
'Observed' as method,
38+
null as remark,
39+
'Birth' as source
3440

3541
FROM study.birth b
3642
WHERE b.dam is not null and b.qcstate.publicdata = true
37-
And 'dam' not in (select k.relationship from study.parentage k where k.Id = b.Id and k.enddate is null)
43+
3844
UNION
3945

4046
SELECT
4147
a.Id,
42-
a.date,
48+
a.date,
4349
a.sire,
4450
'Sire' as relationship,
45-
'Observed' as method
51+
'Observed' as method,
52+
null as remark,
53+
'Birth' as source
4654

4755
FROM study.birth a
4856
WHERE a.sire is not null and a.qcstate.publicdata = true
49-
And 'sire' not in (select k.relationship from study.parentage k where k.Id = a.Id and k.enddate is null)

0 commit comments

Comments
 (0)