@@ -123,7 +123,10 @@ def test_db():
123123 (2, 8532, 0, 0, 1996), -- Female, qualifying, not excluded due to not having cardiac surgery
124124 (3, 8532, 0, 0, 1996), -- Female, has cardiac surgery
125125 (4, 8507, 0, 0, 1980), -- Male, wrong gender
126- (5, 8532, 0, 0, 1980); -- Female, missing insulin
126+ (5, 8532, 0, 0, 1980), -- Female, missing insulin
127+ -- for offset and negative instance testing
128+ (6, 8532, 0, 0, 1985), -- Female, multiple diabetes records, last one too early
129+ (7, 8532, 0, 0, 1990); -- Female, diabetes record too recent
127130 """ )
128131
129132 # Insert mock concepts as needed
@@ -141,7 +144,8 @@ def test_db():
141144 (5, 'Fever', '2012-04-01', '2020-04-01', 'R50.9', 'ICD10CM', 'Condition'),
142145 (37311061, 'COVID-19', '2012-04-01', '2020-04-01', '840539006', 'SNOMED', 'Condition'),
143146 (4041664, 'Difficulty breathing', '2012-04-01', '2020-04-01', '230145002', 'SNOMED', 'Condition'),
144- (316139, 'Heart failure', '2012-04-01', '2020-04-01', '84114007', 'SNOMED', 'Condition');
147+ (316139, 'Heart failure', '2012-04-01', '2020-04-01', '84114007', 'SNOMED', 'Condition'),
148+ (201826, 'Type 2 diabetes mellitus', '2012-04-01', '2020-04-01', '44054006', 'SNOMED', 'Condition');
145149 """ )
146150
147151 # Insert hierarchical relationships as needed
@@ -163,7 +167,8 @@ def test_db():
163167 (1, 3, 1), -- Diabetes -> Type 2
164168 (1, 4, 2), -- Diabetes -> Retinopathy
165169 (2, 4, 1), -- Type 1 -> Diabetes Retinopathy
166- (3, 4, 1); -- Type 2 -> Diabetes Retinopathy
170+ (3, 4, 1), -- Type 2 -> Diabetes Retinopathy
171+ (201826, 201826, 0); -- Type 2 diabetes SNOMED
167172 """ )
168173
169174 # Insert mock condition occurrences as needed
@@ -199,7 +204,11 @@ def test_db():
199204 (2, 201826, '2020-06-01', '2020-06-01'), -- Person 2: Diabetes
200205 (3, 201826, '2020-06-01', '2020-06-01'), -- Person 3: Diabetes
201206 (4, 201826, '2020-06-01', '2020-06-01'), -- Person 4: Diabetes
202- (5, 201826, '2020-06-01', '2020-06-01'); -- Person 5: Diabetes
207+ (5, 201826, '2020-06-01', '2020-06-01'), -- Person 5: Diabetes
208+ -- for negative event instance and offset testing
209+ (6, 201826, '2017-01-01', '2017-01-01'), -- Person 6: Early diabetes record
210+ (6, 201826, '2018-01-01', '2018-01-01'), -- Person 6: Last diabetes record, still early
211+ (7, 201826, '2023-01-01', '2023-01-01'); -- Person 7: Recent diabetes record
203212 """ )
204213
205214 # Insert mock visit data
@@ -220,7 +229,10 @@ def test_db():
220229 (2, 9, 9202, '2020-06-10', '2020-06-10'), -- Person 2: Outpatient
221230 (3, 10, 9202, '2020-06-10', '2020-06-10'), -- Person 3: Outpatient
222231 (4, 11, 9202, '2020-06-10', '2020-06-10'), -- Person 4: Outpatient
223- (5, 12, 9202, '2020-06-10', '2020-06-10'); -- Person 5: Outpatient
232+ (5, 12, 9202, '2020-06-10', '2020-06-10'), -- Person 5: Outpatient
233+ -- New patients (no visits needed for exclusion testing)
234+ (6, 13, 9202, '2018-01-10', '2018-01-10'), -- Person 6: Outpatient
235+ (7, 14, 9202, '2023-01-10', '2023-01-10'); -- Person 7: Outpatient
224236 """ )
225237
226238 # Insert mock procedure_occurrence data for mixed domain testing
@@ -234,7 +246,9 @@ def test_db():
234246 (3, 3, 4048609, '2020-06-20'), -- Person 3: Blood test
235247 (3, 4, 619339, '2020-06-25'), -- Person 3: Cardiac surgery (exclusion)
236248 (4, 5, 4048609, '2020-06-20'), -- Person 4: Blood test
237- (5, 6, 4048609, '2020-06-20'); -- Person 5: Blood test
249+ (5, 6, 4048609, '2020-06-20'), -- Person 5: Blood test
250+ (6, 7, 4048609, '2018-01-15'), -- Person 6: Blood test
251+ (7, 8, 4048609, '2023-01-15'); -- Person 7: Blood test
238252 """ )
239253
240254 # Insert mock procedure_occurrence data for mixed domain testing
@@ -246,7 +260,9 @@ def test_db():
246260 (1, 4285892, '2020-06-15', '2020-06-15'), -- Person 1: Insulin 14 days after
247261 (2, 4285892, '2020-06-15', '2020-06-15'), -- Person 2: Insulin
248262 (3, 4285892, '2020-06-15', '2020-06-15'), -- Person 3: Insulin
249- (4, 4285892, '2020-06-15', '2020-06-15'); -- Person 4: Insulin
263+ (4, 4285892, '2020-06-15', '2020-06-15'), -- Person 4: Insulin
264+ (6, 4285892, '2018-01-20', '2018-01-20'), -- Person 6: Insulin
265+ (7, 4285892, '2023-01-20', '2023-01-20'); -- Person 7: Insulin
250266 -- Person 5: No insulin
251267 """ )
252268
0 commit comments