Skip to content

Commit

Permalink
updating api to use deid
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoch committed Jun 16, 2017
1 parent c1e5a8e commit ea0c7b2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ DEIDENTIFY_RESTFUL=True
# The default study to use
SOM_STUDY="test"
# PatientID and SOPInstanceUID:
# These are default for deid, but we can change that here
ENTITY_ID="PatientID"
ITEM_ID="SOPInstanceUID"
```

If `DEIDENTIFY_RESTFUL` is False, we skip this task, and the batch is sent to the next task (or tasks) to send to different storage. If True, the batch is first put in the queue to be de-identified, and then upon receival of the identifiers, the batch is put into the same queues to be sent to storage. The `SOM_STUDY` is part of the Stanford DASHER API to specify a study, and the default should be set before you start the application. If the study needs to vary between calls, please [post an issue](https://www.github.com/pydicom/sendit) and it can be added to be done at runtime. These functions can be modified to use different endpoints, or do different replacements in the data. For more details about the deidentify functions, see [docs/deidentify.md](docs/deidentify.md)
Note that the fields for `ENTITY_ID` and `ITEM_ID` are set to the default of [deid](https://pydicom.github.io/deid), but I've added them here in case it ever needs to be changed. If `DEIDENTIFY_RESTFUL` is False, we skip this task, and the batch is sent to the next task (or tasks) to send to different storage. If True, the batch is first put in the queue to be de-identified, and then upon receival of the identifiers, the batch is put into the same queues to be sent to storage. The `SOM_STUDY` is part of the Stanford DASHER API to specify a study, and the default should be set before you start the application. If the study needs to vary between calls, please [post an issue](https://www.github.com/pydicom/sendit) and it can be added to be done at runtime. These functions can be modified to use different endpoints, or do different replacements in the data. For more details about the deidentify functions, see [docs/deidentify.md](docs/deidentify.md)

The next set of variables are specific to [storage](docs/storage.md), which is the final step in the pipeline.

Expand Down
15 changes: 13 additions & 2 deletions sendit/apps/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ def get_identifiers(bid,study=None):

# Returns dictionary with {"identifiers": [ E1,E2 ]}
ids = get_ids(dicom_files=dicom_files)

bot.debug("som.client making request to deidentify batch %s" %(bid))
#:param save_records: if True, will use mrn endpoint and and save data.
# if False, will use uid endpoint and not save data.
# Right now save_records is set to False, not sure if it should be
result = cli.deidentify(ids=ids,study=study) # should return a list

batch_ids = BatchIdentifiers.objects.create(batch=batch,
Expand Down Expand Up @@ -199,11 +202,19 @@ def replace_identifiers(bid):

# replace ids to update the dicom_files (same paths)
dicom_files = batch.get_image_paths()

# We are going to overwrite, they have same base
output_folder = os.path.dirname(dicom_files[0])

updated_files = replace_ids(dicom_files=dicom_files,
response=batch_ids.response)
response=batch_ids.response,
overwrite=True,
output_folder=output_folder)

change_status(batch,"DONEPROCESSING")
batch.change_images_status('DONEPROCESSING')


except:
bot.error("In replace_identifiers: Batch %s or identifiers does not exist." %(bid))
return None
Expand Down
5 changes: 5 additions & 0 deletions sendit/settings/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
# The default study to use
SOM_STUDY="test"

# PatientID and SOPInstanceUID:
# These are default for deid, but we can change that here
ENTITY_ID="PatientID"
ITEM_ID="SOPInstanceUID"

#####################################################
# STORAGE
#####################################################
Expand Down

0 comments on commit ea0c7b2

Please sign in to comment.