Skip to content

Commit

Permalink
🐛 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiprima committed Apr 17, 2020
1 parent 8a0fa00 commit cf636f6
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions images.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def usage():
api = MyApi(host, username, password)

hasNext = True
count = 0

collection_id = 0
collection_name = ''
out_dir = '/data/reports/'
Expand All @@ -47,22 +47,12 @@ def usage():
with open(out_dir + 'images_' + name + '_' + stamp + '.csv', mode='w') as csv_file:
csv_writer = csv.writer(csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow(['Collection', 'Study ID', 'Subject ID', 'Image ID', 'Date'])
first_nid = 0
count = 0
while hasNext:
url = images_url + '&page=' + str(count)
count += 1

url = images_url
if count > 1:
url += '&page=' + str(count)

response = api.get_data(url)
if len(response) > 0:
if count == 1:
first_nid = response[0]['nid'][0]['value']
if count > 1:
nid = response[0]['nid'][0]['value']
if nid == first_nid:
break
for r in response:
datetime_str = r['created'][0]['value'].replace("T", " ")
datetime_str = datetime_str.replace("+00:00", "")
Expand Down

0 comments on commit cf636f6

Please sign in to comment.