Skip to content

Commit

Permalink
Merge pull request #126 from DigitalSlideArchive/export-details
Browse files Browse the repository at this point in the history
Updates to the export report.
  • Loading branch information
manthey authored Sep 25, 2020
2 parents 25af4f1 + bb509a3 commit 6d73d7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## Version 1.2.2

### Changes
- Modify the export report format (#126)

## Version 1.2.1

### Improvements
- Start with Girder meta section collapsed (#125)

Expand Down
13 changes: 8 additions & 5 deletions wsi_deid/import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import shutil
import tempfile

import dateutil.parser

from girder import logger
from girder.models.assetstore import Assetstore
from girder.models.file import File
Expand Down Expand Up @@ -415,13 +413,18 @@ def exportReport(ctx, exportPath, report, user):
timeformat = '%m%d%Y: %H%M%S'
for row in report:
row['item']['meta'].setdefault('deidUpload', {})
data = {'Date_DEID_Export': curtime.strftime(timeformat)}
data = {}
data.update(row['item']['meta']['deidUpload'])
data['DSAImageStatus'] = statusDict.get(row['status'], row['status'])
if data['DSAImageStatus'] == 'Approved':
data['Date_DEID_Export'] = curtime.strftime(timeformat)
print(row['item'])
if data['DSAImageStatus'] != 'AvailableToProcess':
data['Last_DEID_RunDate'] = row['item'].get(
'modified', row['item']['created']).strftime(timeformat)
if 'redacted' in row['item']['meta']:
try:
info = row['item']['meta']['redacted'][-1]
data['Last_DEID_RunDate'] = dateutil.parser.parse(info['time']).strftime(timeformat)
data['ScannerMake'] = info['details']['format'].capitalize()
data['ScannerModel'] = info['details']['model']
data['ByteSize_InboundWSI'] = row['item']['meta']['redacted'][0]['originalSize']
Expand Down Expand Up @@ -453,7 +456,7 @@ def exportReport(ctx, exportPath, report, user):
'details']['fieldCount']['images']
data['Total_UserIdentifiedPHIPII_ImageComponents'] = info[
'details']['redactionCount']['images']
data['UserIdentifiedPHIPII_ImageComponents'] = ' '.join(sorted(
data['UserIdentifiedPHIPII_ImageComponents'] = ', '.join(sorted(
k for k, v in info['redactList']['images'].items()
if v.get('reason'))) or 'N/A'
data['UserIdentifiedPHIPII_Category_ImageComponents'] = ', '.join(sorted(set(
Expand Down

0 comments on commit 6d73d7c

Please sign in to comment.