changeset 165:1ff0d830bb87

find 100 results
author am@osimis.io
date Tue, 21 Aug 2018 15:20:45 +0200
parents ff939d07989f
children 7d39adee9f88
files PerfsDb/DbPopulator.py PerfsDb/Run.py PerfsDb/Tests/FindStudy.py
diffstat 3 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/PerfsDb/DbPopulator.py	Mon Aug 20 15:50:47 2018 +0200
+++ b/PerfsDb/DbPopulator.py	Tue Aug 21 15:20:45 2018 +0200
@@ -60,6 +60,10 @@
         startTime = time.time()
         # first add data that are the same in small and large DBs (and that can be used in tests for comparing the same things !!)
 
+        # used in TestFindStudyByPatientId100Results
+        for i in range(100):
+            self.createStudy(studyIndex=199000+i, patientIndex=99997, seriesCount=1, instancesPerSeries=1)
+
         # used in TestFindStudyByPatientId5Results
         self.createStudy(studyIndex=99994, patientIndex=99998, seriesCount=1, instancesPerSeries=1)
         self.createStudy(studyIndex=99995, patientIndex=99998, seriesCount=1, instancesPerSeries=1)
@@ -72,9 +76,9 @@
         # used in TestToolsFindStudyByStudyInstanceUID
         self.createStudy(studyIndex=99999, patientIndex=99999, seriesCount=1, instancesPerSeries=1)
 
-        with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Results/db-init-" + label), 'w', newline='') as resultFile:
+        with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Results/db-init-" + label + ".csv"), 'w', newline='') as resultFile:
             resultWriter = csv.writer(resultFile)
-            resultWriter.writerow(["patientCount", "filesCount", "duration", "files/sec"])
+            resultWriter.writerow(["#patientCount", "filesCount", "files/sec"])
             # then, add data to make the DB "large" or "small"
             for patientIndex in range(0, patientCount):
                 studyIndex=0
@@ -99,8 +103,7 @@
                 ))
                 resultWriter.writerow([
                     patientIndex, 
-                    self._fileCounter - fileCounterAtPatientStart, 
-                    endTimePatient - startTimePatient, 
+                    self._fileCounter, 
                     (self._fileCounter - fileCounterAtPatientStart)/(endTimePatient - startTimePatient)
                     ])
                 resultFile.flush()
--- a/PerfsDb/Run.py	Mon Aug 20 15:50:47 2018 +0200
+++ b/PerfsDb/Run.py	Tue Aug 21 15:20:45 2018 +0200
@@ -53,6 +53,7 @@
     TestFindStudyByStudyDescription0Results(),
     TestFindStudyByPatientId0Results(),
     TestFindStudyByPatientId5Results(),
+    TestFindStudyByPatientId100Results(),
     TestUploadNextPatientFile(),
     TestUploadFirstPatientFile(),
     TestUploadLargeFile10MB(),
--- a/PerfsDb/Tests/FindStudy.py	Mon Aug 20 15:50:47 2018 +0200
+++ b/PerfsDb/Tests/FindStudy.py	Tue Aug 21 15:20:45 2018 +0200
@@ -48,4 +48,14 @@
     def test(self):
         self._orthanc.studies.query(
             query = {"PatientID": "99998"}
+        )        
+
+class TestFindStudyByPatientId100Results(Test):
+
+    def __init__(self, name:str = "FindStudyByPatientId100Results"):
+        super().__init__(name)
+
+    def test(self):
+        self._orthanc.studies.query(
+            query = {"PatientID": "99997"}
         )        
\ No newline at end of file