Skip to content
Merged
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public String getName()
@Override
public Double getSchemaVersion()
{
return 24.012;
return 25.001;
} //Modified: 9-8-025

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
<column columnName="fosterMom">
<columnTitle>Foster Dam</columnTitle>
</column>
<column columnName="surrogateMom">
<columnTitle>Surrogate Dam</columnTitle>
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>animal</fkTable>
<fkColumnName>id</fkColumnName>
</fk>
</column>

<column columnName="sire">
<columnTitle>Sire</columnTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ d2.status,
d2.geneticdam,
d2.observeddam,
d2.fosterMom,
d2.surrogateMom,
d2.sire,
d2.sireType,
d.qcstate
Expand All @@ -25,7 +26,7 @@ FROM study.Demographics d

INNER JOIN study.demographicsParentsBSU d2

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)
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)



Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<column name="geneticdam"/>
<column name="observeddam"/>
<column name="fosterMom"/>
<column name="surrogateMom"/>
<column name="sire"/>
<column name="sireType"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<column name="sire"/>
<column name="sireType"/>
<column name="fostermom"/>
<column name="surrogateMom"/>
<column name="fosterType"/>
<column name="numParents"/>
</columns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
<fkColumnName>id</fkColumnName>
</fk>
</column>
<column columnName="surrogateMom">
<columnTitle>Surrogate Dam</columnTitle>
<fk>
<fkDbSchema>study</fkDbSchema>
<fkTable>animal</fkTable>
<fkColumnName>id</fkColumnName>
</fk>
</column>

<column columnName="numParents">
<columnTitle>Number of Parents Known</columnTitle>
Expand Down
28 changes: 23 additions & 5 deletions onprc_ehr/resources/queries/study/demographicsParentsBSU.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,23 @@ SELECT
ELSE null
END as sireType,

p3.parent as fosterMom,
p3.method as fosterType,

(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 +
CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents
coalesce(p3.parent, '') as fosterMom,
CASE
WHEN p3.parent IS NOT NULL THEN p3.method
ELSE null
END as fosterType,

coalesce(p4.parent, '') as surrogateMom,
CASE
WHEN p4.parent IS NOT NULL THEN p4.method
ELSE null
END as surrogateType,

(CASE WHEN p4.parent IS NOT NULL THEN 1 ELSE 0 END +
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 +
CASE WHEN coalesce(p1.parent, b.sire) IS NOT NULL THEN 1 ELSE 0 END) as numParents

FROM study.demographics d

Expand All @@ -68,5 +79,12 @@ 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
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)

12 changes: 12 additions & 0 deletions onprc_ehr/resources/queries/study/parentageSummary.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<table tableName="parentageSummary" tableDbType="TABLE">
<tableTitle>Parentage Summary</tableTitle>
<columns>
<column columnName="Id">
<columnTitle>Id</columnTitle>
</column>
<column columnName="date">
<columnTitle>Date</columnTitle>
</column>
<column columnName="parent">
<columnTitle>Parent</columnTitle>
<fk>
Expand All @@ -18,6 +24,12 @@
<column columnName="method">
<columnTitle>Method</columnTitle>
</column>
<column columnName="remark">
<columnTitle>Comments</columnTitle>
</column>
<column columnName="source">
<columnTitle>Data Source</columnTitle>
</column>
</columns>
</table>
</tables>
Expand Down
19 changes: 13 additions & 6 deletions onprc_ehr/resources/queries/study/parentageSummary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ SELECT
p.date,
p.parent,
p.relationship,
p.method
p.method,
p.remark,
'Parentage' as source

FROM study.parentage p
WHERE p.qcstate.publicdata = true and p.enddate is null
And p.date in (select max(t.date) from study.parentage t where p.Id = t.Id And p.parent = t.parent
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)

UNION

Expand All @@ -30,20 +34,23 @@ SELECT
b.date,
b.dam,
'Dam' as relationship,
'Observed' as method
'Observed' as method,
null as remark,
'Birth' as source

FROM study.birth b
WHERE b.dam is not null and b.qcstate.publicdata = true
And 'dam' not in (select k.relationship from study.parentage k where k.Id = b.Id and k.enddate is null)

UNION

SELECT
a.Id,
a.date,
a.date,
a.sire,
'Sire' as relationship,
'Observed' as method
'Observed' as method,
null as remark,
'Birth' as source

FROM study.birth a
WHERE a.sire is not null and a.qcstate.publicdata = true
And 'sire' not in (select k.relationship from study.parentage k where k.Id = a.Id and k.enddate is null)
13 changes: 13 additions & 0 deletions onprc_ehr/resources/queries/study/parentageSummary/.qview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<columns>
<column name="Id"/>
<column name="parent"/>
<column name="relationship"/>
<column name="method"/>
<column name="remark"/>
<column name="source"/>
</columns>
<sorts>
<sort column="date" descending="true"/>
</sorts>
</customView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<customView xmlns="http://labkey.org/data/xml/queryCustomView">
<columns>
<column name="Id"/>
<column name="date"/>
<column name="parent"/>
<column name="relationship"/>
<column name="method"/>
<column name="remark"/>
<column name="source"/>
</columns>
<sorts>
<sort column="date" descending="true"/>
</sorts>
</customView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@

CREATE TABLE onprc_ehr.RequirementName_Convert(
searchid integer IDENTITY(100,1) NOT NULL,
PreviousDesignation varchar(255) NULL,
afterName varchar(255) NULL,
FileName varchar(1000) NULL
) ON [PRIMARY]
GO


/*
**
** Created by Date Comment
**
**
** Blasa 1/6/2026 Convert Compliance Requirement Names to its new predefined names.
*/


CREATE Procedure onprc_ehr.sp_Compliance_requirementname_Update_Process




AS

DECLARE

@SearchKey Int,
@TempsearchKey Int,
@Code varchar(500)
Begin



---Initial Values
set @TempSearchkey = 0
set @Searchkey = 0



select top 1 @Searchkey= searchid from onprc_ehr.requirementname_Convert
order by searchid


While @TempSearchKey < @SearchKey
BEGIN

select top 1 @Code=PreviousDesignation from onprc_ehr.requirementname_Convert
Where searchid = @Searchkey

If @@Error <> 0
GoTo Err_Proc

------Process Requirement Names

Update ss
set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''

from ehr_Compliancedb.Requirements ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
And jj.PreviousDesignation like '' + trim(@code) + '%'

If @@Error <> 0
GoTo Err_Proc

------Process Completion Dates

Update ss
set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''

from ehr_Compliancedb.CompletionDates ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
And jj.PreviousDesignation like '' + trim(@code) + '%'

If @@Error <> 0
GoTo Err_Proc

------Process Requirements per Employees

Update ss
set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''

from ehr_Compliancedb.RequirementsPerEmployee ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
And jj.PreviousDesignation like '' + trim(@code) + '%'

If @@Error <> 0
GoTo Err_Proc

-----Process Requirements per Categories

Update ss
set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''

from ehr_Compliancedb.RequirementsPerCategory ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
And jj.PreviousDesignation like '' + trim(@code) + '%'

If @@Error <> 0
GoTo Err_Proc

-----Process Employee Requirements Exemptions

Update ss
set ss.RequirementName = '' + trim(jj.aftername) + ' ' + trim(jj.filename) + ''

from ehr_Compliancedb.EmployeeRequirementExemptions ss, onprc_ehr.requirementname_Convert jj where ss.RequirementName like '' + trim(@code) + '%'
And jj.PreviousDesignation like '' + trim(@code) + '%'

If @@Error <> 0
GoTo Err_Proc


----- Process the next data record

Set @TempSearchkey = @SearchKey


select top 1 @Searchkey= searchid from onprc_ehr.requirementname_Convert
Where searchid > @TempSearchkey
order by searchid

If @@Error <> 0
GoTo Err_Proc


END ---(While)



RETURN 0


Err_Proc:


RETURN 1


END

GO


9 changes: 9 additions & 0 deletions onprc_ehr/resources/schemas/onprc_ehr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1471,4 +1471,13 @@
</columns>
</table>

<table tableName="RequirementName_Convert" tableDbType="TABLE">
<columns>
<column columnName="searchid"/>
<column columnName="PreviousDesignation"/>
<column columnName="afterName"/>
<column columnName="FileName"/>
</columns>
</table>

</tables>
2 changes: 1 addition & 1 deletion onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
return 25.003;
return 25.004;
}

@Override
Expand Down
Loading