Skip to content

Commit

Permalink
create a whitelist of allowed dicom tags for searching
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Dec 17, 2024
1 parent ddf89ef commit 7215601
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pfdcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@
logger.remove()
logger.add(sys.stderr, format=logger_format)

allowed_tags = [
"AccessionNumber",
"PatientID",
"PatientName",
"PatientBirthDate",
"PatientAge",
"PatientSex",
"StudyDate",
"StudyInstanceUID",
"Modality",
"ModalitiesInStudy",
"PerformedStationAETitle",
"NumberOfSeriesRelatedInstances",
"InstanceNumber",
"SeriesDate",
"SeriesInstanceUID",
]

def health_check(url: str):
pfdcm_about_api = f'{url}about/'
headers = {'Content-Type': 'application/json', 'accept': 'application/json'}
Expand All @@ -36,7 +54,7 @@ def sanitize(directive: dict) -> (dict, dict):
partial_directive = []
clone_directive = copy.deepcopy(directive)
for key in directive.keys():
if "Name" in key or "Description" in key:
if not key in allowed_tags:
partial_directive.append({key:clone_directive.pop(key)})
return clone_directive, dict(ChainMap(*partial_directive))

Expand Down

0 comments on commit 7215601

Please sign in to comment.