Skip to content

Commit

Permalink
save retrieve response in op json file
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Dec 4, 2024
1 parent 42ec8f6 commit 68cac3b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pacs_retrieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import json
import sys
import pprint
import os

LOG = logger.debug

Expand All @@ -22,7 +23,7 @@
)
logger.remove()
logger.add(sys.stderr, format=logger_format)
__version__ = '1.0.0'
__version__ = '1.0.1'

DISPLAY_TITLE = r"""
_ _ _
Expand Down Expand Up @@ -90,9 +91,14 @@ def main(options: Namespace, inputdir: Path, outputdir: Path):

directive = json.loads(options.PACSdirective)

search_response = pfdcm.retrieve_pacsfiles(directive, options.PACSurl, options.PACSname)
retrieve_response = pfdcm.retrieve_pacsfiles(directive, options.PACSurl, options.PACSname)

LOG(f"response: {pprint.pformat(search_response)}")
LOG(f"response: {pprint.pformat(retrieve_response)}")
op_json_file_path = os.path.join(options.outputdir, "retrieve_response.json")
# Open a json writer, and use the json.dumps()
# function to dump data
with open(op_json_file_path, 'w', encoding='utf-8') as jsonf:
jsonf.write(json.dumps(retrieve_response, indent=4))


if __name__ == '__main__':
Expand Down

0 comments on commit 68cac3b

Please sign in to comment.