Mercurial > hg > orthanc-tests
comparison PerfsDb/DbPopulator.py @ 158:df1f9946571c
perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
author | am@osimis.io |
---|---|
date | Fri, 17 Aug 2018 11:58:26 +0200 |
parents | f1a75985caa8 |
children | 27b3b0df5f90 |
comparison
equal
deleted
inserted
replaced
157:ac14100ffbd7 | 158:df1f9946571c |
---|---|
11 self._sourceInstanceId = None | 11 self._sourceInstanceId = None |
12 | 12 |
13 def populate(self): | 13 def populate(self): |
14 self._sourceInstanceId = self._orthanc.uploadDicomFile("../Database/DummyCT.dcm") | 14 self._sourceInstanceId = self._orthanc.uploadDicomFile("../Database/DummyCT.dcm") |
15 | 15 |
16 if self._dbSize == DbSize.Small: | 16 if self._dbSize == DbSize.Tiny: |
17 patientCount = 3 | 17 patientCount = 1 |
18 smallStudiesPerPatient = 2 | 18 smallStudiesPerPatient = 2 |
19 largeStudiesPerPatient = 1 | 19 largeStudiesPerPatient = 1 |
20 else: | 20 instancesPerLargeSeries = 5 |
21 patientCount = 100 | 21 elif self._dbSize == DbSize.Small: |
22 patientCount = 20 | |
23 smallStudiesPerPatient = 2 | |
24 largeStudiesPerPatient = 1 | |
25 instancesPerLargeSeries = 300 | |
26 elif self._dbSize == DbSize.Medium: | |
27 patientCount = 1000 | |
28 smallStudiesPerPatient = 2 | |
29 largeStudiesPerPatient = 1 | |
30 instancesPerLargeSeries = 500 | |
31 elif self._dbSize == DbSize.Large: | |
32 patientCount = 20000 | |
22 smallStudiesPerPatient = 4 | 33 smallStudiesPerPatient = 4 |
23 largeStudiesPerPatient = 8 | 34 largeStudiesPerPatient = 8 |
35 instancesPerLargeSeries = 500 | |
36 else: | |
37 raise NotImplementedError | |
24 | 38 |
25 # data that are the same in small and large DBs (and that can be used in tests for comparing the same things !!) | 39 # first add data that are the same in small and large DBs (and that can be used in tests for comparing the same things !!) |
26 | 40 |
27 # used in TestFindStudyByPatientId5Results | 41 # used in TestFindStudyByPatientId5Results |
28 self.createStudy(studyIndex=99994, patientIndex=99998, seriesCount=1, instancesPerSeries=1) | 42 self.createStudy(studyIndex=99994, patientIndex=99998, seriesCount=1, instancesPerSeries=1) |
29 self.createStudy(studyIndex=99995, patientIndex=99998, seriesCount=1, instancesPerSeries=1) | 43 self.createStudy(studyIndex=99995, patientIndex=99998, seriesCount=1, instancesPerSeries=1) |
30 self.createStudy(studyIndex=99996, patientIndex=99998, seriesCount=1, instancesPerSeries=1) | 44 self.createStudy(studyIndex=99996, patientIndex=99998, seriesCount=1, instancesPerSeries=1) |
33 | 47 |
34 # used in TestFindStudyByStudyDescription1Result | 48 # used in TestFindStudyByStudyDescription1Result |
35 # used in TestFindStudyByPatientId1Result | 49 # used in TestFindStudyByPatientId1Result |
36 self.createStudy(studyIndex=99999, patientIndex=99999, seriesCount=1, instancesPerSeries=1) | 50 self.createStudy(studyIndex=99999, patientIndex=99999, seriesCount=1, instancesPerSeries=1) |
37 | 51 |
38 # data to make the DB "large" or "small" | 52 # then, add data to make the DB "large" or "small" |
39 for patientIndex in range(0, patientCount): | 53 for patientIndex in range(0, patientCount): |
40 studyIndex=0 | 54 studyIndex=0 |
41 print("Generating data for patient " + str(patientIndex)) | 55 print("Generating data for patient " + str(patientIndex)) |
42 for i in range(0, smallStudiesPerPatient): | 56 for i in range(0, smallStudiesPerPatient): |
43 print("Generating small study " + str(i)) | 57 print("Generating small study " + str(i)) |
44 self.createStudy(studyIndex=studyIndex, patientIndex=patientIndex, seriesCount=2, instancesPerSeries=2) | 58 self.createStudy(studyIndex=studyIndex, patientIndex=patientIndex, seriesCount=2, instancesPerSeries=instancesPerLargeSeries) |
45 studyIndex+=1 | 59 studyIndex+=1 |
46 for i in range(0, largeStudiesPerPatient): | 60 for i in range(0, largeStudiesPerPatient): |
47 print("Generating large study " + str(i)) | 61 print("Generating large study " + str(i)) |
48 self.createStudy(studyIndex=studyIndex, patientIndex=patientIndex, seriesCount=4, instancesPerSeries=500) | 62 self.createStudy(studyIndex=studyIndex, patientIndex=patientIndex, seriesCount=4, instancesPerSeries=instancesPerLargeSeries) |
49 studyIndex+=1 | 63 studyIndex+=1 |
50 | |
51 | |
52 | 64 |
53 print("Generation completed") | 65 print("Generation completed") |
54 | 66 |
55 def createStudy(self, studyIndex: int, patientIndex: int, seriesCount: int, instancesPerSeries: int): | 67 def createStudy(self, studyIndex: int, patientIndex: int, seriesCount: int, instancesPerSeries: int): |
56 for seriesIndex in range(0, seriesCount): | 68 for seriesIndex in range(0, seriesCount): |