Skip to content
Snippets Groups Projects
Commit 8a2c12f6 authored by EC2 Default User's avatar EC2 Default User
Browse files
parents fc759eb7 f273aea9
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,4 @@ __pycache__
models/
digpath.db
digpath.egg-info/
digpath/services/dpath/
......@@ -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
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment