Skip to content

Commit

Permalink
Udpate of onprc_ehr.xml to add update status to theeIACUC_PRIME_VIEW_…
Browse files Browse the repository at this point in the history
…PROTOCOLS dataset
  • Loading branch information
jonesgaohsu committed Jul 24, 2024
1 parent feea40a commit 41f2c11
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 8 deletions.
28 changes: 28 additions & 0 deletions onprc_ehr/resources/etls/ProtocolMergefromeIACUC.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--update of procedure to production for daily run-->
<etl xmlns="http://labkey.org/etl/xml">

<name>InserteIACCUtoProtocol</name>
<description>Updates select columns into ehr Protocol extensible columns </description>
<transforms>

<transform id="transform2">
<source schemaName="onprc_ehr" queryName="eIACUC_PRIME_VIEW_PROTOCOLS"/>
<destination schemaName="ehr" queryName="protocol" targetOption="merge">
<columnTransforms>
<column source="BaseProtocol" target="BaseProtocol"/>
<column source="RenewalNumber" target="RevisionNumber"/>
<column source="Protocol_State" target="Protocol_State"/>
<column source="last_modified" target="last_modified"/>
</columnTransforms>
<alternateKeys>
<!-- The pk of the target table is the "rowId" column. Use "OtherId" as an alternate match key -->
<column name="BaseProtocol"/>
</alternateKeys>

</destination>
</transform>


</transforms>
</etl>
16 changes: 16 additions & 0 deletions onprc_ehr/resources/etls/eIACUCtoPrimePhase1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<etl xmlns="http://labkey.org/etl/xml">
<name>eiACUCtoProtocolPhase1</name>
<description>Populates the extensible fields in Protocol</description>
<transforms>

<transform id="step1a">
<description>Transfer to Protocols</description>
<source queryName="eIACUCtoProtocolPhase1" schemaName="onprc_ehr"/>
<destination queryName="protocol" schemaName="ehr" targetOption="merge"/>
</transform>
<!--//Need a query that has needed fields for BaseProtocol and revisionNumber and then inserts that into eIACUC_Prime_View_Protocols
Also only want latest data-->

</transforms>

</etl>
Empty file.
70 changes: 70 additions & 0 deletions onprc_ehr/resources/queries/onprc_ehr/eIACUCtoPrimeUpdate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<etl xmlns="http://labkey.org/etl/xml">
<name>eiACUCtoPrimeUpdate</name>
<description>Transfers from the eIACUC Import tables to the Prime tables in ONPRC_EHR</description>
<transforms>
<transform id="step1a">
<description>Transfer to eIACUC Animal Groups</description>
<source queryName="PRIME_VIEW_ANIMAL_GROUPS" schemaName="eIACUC"/>
<destination queryName="eIACUC_PRIME_VIEW_ANIMAL_GROUPS" schemaName="ONPRC_EHR" targetOption="truncate"/>
</transform>
<transform id="step2a">
<description>Transfer to IBX Numbers</description>
<source queryName="PRIME_VIEW_IBC_NUMBERS" schemaName="eIACUC"/>
<destination queryName="eIACUC_PRIME_VIEW_IBC_NUMBERS" schemaName="ONPRC_EHR" targetOption="truncate"/>
</transform>
<transform id="step3a">
<description>Transfer to Non Surgical Procedures</description>
<source queryName="PRIME_VIEW_NON_SURGICAL_PROCS" schemaName="eIACUC"/>
<destination queryName="eIACUC_PRIME_VIEW_NON_SURGICAL_PROCS" schemaName="ONPRC_EHR" targetOption="truncate"/>
</transform>
<transform id="step4a">
<description>Transfer to Protocols</description>
<source queryName="eIACUCwithBaseProtocol" schemaName="eIACUC"/>
<destination queryName="eIACUC_PRIME_VIEW_PROTOCOLS" schemaName="ONPRC_EHR" targetOption="truncate"/>
</transform>
<transform id="step5a">
<description>Transfer to Surgical Procedures</description>
<source queryName="PRIME_VIEW_SURGERIES" schemaName="eIACUC"/>
<destination queryName="eIACUC_PRIME_VIEW_SURGICAL_PROCS" schemaName="ONPRC_EHR" targetOption="truncate"/>
</transform>
<!--
<!–Need to update to change the processes and document each one–>
<transform id="Stored_ProcStep10" type="StoredProcedure">
<description>Runs a stored procedure tocapture information from the eIACUC Protocol Table.</description>
<procedure schemaName="ONPRC_EHR" procedureName="etlStep1eIACUCtoPRIMEProcessing">
</procedure>
</transform>
<transform id="Stored_ProcStep20" type="StoredProcedure">
<description>Runs a stored procedure to process records from eIACUC to temp to ehr.protocol.</description>
<procedure schemaName="ONPRC_EHR" procedureName="etlStep2eIACUCtoPublicAction">
</procedure>
</transform>
<transform id="Stored_ProcStep30" type="StoredProcedure">
<description>Runs a stored procedure identify record updated from eIACUC2 to ehrProtocol ending ehrProtocol Record.</description>
<procedure schemaName="ONPRC_EHR" procedureName="etlStep3update_ehrProtocol">
</procedure>
</transform>
<transform id="Stored_ProcStep40" type="StoredProcedure">
<description>Runs a stored procedure to insert new and updated records from eIACUC to ehrProtocol and update log.</description>
<procedure schemaName="ONPRC_EHR" procedureName="etlStep4insertToEhr_Protocol">
</procedure>
</transform>
-->
</transforms>
<!-- <schedule>
<poll interval="12h"/>
</schedule>-->
</etl>
26 changes: 26 additions & 0 deletions onprc_ehr/resources/queries/onprc_ehr/eIACUCwithBaseProtocol.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELECT p.Protocol_ID,
Case when len(p.protocol_id) > 10 then substring(p.protocol_id, 6,15)
else p.protocol_id
End as BaseProtocol,
Case when len(p.protocol_id) > 10 then substring(p.protocol_id, 1,4)
else 'Original'
End as RevisionNumber,

p.Date_Modified,
p.Template_OID,
p.OID,
p.Protocol_Title,
p.Protocol_State,
p.PI_ID,
p.PI_First_Name,
p.PI_Last_Name,
p.PI_Email,
p.PI_Phone,
p.USDA_Level,
p.PPQ_Numbers,
p.Approval_date,
p.Annual_Update_Last_Approved,
p.Annual_Update_Due,
p.Three_Year_Expiration,
p.Last_Modified
FROM PRIME_VIEW_PROTOCOLS p
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Select p.baseProtocol,
p.RevisionNumber,
p.Protocol_State,
p.PPQ_Numbers,
p.Last_Modified,
p.USDA_Level
from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p
--where p.last_Modified = (Select Max(p1.Last_Modified) from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p1 where p1.BaseProtocol = p.BaseProtocol))
21 changes: 21 additions & 0 deletions onprc_ehr/resources/queries/onprc_ehr/eIACUProtocolReview.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SELECT e.rowid,
e.Protocol_ID,
e.Template_OID,
e.Protocol_OID,
e.Protocol_Title,
e.USDA_Level,
e.Approval_Date,
e.Annual_Update_Due,
e.Three_year_Expiration,
e.Last_Modified,
e.PROTOCOL_State,
e.BaseProtocol,
e.RevisionNumber,
Case
When p.external_id is Null then 'No Longer in Prime'
When (p.enddate is null and e.Protocol_State != 'Approved')then 'Still Active in Prime'
when (p.enddate is not null and p.external_id is not null) then 'Active in Prime'
End as ProtocolStatus,
p.external_ID,
p.enddate
FROM eIACUC_PRIME_VIEW_PROTOCOLS e left join ehr.protocol p on e.BaseProtocol = p.external_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
e.BaseProtocol,
e.RenewalNumber,
e.Protocol_state,
e.LatestRenewal,
p.protocol

from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS e join ehr.protocol p on e.BaseProtocol = p.external_id
where e.latestRenewal = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Jonesga
-- Create date: 2024/07/18
-- Description: Iniitial Stage of update of eIACUC to protocol processing
-- =============================================

CREATE PROCEDURE onprc_ehr.eIACUCBaseProtocol

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
--Drop Temporary Table
DROP TABLE #eIACUCBaseProtocol
-- Insert statements for procedure here
cREATE tABLE #eIACUCBaseProtocol
(BaseProtocol varchar(50) Not Null,
RevisionNumber varchar(20) Not Null,
Protocol_Id varchar(50) Not Null,
Last_Modified varchar(30) not null ,
LatestInstance varchar (30) Not Null);

--Populate the temporary table from query
Insert INTO #eIACUCBaseProtocol(BaseProtocol,RevisionNumber,Protocol_id,Last_Modified,LatestInstance)
Select

Case when len(p.protocol_id) > 10 then substring(p.protocol_id, 6,15)
else p.protocol_id
End as BaseProtocol,
Case when len(p.protocol_id) > 10 then substring(p.protocol_id, 1,4)
else 'Original'
End as RevisionNumber,
protocol_id,
Last_Modified,
' ' as LatestInstance

from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p

Update p1
Set p1.BaseProtocol = e.BaseProtocol

from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p1 join #eIACUCUpdate e on p1.protocol_id = e.Protocol_Id

Update p1
Set p1.RevisionNumber = e.RevisionNumber

from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p1 join #eIACUCUpdate e on p1.protocol_id = e.Protocol_Id



--Now will limit the records to be inserted to most recent record


update p
Set p.updateStatus = 'Update'

from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p
where (p.BaseProtocol is not null and p.last_Modified = (Select Max(p1.Last_Modified) from onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS p1 where p1.BaseProtocol = p.BaseProtocol))





END
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ALTER TABLE onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS DROP COLUMN IF EXISTS BaseProtocol;
ALTER TABLE onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS DROP COLUMN IF EXISTS RevisionNumber;
ALTER TABLE onprc_ehr.eIACUC_PRIME_VIEW_PROTOCOLS DROP COLUMN IF EXISTS UpdateStatus;


ALTER TABLE [onprc_ehr].[eIACUC_PRIME_VIEW_PROTOCOLS] ADD BaseProtocol varchar(50) ;
ALTER TABLE [onprc_ehr].[eIACUC_PRIME_VIEW_PROTOCOLS] ADD RenewalNumber varchar(50) ;
ALTER TABLE [onprc_ehr].[eIACUC_PRIME_VIEW_PROTOCOLS] ADD LatestRenewal Bit ;
4 changes: 3 additions & 1 deletion onprc_ehr/resources/schemas/onprc_ehr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@
<column columnName="Surgery_Name"/>
</columns>
</table>

<table tableName="eIACUC_PRIME_VIEW_PROTOCOLS" tableDbType="TABLE">
<columns>
<column columnName="rowid"/>
Expand All @@ -735,6 +734,9 @@
<column columnName="PROTOCOL_State"/>
<column columnName="PPQ_Numbers"/>
<column columnName="Description"/>
<column columnName="BaseProtocol"/>
<column columnName="RevisionNumber"/>
<column columnName="UpdateStatus"/>
</columns>
</table>
<table tableName="PotentialDam_source" tableDbType="TABLE">
Expand Down
10 changes: 3 additions & 7 deletions onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
return 23.013;
return 24.004;
}

@Override
Expand Down Expand Up @@ -219,9 +219,6 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext)
//Added Oct 3rd, 2023 Kollil
ns.registerNotification(new TreatmentAlertsMPANotification(this));

//Added June 28th, 2024 Kollil
ns.registerNotification(new LongTermMedsNotification(this));

//Added 8-7-2018 R.Blasa
ns.registerNotification(new BirthHousingMismatchNotification(this));

Expand All @@ -230,7 +227,6 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext)

//Added 6-4-2019 Additional Scheduled for 5pm
ns.registerNotification(new TreatmentAlertsPostOpsNotificationThird(this));

//Added 5-9-2024 Additional to validate Available Draw Feed Values
ns.registerNotification(new AvailableBloodVolumeNotification(this));

Expand Down Expand Up @@ -407,10 +403,10 @@ public String toString()
}


//Modified: 7-2-2024 R.Blasa
//Modified: 9-7-2023 R.Blasa
try
{
EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.moreReports, "Clinical Pathology Test Results for Environmental Assessment Summary Report", this, new URLHelper("https://pcdbssrsprd1.ohsu.edu/ReportServer/Pages/ReportViewer.aspx?%2fPrime+Reports%2fClinPath%2fPrimeLaboratory_AssessmentReport&rs:Command=Render")
EHRService.get().registerReportLink(EHRService.REPORT_LINK_TYPE.moreReports, "Clinical Pathology CPL Surface Sanitation Summary Report", this, new URLHelper("https://pcdbssrsprd1.ohsu.edu/ReportServer/Pages/ReportViewer.aspx?%2fPrime+Reports%2fClinPath%2fPrimeLaboratory_AssessmentReport&rs:Command=Render")
{
// SSRS is picky about the URI-encoding of the query parameters
@Override
Expand Down

0 comments on commit 41f2c11

Please sign in to comment.