diff --git a/.gitignore b/.gitignore
index 88fcac5f8b3bd7afb6c34c9873b2aaf429e464bf..83c37f9aa0bd4bdf681c1089034474197031d2aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ __pycache__
models/
digpath.db
digpath.egg-info/
+digpath/services/dpath/
diff --git a/digpath/db/database_connection.py b/digpath/db/database_connection.py
index d35f338e806e419c36dc4d61c33bb918b0db3d21..38fedb5546513f448e7e88f34de32b109ded67c4 100644
--- a/digpath/db/database_connection.py
+++ b/digpath/db/database_connection.py
@@ -145,19 +145,22 @@ class DigpathDatabase:
return results
def get_requests(self):
- cursor = self._db.cursor().execute('SELECT * FROM requests')
+ cursor = self._db.cursor().execute('SELECT request_id FROM requests')
results = []
- for i in cursor.fetchall():
+ for request in cursor.fetchall():
+ request_id = request[0]
+ data = self.get_request_info(request_id)
+
item = {
- 'request_id': i[0],
- 'file': i[1],
- 'diagnosis': i[2],
- 'total_chips': i[3],
- 'mild': i[4],
- 'moderate': i[5],
- 'severe': i[6],
- 'status': i[7],
- 'timestamp': i[8]
+ 'request_id': request_id,
+ 'file': data['file'],
+ 'diagnosis': data['diagnosis'],
+ 'total_chips': data['total_chips'],
+ 'mild': data['mild'],
+ 'moderate': data['moderate'],
+ 'severe': data['severe'],
+ 'status': data['status'],
+ 'timestamp': data['timestamp']
}
results.append(item)
return results
diff --git a/digpath/services/upload_service/diagnosis_provider.py b/digpath/services/upload_service/diagnosis_provider.py
index b7b4907ba7212f6ed0e450c38a203569b8bcf688..1fb89b6582f4e9690fada62b53d32234b765ed73 100644
--- a/digpath/services/upload_service/diagnosis_provider.py
+++ b/digpath/services/upload_service/diagnosis_provider.py
@@ -27,7 +27,7 @@ class Provider:
return response.json()
def get_images(self, report_id):
- report_id = 'fake_request_id'
+ #report_id = 'fake_request_id'
save_chip_path = f'../dpath/report/{report_id}/image'
result = glob.glob(f'{save_chip_path}/*.png')[:50]
response = []
@@ -39,7 +39,7 @@ class Provider:
s3_client = boto3.client('s3')
s3_resource = boto3.resource('s3')
image_bucket = s3_resource.Bucket('digpath-predictions')
- report_id = 'fake_request_id'
+ #report_id = 'fake_request_id'
save_chip_path = f'../dpath/report/{report_id}/image'
dowloaded_files = glob.glob(f'{save_chip_path}/*.png')
prefix = f'{report_id}/severe_predictions/'
@@ -47,7 +47,7 @@ class Provider:
if not os.path.exists(save_chip_path):
os.makedirs(save_chip_path)
- for s3_obj in image_bucket.objects.filter(Prefix=prefix):
+ for s3_obj in list(image_bucket.objects.filter(Prefix=prefix))[:50]:
if s3_obj.key == prefix:
continue
@@ -60,7 +60,7 @@ class Provider:
return SAVE_DIRECTORY + image_name
def get_image_path(self, report_id, image_name) :
- report_id = 'fake_request_id'
+ #report_id = 'fake_request_id'
return f'{os.getcwd()}/../dpath/report/{report_id}/image/{image_name}'.replace('\\', '/')
def __save_local_file(self, file):