-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Udpate of onprc_ehr.xml to add update status to theeIACUC_PRIME_VIEW_…
…PROTOCOLS dataset
- Loading branch information
1 parent
feea40a
commit 41f2c11
Showing
12 changed files
with
273 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
70
onprc_ehr/resources/queries/onprc_ehr/eIACUCtoPrimeUpdate.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
26
onprc_ehr/resources/queries/onprc_ehr/eIACUCwithBaseProtocol.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
onprc_ehr/resources/queries/onprc_ehr/eIACUFiedlUpdateforProtocol.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
onprc_ehr/resources/queries/onprc_ehr/eIACUProtocolReview.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
9 changes: 9 additions & 0 deletions
9
onprc_ehr/resources/queries/onprc_ehr/eiACUCtoProtocolPhase1.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
81 changes: 81 additions & 0 deletions
81
onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.002-24.003.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
onprc_ehr/resources/schemas/dbscripts/sqlserver/onprc_ehr-24.003-24.004.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters