Skip to content

Commit 065177a

Browse files
Merge 23.3 to 23.7
2 parents fdee154 + 68b0f00 commit 065177a

4 files changed

Lines changed: 135 additions & 1 deletion

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--Created By: Kollil, 1/29/2024.
3+
The ETL adds a P1 clinical remark into the animal record if the MPA injection ('E-85760' - Medroxyprogesterone acetate)
4+
is marked as completed on the current day.
5+
Refer to ticket # 10208 for more details.
6+
-->
7+
<etl xmlns="http://labkey.org/etl/xml">
8+
9+
<name>MPA_ClnRemarkAddition</name>
10+
11+
<description>Executes stored procedure to populate the clinical remarks into a temp table.</description>
12+
13+
<transforms>
14+
<transform id="Stored_Proc" type="StoredProcedure">
15+
<description>Runs the stored procedure to update onprc_ehr.Temp_ClnRemarks table</description>
16+
<procedure schemaName="onprc_ehr" procedureName="MPA_ClnRemarkAddition"> </procedure>
17+
</transform>
18+
19+
<transform id="Add_MPA_ClnRemarks">
20+
<description>Import the remarks data from onprc_ehr.Temp_ClnRemarks table to study.ClnRemarks table in Prime </description>
21+
<source schemaName="onprc_ehr" queryName="Temp_ClnRemarks"/>
22+
<destination schemaName="study" queryName="clinremarks"/>
23+
</transform>
24+
</transforms>
25+
26+
<schedule>
27+
<!-- Runs daily at 10pm -->
28+
<cron expression="0 0 22 * * ?"/>
29+
</schedule>
30+
31+
</etl>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
-- =================================================================================================
2+
-- Add MPA Clinical remarks: By, Lakshmi Kolli
3+
-- Created on: 1/25/2024
4+
/* Description: Created 1 temp table to store the clinical remarks records.
5+
The stored proc manages the addition and deleting clinical remarks data from the temp table
6+
at the time of execution via ETL process.
7+
*/
8+
-- =================================================================================================
9+
10+
--Drop table if exists
11+
EXEC core.fn_dropifexists 'Temp_ClnRemarks','onprc_ehr','TABLE';
12+
--Drop Stored proc if exists
13+
EXEC core.fn_dropifexists '[onprc_ehr].[MPA_ClnRemarkAddition]', 'onprc_ehr', 'PROCEDURE';
14+
GO
15+
16+
-- Create the temp table
17+
CREATE TABLE onprc_ehr.Temp_ClnRemarks
18+
(
19+
date datetime,
20+
qcstate int,
21+
participantid nvarchar(32),
22+
project int,
23+
remark nvarchar(250) ,
24+
p nvarchar(250) ,
25+
performedby nvarchar(250) ,
26+
category nvarchar(250) ,
27+
taskid nvarchar(4000),
28+
createdby int,
29+
modifiedby int
30+
)
31+
;
32+
33+
GO
34+
35+
-- Create the stored proc
36+
/****** Object: StoredProcedure [onprc_ehr].[MPA_ClnRemarkAddition] Script Date: 1/25/2024 *****/
37+
-- =================================================================================
38+
-- Author: Lakshmi Kolli
39+
-- Create date: 1/25/2024
40+
-- Description: This procedure identifies if an animal received an MPA injection
41+
-- and inserts a clinical remark into animal's record.
42+
-- =================================================================================
43+
44+
CREATE PROCEDURE [onprc_ehr].[MPA_ClnRemarkAddition]
45+
AS
46+
47+
DECLARE
48+
@MPACount Int,
49+
@taskId nvarchar(4000)
50+
51+
BEGIN
52+
--Delete all rows from the temp_Drug table
53+
Delete From onprc_ehr.Temp_ClnRemarks
54+
55+
--Check if the MPA injection E-85760 was administered today
56+
Select @MPACount = COUNT(*) From studyDataset.c6d178_drug
57+
Where code = 'E-85760' And CONVERT(DATE, date) = CONVERT(DATE, GETDATE()) And qcstate = 18
58+
59+
--Found entries, so, enter the clinical remarks now
60+
If @MPACount > 0
61+
Begin
62+
-- Create a Task entry in ehr.tasks table
63+
Set @taskid = NEWID() -- creating taskid
64+
Insert Into ehr.tasks
65+
(taskid, category, title, formtype, qcstate, assignedto, duedate, createdby, created,
66+
container, modifiedby, modified, description, datecompleted)
67+
Values
68+
(@taskid, 'Task', 'Bulk Clinical Entry', 'Bulk Clinical Entry', 18, 1003, GETDATE(), 1003, GETDATE(),
69+
'CD17027B-C55F-102F-9907-5107380A54BE', 1003, GETDATE(), 'Created by the ETL process', GETDATE())
70+
71+
--Insert the clinical remark into the temp clinical remarks table.
72+
/* Get all the Animals who had MPA injection today from studyDataset.c6d178_drug
73+
and INSERT the data into the studyDataset.c6d185_clinremarks table */
74+
Insert Into onprc_ehr.Temp_ClnRemarks (
75+
date, qcstate, participantid, project, remark, p, performedby, category, taskid, createdby, modifiedby
76+
)
77+
Select GETDATE(), 18, participantid, project, 'Remark entered by the ETL process', 'MPA injection administered', 'onprcitsupport@ohsu.edu', 'Clinical', @taskId, 1003, 1003
78+
From studyDataset.c6d178_drug
79+
Where code = 'E-85760' And CONVERT(DATE, date) = CONVERT(DATE, GETDATE()) And qcstate = 18
80+
End
81+
82+
END
83+
84+
GO

onprc_ehr/resources/schemas/onprc_ehr.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,4 +1309,22 @@
13091309
</columns>
13101310
</table>
13111311

1312+
<!--Created by: Kollil, 1/29/24. Created a temp table to store the clinical remarks -->
1313+
<table tableName="Temp_ClnRemarks" tableDbType="TABLE">
1314+
<columns>
1315+
<column columnName="date" />
1316+
<column columnName="qcstate" />
1317+
<column columnName="participantid" />
1318+
<column columnName="project" />
1319+
<column columnName="remark" />
1320+
<column columnName="p" />
1321+
<column columnName="performedby" />
1322+
<column columnName="category" />
1323+
<column columnName="taskId" />
1324+
<column columnName="createdby" />
1325+
<column columnName="modifiedby" />
1326+
1327+
</columns>
1328+
</table>
1329+
13121330
</tables>

onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public String getName()
123123
@Override
124124
public @Nullable Double getSchemaVersion()
125125
{
126-
return 23.007;
126+
// 1/29/24 by Kollil
127+
return 23.008;
127128
}
128129

129130
@Override

0 commit comments

Comments
 (0)