Skip to content

Commit 4a3031e

Browse files
authored
fix(data): set all notifications and data as read (#597)
Set all notifications and the respective data as read by the respective caregivers. This is done at the end (last script) so that it happens after all data is inserted. Also removed an educational material for Rory that should not be there.
1 parent 82c3c54 commit 4a3031e

File tree

5 files changed

+208
-86
lines changed

5 files changed

+208
-86
lines changed

db_management/opaldb/data/test/omi/omi_announcement.sql

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,6 @@ WHERE PatientSerNum = 92
6262
AND NotificationControlSerNum = 5;
6363

6464
-- Update all Announcement dates and read statuses to make the data more similar to a live environment
65-
-- Rorys data read by rory
66-
UPDATE Announcement
67-
SET ReadStatus = 1,
68-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
69-
WHERE PatientSerNum = 59
70-
;
71-
UPDATE Notification
72-
SET ReadStatus = 1,
73-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
74-
WHERE PatientSerNum = 59
75-
AND NotificationControlSerNum = 5
76-
;
7765

7866
-- "Radiation Oncology will be Closed" sent 2 weeks ago
7967
UPDATE Announcement

db_management/opaldb/data/test/omi/omi_educationmaterial.sql

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
-- SPDX-License-Identifier: AGPL-3.0-or-later
44

55
INSERT INTO `EducationalMaterial` (`EducationalMaterialSerNum`, `CronLogSerNum`, `EducationalMaterialControlSerNum`, `PatientSerNum`, `DateAdded`, `ReadStatus`, `ReadBy`, `LastUpdated`) VALUES
6-
-- rory: treatment guidelines, databank info, lung guidelines
6+
-- rory: treatment guidelines, databank info
77
(17, NULL, 105, 59, '2023-05-15 08:00:55', 0, '[]', '2023-01-12 16:39:17'),
8-
(18, NULL, 979, 59, '2023-05-15 08:00:55', 0, '[]', '2023-01-12 16:39:17'),
9-
(19, NULL, 480, 59, '2023-05-15 08:00:55', 0, '[]', '2023-01-12 16:39:17');
8+
(18, NULL, 979, 59, '2023-05-15 08:00:55', 0, '[]', '2023-01-12 16:39:17');
109

1110
-- Treatment guidelines sent 1 day after diagnosis for all
1211

@@ -16,24 +15,7 @@ SET `DateAdded` = DATE_ADD(now(), INTERVAL -13 DAY),
1615
WHERE PatientSerNum = 59
1716
AND `EducationalMaterialControlSerNum` = 105;
1817

19-
-- Rory's lung guidelines sent 14 days ago
20-
UPDATE `EducationalMaterial`
21-
SET `DateAdded` = DATE_ADD(now(), INTERVAL -14 DAY),
22-
`LastUpdated` = DATE_ADD(now(), INTERVAL -14 DAY)
23-
WHERE PatientSerNum IN (59)
24-
AND `EducationalMaterialSerNum` = 19;
25-
2618
-- Remove some notifications
27-
-- Rory has read all their own data
28-
UPDATE `EducationalMaterial`
29-
SET ReadStatus = 1,
30-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
31-
WHERE PatientSerNum = 59;
32-
UPDATE Notification
33-
SET ReadStatus = 1,
34-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
35-
WHERE PatientSerNum = 59
36-
AND NotificationControlSerNum = 7;
3719

3820
-- laurie data
3921
INSERT INTO `EducationalMaterial` (`EducationalMaterialSerNum`, `CronLogSerNum`, `EducationalMaterialControlSerNum`, `PatientSerNum`, `DateAdded`, `ReadStatus`, `ReadBy`, `LastUpdated`) VALUES
@@ -101,4 +83,4 @@ WHERE `EducationalMaterialControlSerNum` = 979;
10183
UPDATE `EducationalMaterial`
10284
SET `DateAdded` = DATE_ADD(now(), INTERVAL -14 DAY),
10385
`LastUpdated` = DATE_ADD(now(), INTERVAL -14 DAY)
104-
WHERE `EducationalMaterialControlSerNum` NOT IN (979, 105, 480);
86+
WHERE `EducationalMaterialControlSerNum` NOT IN (979);

db_management/opaldb/data/test/omi/omi_questionnaires.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ WHERE PatientSerNum = 92
7777
AND NotificationControlSerNum = 13;
7878

7979
-- Set all other questionnaires sent 2 weeks ago
80-
UPDATE `EducationalMaterial`
80+
UPDATE `Questionnaire`
8181
SET `DateAdded` = DATE_ADD(now(), INTERVAL -14 DAY),
8282
`LastUpdated` = DATE_ADD(now(), INTERVAL -14 DAY)
83-
WHERE `EducationalMaterialControlSerNum` NOT IN (157);
83+
WHERE `QuestionnaireControlSerNum` NOT IN (157);

db_management/opaldb/data/test/omi/omi_txteammessage.sql

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
-- SPDX-License-Identifier: AGPL-3.0-or-later
44

55
INSERT INTO `TxTeamMessage` (`TxTeamMessageSerNum`, `CronLogSerNum`, `PatientSerNum`, `PostControlSerNum`, `DateAdded`, `ReadStatus`, `ReadBy`, `LastUpdated`) VALUES
6-
(4, NULL, 59, 13, '2000-01-01 00:00:00', 0, '[]', '2000-01-01 00:00:00'),
76
(7, NULL, 92, 13, '2016-12-29 12:15:33', 1, '["a51fba18-3810-4808-9238-4d0e487785c8"]', '2016-12-29 12:18:18'),
87
(16, NULL, 92, 22, '2016-12-29 14:25:36', 1, '["a51fba18-3810-4808-9238-4d0e487785c8"]', '2016-12-29 14:37:42'),
98
(28, NULL, 92, 28, '2017-07-26 11:16:16', 1, '["a51fba18-3810-4808-9238-4d0e487785c8"]', '2017-07-26 14:24:34'),
@@ -26,44 +25,6 @@ INSERT INTO `TxTeamMessage` (`TxTeamMessageSerNum`, `CronLogSerNum`, `PatientSer
2625
-- Update all TxTeamMessage dates and read statuses to make the data more similar to a live environment
2726

2827
-- All TxTeamMessages and their Notifications marked as read
29-
-- Marge's data read by Marge
30-
UPDATE TxTeamMessage
31-
SET ReadStatus = 1,
32-
ReadBy = '["QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
33-
WHERE PatientSerNum = 51
34-
;
35-
UPDATE Notification
36-
SET ReadStatus = 1,
37-
ReadBy = '["QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
38-
WHERE PatientSerNum = 51
39-
AND NotificationControlSerNum = 4
40-
;
41-
42-
-- Homer's data read by Homer and Marge
43-
UPDATE TxTeamMessage
44-
SET ReadStatus = 1,
45-
ReadBy = '["PyKlcbRpMLVm8lVnuopFnFOHO4B3", "QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
46-
WHERE PatientSerNum = 52
47-
;
48-
UPDATE Notification
49-
SET ReadStatus = 1,
50-
ReadBy = '["PyKlcbRpMLVm8lVnuopFnFOHO4B3", "QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
51-
WHERE PatientSerNum = 52
52-
AND NotificationControlSerNum = 4
53-
;
54-
55-
-- Bart's data read by Bart and Marge
56-
UPDATE TxTeamMessage
57-
SET ReadStatus = 1,
58-
ReadBy = '["SipDLZCcOyTYj7O3C8HnWLalb4G3", "QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
59-
WHERE PatientSerNum = 53
60-
;
61-
UPDATE Notification
62-
SET ReadStatus = 1,
63-
ReadBy = '["SipDLZCcOyTYj7O3C8HnWLalb4G3", "QXmz5ANVN3Qp9ktMlqm2tJ2YYBz2"]'
64-
WHERE PatientSerNum = 53
65-
AND NotificationControlSerNum = 4
66-
;
6728

6829
-- Welcome Message sent 4 weeks ago
6930
UPDATE TxTeamMessage
@@ -78,18 +39,6 @@ SET ReadStatus = 1,
7839
WHERE PatientSerNum = 92
7940
AND NotificationControlSerNum = 4;
8041

81-
-- Rory's data read by Rory
82-
UPDATE TxTeamMessage
83-
SET ReadStatus = 1,
84-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
85-
WHERE PatientSerNum = 59
86-
;
87-
UPDATE Notification
88-
SET ReadStatus = 1,
89-
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
90-
WHERE PatientSerNum = 59
91-
AND NotificationControlSerNum = 4
92-
;
9342
UPDATE TxTeamMessage
9443
SET DateAdded = DATE_ADD(now(), INTERVAL -14 DAY),
9544
LastUpdated = DATE_ADD(now(), INTERVAL -14 DAY)
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
-- SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <[email protected]>
2+
--
3+
-- SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
-- Update all read statuses to mimic a live environment and assume that everyone read their data
6+
-- This is done at the end of inserting all data
7+
8+
-- Rorys data read by rory
9+
UPDATE Announcement
10+
SET ReadStatus = 1,
11+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
12+
WHERE PatientSerNum = 59
13+
;
14+
UPDATE EducationalMaterial
15+
SET ReadStatus = 1,
16+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
17+
WHERE PatientSerNum = 59
18+
;
19+
UPDATE TxTeamMessage
20+
SET ReadStatus = 1,
21+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
22+
WHERE PatientSerNum = 59
23+
;
24+
UPDATE Notification
25+
SET ReadStatus = 1,
26+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2"]'
27+
WHERE PatientSerNum = 59
28+
;
29+
30+
-- Caras data read by rory and cara
31+
UPDATE Announcement
32+
SET ReadStatus = 1,
33+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2", "dR2Cb1Yf0vQb4ywvMoAXw1SxbY93"]'
34+
WHERE PatientSerNum = 96
35+
;
36+
UPDATE EducationalMaterial
37+
SET ReadStatus = 1,
38+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2", "dR2Cb1Yf0vQb4ywvMoAXw1SxbY93"]'
39+
WHERE PatientSerNum = 96
40+
;
41+
UPDATE TxTeamMessage
42+
SET ReadStatus = 1,
43+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2", "dR2Cb1Yf0vQb4ywvMoAXw1SxbY93"]'
44+
WHERE PatientSerNum = 96
45+
;
46+
UPDATE Notification
47+
SET ReadStatus = 1,
48+
ReadBy = '["mouj1pqpXrYCl994oSm5wtJT3In2", "dR2Cb1Yf0vQb4ywvMoAXw1SxbY93"]'
49+
WHERE PatientSerNum = 96
50+
;
51+
52+
-- Johns data read by John
53+
UPDATE Announcement
54+
SET ReadStatus = 1,
55+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2"]'
56+
WHERE PatientSerNum = 93
57+
;
58+
UPDATE EducationalMaterial
59+
SET ReadStatus = 1,
60+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2"]'
61+
WHERE PatientSerNum = 93
62+
;
63+
UPDATE TxTeamMessage
64+
SET ReadStatus = 1,
65+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2"]'
66+
WHERE PatientSerNum = 93
67+
;
68+
UPDATE Notification
69+
SET ReadStatus = 1,
70+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2"]'
71+
WHERE PatientSerNum = 93
72+
;
73+
74+
-- Richards data read by John and Richard
75+
UPDATE Announcement
76+
SET ReadStatus = 1,
77+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2", "2WhxeTpYF8aHlfSQX8oGeq4LFhw2"]'
78+
WHERE PatientSerNum = 94
79+
;
80+
UPDATE EducationalMaterial
81+
SET ReadStatus = 1,
82+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2", "2WhxeTpYF8aHlfSQX8oGeq4LFhw2"]'
83+
WHERE PatientSerNum = 94
84+
;
85+
UPDATE TxTeamMessage
86+
SET ReadStatus = 1,
87+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2", "2WhxeTpYF8aHlfSQX8oGeq4LFhw2"]'
88+
WHERE PatientSerNum = 94
89+
;
90+
UPDATE Notification
91+
SET ReadStatus = 1,
92+
ReadBy = '["hIMnEXkedPMxYnXeqNXzphklu4V2", "2WhxeTpYF8aHlfSQX8oGeq4LFhw2"]'
93+
WHERE PatientSerNum = 94
94+
;
95+
96+
-- Valeries data read by Valerie
97+
UPDATE Announcement
98+
SET ReadStatus = 1,
99+
ReadBy = '["dcBSK5qdoiOM2L9cEdShkqOadkG3"]'
100+
WHERE PatientSerNum = 99
101+
;
102+
UPDATE EducationalMaterial
103+
SET ReadStatus = 1,
104+
ReadBy = '["dcBSK5qdoiOM2L9cEdShkqOadkG3"]'
105+
WHERE PatientSerNum = 99
106+
;
107+
UPDATE TxTeamMessage
108+
SET ReadStatus = 1,
109+
ReadBy = '["dcBSK5qdoiOM2L9cEdShkqOadkG3"]'
110+
WHERE PatientSerNum = 99
111+
;
112+
UPDATE Notification
113+
SET ReadStatus = 1,
114+
ReadBy = '["dcBSK5qdoiOM2L9cEdShkqOadkG3"]'
115+
WHERE PatientSerNum = 99
116+
;
117+
118+
-- Petes data read by Pete
119+
UPDATE Announcement
120+
SET ReadStatus = 1,
121+
ReadBy = '["9kmS7qYQX8arnFFs4ZYJk1tqLFw1"]'
122+
WHERE PatientSerNum = 100
123+
;
124+
UPDATE EducationalMaterial
125+
SET ReadStatus = 1,
126+
ReadBy = '["9kmS7qYQX8arnFFs4ZYJk1tqLFw1"]'
127+
WHERE PatientSerNum = 100
128+
;
129+
UPDATE TxTeamMessage
130+
SET ReadStatus = 1,
131+
ReadBy = '["9kmS7qYQX8arnFFs4ZYJk1tqLFw1"]'
132+
WHERE PatientSerNum = 100
133+
;
134+
UPDATE Notification
135+
SET ReadStatus = 1,
136+
ReadBy = '["9kmS7qYQX8arnFFs4ZYJk1tqLFw1"]'
137+
WHERE PatientSerNum = 100
138+
;
139+
140+
-- Martins data read by Martin
141+
UPDATE Announcement
142+
SET ReadStatus = 1,
143+
ReadBy = '["2grqcCoyPlVucfAPD4NM1SuCk3i1"]'
144+
WHERE PatientSerNum = 101
145+
;
146+
UPDATE EducationalMaterial
147+
SET ReadStatus = 1,
148+
ReadBy = '["2grqcCoyPlVucfAPD4NM1SuCk3i1"]'
149+
WHERE PatientSerNum = 101
150+
;
151+
UPDATE TxTeamMessage
152+
SET ReadStatus = 1,
153+
ReadBy = '["2grqcCoyPlVucfAPD4NM1SuCk3i1"]'
154+
WHERE PatientSerNum = 101
155+
;
156+
UPDATE Notification
157+
SET ReadStatus = 1,
158+
ReadBy = '["2grqcCoyPlVucfAPD4NM1SuCk3i1"]'
159+
WHERE PatientSerNum = 101
160+
;
161+
162+
-- Mikes data read by Mike
163+
UPDATE Announcement
164+
SET ReadStatus = 1,
165+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2"]'
166+
WHERE PatientSerNum = 103
167+
;
168+
UPDATE EducationalMaterial
169+
SET ReadStatus = 1,
170+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2"]'
171+
WHERE PatientSerNum = 103
172+
;
173+
UPDATE TxTeamMessage
174+
SET ReadStatus = 1,
175+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2"]'
176+
WHERE PatientSerNum = 103
177+
;
178+
UPDATE Notification
179+
SET ReadStatus = 1,
180+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2"]'
181+
WHERE PatientSerNum = 103
182+
;
183+
-- Kathys data read by Mike and Kathy
184+
UPDATE Announcement
185+
SET ReadStatus = 1,
186+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2", "OPWj4Cj5iRfgva4b3HGtVGjvuk13"]'
187+
WHERE PatientSerNum = 102
188+
;
189+
UPDATE EducationalMaterial
190+
SET ReadStatus = 1,
191+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2", "OPWj4Cj5iRfgva4b3HGtVGjvuk13"]'
192+
WHERE PatientSerNum = 102
193+
;
194+
UPDATE TxTeamMessage
195+
SET ReadStatus = 1,
196+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2", "OPWj4Cj5iRfgva4b3HGtVGjvuk13"]'
197+
WHERE PatientSerNum = 102
198+
;
199+
UPDATE Notification
200+
SET ReadStatus = 1,
201+
ReadBy = '["hSJdAae7xWNwnemd2YypQSVfoOb2", "OPWj4Cj5iRfgva4b3HGtVGjvuk13"]'
202+
WHERE PatientSerNum = 102
203+
;

0 commit comments

Comments
 (0)