Skip to content

Commit

Permalink
fix: improve test cases, fix concept_id
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlukasse committed Oct 4, 2024
1 parent 56fd9ac commit a65b5ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/data_generator/datagenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ func AddPerson(personId int64) {

func AddConcepts(concepts []Concept) {
log.Printf("Processing %d concepts...", len(concepts))
nextConceptId := tests.GetLastConceptId(sourceId) + 1
for _, concept := range concepts {
nextConceptId := tests.GetLastConceptId(sourceId) + 1
var nrClones = 1
if concept.CloneCount > 0 {
nrClones = concept.CloneCount
Expand Down
8 changes: 4 additions & 4 deletions tests/data_generator/datagenerator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ func TestRunDataGeneration(t *testing.T) {
RunDataGeneration("models_tests_data_config")
// assert on number of records per table:
countObservations := tests.GetCount(tests.GetOmopDataSourceForSourceId(tests.GetTestSourceId()), "observation")
if countObservations != 35 {
t.Errorf("Expected 35 observations, found %d", countObservations)
if countObservations != 43 {
t.Errorf("Expected 43 observations, found %d", countObservations)
}
countConcepts := tests.GetCount(tests.GetOmopDataSourceForSourceId(tests.GetTestSourceId()), "concept")
if countConcepts != 7 {
t.Errorf("Expected 7 concepts, found %d", countConcepts)
if countConcepts != 9 {
t.Errorf("Expected 9 concepts, found %d", countConcepts)
}
countPersons := tests.GetCount(tests.GetOmopDataSourceForSourceId(tests.GetTestSourceId()), "person")
if countPersons != 18 {
Expand Down
9 changes: 9 additions & 0 deletions tests/data_generator/models_tests_data_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,12 @@ cohorts:
person_ids: [1,2,3,4,5,6,7,8,9,10]
- cohort: largest-cohort
person_ids: [6,7,8,9,10,11,12,13,14,15,16,17,18]
concepts:
- concept: new-continuous-value-a
value_type: number
# this means ~1/3 of the persons in the cohort will have this concept associated to them in the observation table:
ratio_of_persons: 0.34
- concept: new-continuous-value-b
value_type: number
# this means ~1/3 of the persons in the cohort will have this concept associated to them in the observation table:
ratio_of_persons: 0.34

0 comments on commit a65b5ea

Please sign in to comment.