@@ -249,9 +249,9 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
249
249
// smallestCohort and largestCohort do not overlap...
250
250
filterCohortPairs := []utils.CustomDichotomousVariableDef {
251
251
{
252
- CohortId1 : smallestCohort .Id ,
253
- CohortId2 : largestCohort .Id ,
254
- ProvidedName : "test" },
252
+ CohortDefinitionId1 : smallestCohort .Id ,
253
+ CohortDefinitionId2 : largestCohort .Id ,
254
+ ProvidedName : "test" },
255
255
}
256
256
resultsDataSource := tests .GetResultsDataSource ()
257
257
var subjectIds []* SubjectId
@@ -267,13 +267,13 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
267
267
// now add a pair that overlaps with largestCohort:
268
268
filterCohortPairs = []utils.CustomDichotomousVariableDef {
269
269
{
270
- CohortId1 : smallestCohort .Id ,
271
- CohortId2 : largestCohort .Id ,
272
- ProvidedName : "test" },
270
+ CohortDefinitionId1 : smallestCohort .Id ,
271
+ CohortDefinitionId2 : largestCohort .Id ,
272
+ ProvidedName : "test" },
273
273
{
274
- CohortId1 : extendedCopyOfSecondLargestCohort .Id ,
275
- CohortId2 : largestCohort .Id ,
276
- ProvidedName : "test" },
274
+ CohortDefinitionId1 : extendedCopyOfSecondLargestCohort .Id ,
275
+ CohortDefinitionId2 : largestCohort .Id ,
276
+ ProvidedName : "test" },
277
277
}
278
278
subjectIds = []* SubjectId {}
279
279
population = largestCohort
@@ -289,13 +289,13 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
289
289
// order doesn't matter:
290
290
filterCohortPairs = []utils.CustomDichotomousVariableDef {
291
291
{
292
- CohortId1 : extendedCopyOfSecondLargestCohort .Id ,
293
- CohortId2 : largestCohort .Id ,
294
- ProvidedName : "test" },
292
+ CohortDefinitionId1 : extendedCopyOfSecondLargestCohort .Id ,
293
+ CohortDefinitionId2 : largestCohort .Id ,
294
+ ProvidedName : "test" },
295
295
{
296
- CohortId1 : smallestCohort .Id ,
297
- CohortId2 : largestCohort .Id ,
298
- ProvidedName : "test" },
296
+ CohortDefinitionId1 : smallestCohort .Id ,
297
+ CohortDefinitionId2 : largestCohort .Id ,
298
+ ProvidedName : "test" },
299
299
}
300
300
subjectIds = []* SubjectId {}
301
301
population = largestCohort
@@ -311,9 +311,9 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
311
311
// now test with two other cohorts that overlap:
312
312
filterCohortPairs = []utils.CustomDichotomousVariableDef {
313
313
{
314
- CohortId1 : secondLargestCohort .Id ,
315
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
316
- ProvidedName : "test" },
314
+ CohortDefinitionId1 : secondLargestCohort .Id ,
315
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
316
+ ProvidedName : "test" },
317
317
}
318
318
subjectIds = []* SubjectId {}
319
319
population = extendedCopyOfSecondLargestCohort
@@ -329,13 +329,13 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
329
329
// now add in the largestCohort as a pair of extendedCopyOfSecondLargestCohort to the mix above:
330
330
filterCohortPairs = []utils.CustomDichotomousVariableDef {
331
331
{
332
- CohortId1 : secondLargestCohort .Id ,
333
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
334
- ProvidedName : "test" },
332
+ CohortDefinitionId1 : secondLargestCohort .Id ,
333
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
334
+ ProvidedName : "test" },
335
335
{
336
- CohortId1 : largestCohort .Id ,
337
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
338
- ProvidedName : "test" },
336
+ CohortDefinitionId1 : largestCohort .Id ,
337
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
338
+ ProvidedName : "test" },
339
339
}
340
340
subjectIds = []* SubjectId {}
341
341
population = extendedCopyOfSecondLargestCohort
@@ -376,27 +376,27 @@ func TestQueryFilterByCohortPairsHelper(t *testing.T) {
376
376
// should return 0:
377
377
filterCohortPairs = []utils.CustomDichotomousVariableDef {
378
378
{
379
- CohortId1 : largestCohort .Id ,
380
- CohortId2 : largestCohort .Id ,
381
- ProvidedName : "test" },
379
+ CohortDefinitionId1 : largestCohort .Id ,
380
+ CohortDefinitionId2 : largestCohort .Id ,
381
+ ProvidedName : "test" },
382
382
}
383
383
subjectIds = []* SubjectId {}
384
384
population = largestCohort
385
385
resultsDataSource = tests .GetResultsDataSource ()
386
386
query = models .QueryFilterByCohortPairsHelper (filterCohortPairs , resultsDataSource , population .Id , "unionAndIntersect" ).
387
387
Select ("subject_id" )
388
388
_ = query .Scan (& subjectIds )
389
- // in this case we expect overlap the size to be 0, since the pair is composed of the same cohort in CohortId1 and CohortId2 and their overlap is excluded:
389
+ // in this case we expect overlap the size to be 0, since the pair is composed of the same cohort in CohortDefinitionId1 and CohortDefinitionId2 and their overlap is excluded:
390
390
if len (subjectIds ) != 0 {
391
391
t .Errorf ("Expected 0 overlap, found %d" , len (subjectIds ))
392
392
}
393
393
394
394
// should return 0:
395
395
filterCohortPairs = []utils.CustomDichotomousVariableDef {
396
396
{
397
- CohortId1 : thirdLargestCohort .Id ,
398
- CohortId2 : largestCohort .Id ,
399
- ProvidedName : "test" },
397
+ CohortDefinitionId1 : thirdLargestCohort .Id ,
398
+ CohortDefinitionId2 : largestCohort .Id ,
399
+ ProvidedName : "test" },
400
400
}
401
401
subjectIds = []* SubjectId {}
402
402
population = smallestCohort
@@ -417,9 +417,9 @@ func TestRetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndTwoCohortPai
417
417
// setting the largest and smallest cohorts here as a pair:
418
418
filterCohortPairs := []utils.CustomDichotomousVariableDef {
419
419
{
420
- CohortId1 : smallestCohort .Id ,
421
- CohortId2 : largestCohort .Id ,
422
- ProvidedName : "test" },
420
+ CohortDefinitionId1 : smallestCohort .Id ,
421
+ CohortDefinitionId2 : largestCohort .Id ,
422
+ ProvidedName : "test" },
423
423
}
424
424
breakdownConceptId := hareConceptId // not normally the case...but we'll use the same here just for the test...
425
425
stats , _ := conceptModel .RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (testSourceId ,
@@ -439,13 +439,13 @@ func TestRetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndTwoCohortPai
439
439
// and because of an overlaping person found in the two cohorts of the new pair.
440
440
filterCohortPairs = []utils.CustomDichotomousVariableDef {
441
441
{
442
- CohortId1 : smallestCohort .Id ,
443
- CohortId2 : largestCohort .Id ,
444
- ProvidedName : "test" },
442
+ CohortDefinitionId1 : smallestCohort .Id ,
443
+ CohortDefinitionId2 : largestCohort .Id ,
444
+ ProvidedName : "test" },
445
445
{
446
- CohortId1 : secondLargestCohort .Id ,
447
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
448
- ProvidedName : "test2" },
446
+ CohortDefinitionId1 : secondLargestCohort .Id ,
447
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
448
+ ProvidedName : "test2" },
449
449
}
450
450
stats , _ = conceptModel .RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (testSourceId ,
451
451
populationCohort .Id , filterIds , filterCohortPairs , breakdownConceptId )
@@ -464,9 +464,9 @@ func TestRetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairsW
464
464
// setting the same cohort id here (artificial...but just to check if that returns the same value as when this filter is not there):
465
465
filterCohortPairs := []utils.CustomDichotomousVariableDef {
466
466
{
467
- CohortId1 : secondLargestCohort .Id ,
468
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
469
- ProvidedName : "test" },
467
+ CohortDefinitionId1 : secondLargestCohort .Id ,
468
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
469
+ ProvidedName : "test" },
470
470
}
471
471
breakdownConceptId := hareConceptId // not normally the case...but we'll use the same here just for the test...
472
472
stats , _ := conceptModel .RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (testSourceId ,
@@ -499,9 +499,9 @@ func TestRetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairsW
499
499
// setting the same cohort id here (artificial...normally it should be two different ids):
500
500
filterCohortPairs = []utils.CustomDichotomousVariableDef {
501
501
{
502
- CohortId1 : smallestCohort .Id ,
503
- CohortId2 : largestCohort .Id ,
504
- ProvidedName : "test" },
502
+ CohortDefinitionId1 : smallestCohort .Id ,
503
+ CohortDefinitionId2 : largestCohort .Id ,
504
+ ProvidedName : "test" },
505
505
}
506
506
stats3 , _ := conceptModel .RetrieveBreakdownStatsBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (testSourceId ,
507
507
secondLargestCohort .Id , filterIds , filterCohortPairs , breakdownConceptId )
@@ -569,9 +569,9 @@ func TestGetTeamProjectsThatMatchAllCohortDefinitionIdsOnlyDefaultMatch(t *testi
569
569
cohortDefinitionId := 2
570
570
filterCohortPairs := []utils.CustomDichotomousVariableDef {
571
571
{
572
- CohortId1 : smallestCohort .Id ,
573
- CohortId2 : largestCohort .Id ,
574
- ProvidedName : "test" },
572
+ CohortDefinitionId1 : smallestCohort .Id ,
573
+ CohortDefinitionId2 : largestCohort .Id ,
574
+ ProvidedName : "test" },
575
575
}
576
576
uniqueCohortDefinitionIdsList := utils .GetUniqueCohortDefinitionIdsListFromRequest (cohortDefinitionId , filterCohortPairs )
577
577
teamProjects , _ := cohortDefinitionModel .GetTeamProjectsThatMatchAllCohortDefinitionIds (uniqueCohortDefinitionIdsList )
@@ -585,9 +585,9 @@ func TestGetTeamProjectsThatMatchAllCohortDefinitionIds(t *testing.T) {
585
585
cohortDefinitionId := 2
586
586
filterCohortPairs := []utils.CustomDichotomousVariableDef {
587
587
{
588
- CohortId1 : 2 ,
589
- CohortId2 : 2 ,
590
- ProvidedName : "test" },
588
+ CohortDefinitionId1 : 2 ,
589
+ CohortDefinitionId2 : 2 ,
590
+ ProvidedName : "test" },
591
591
}
592
592
uniqueCohortDefinitionIdsList := utils .GetUniqueCohortDefinitionIdsListFromRequest (cohortDefinitionId , filterCohortPairs )
593
593
teamProjects , _ := cohortDefinitionModel .GetTeamProjectsThatMatchAllCohortDefinitionIds (uniqueCohortDefinitionIdsList )
@@ -710,9 +710,9 @@ func TestRetrieveHistogramDataBySourceIdAndCohortIdAndConceptIdsAndCohortPairs(t
710
710
// now filter on the extendedCopyOfSecondLargestCohort
711
711
filterCohortPairs = []utils.CustomDichotomousVariableDef {
712
712
{
713
- CohortId1 : smallestCohort .Id ,
714
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
715
- ProvidedName : "test" },
713
+ CohortDefinitionId1 : smallestCohort .Id ,
714
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
715
+ ProvidedName : "test" },
716
716
}
717
717
// then we expect histogram data for the overlapping population only (which is 5 for extendedCopyOfSecondLargestCohort and largestCohort):
718
718
data , _ = cohortDataModel .RetrieveHistogramDataBySourceIdAndCohortIdAndConceptIdsAndCohortPairs (testSourceId , largestCohort .Id , histogramConceptId , filterConceptIds , filterCohortPairs )
@@ -840,9 +840,9 @@ func TestRetrieveCohortOverlapStatsWithoutFilteringOnConceptValue(t *testing.T)
840
840
controlCohortId = largestCohort .Id // to ensure we get largestCohort as initial overlap, just repeat the same here...
841
841
filterCohortPairs = []utils.CustomDichotomousVariableDef {
842
842
{
843
- CohortId1 : smallestCohort .Id ,
844
- CohortId2 : extendedCopyOfSecondLargestCohort .Id ,
845
- ProvidedName : "test" },
843
+ CohortDefinitionId1 : smallestCohort .Id ,
844
+ CohortDefinitionId2 : extendedCopyOfSecondLargestCohort .Id ,
845
+ ProvidedName : "test" },
846
846
}
847
847
// then we expect overlap of 5 for extendedCopyOfSecondLargestCohort and largestCohort:
848
848
stats , _ = cohortDataModel .RetrieveCohortOverlapStatsWithoutFilteringOnConceptValue (testSourceId , caseCohortId , controlCohortId ,
0 commit comments