From 3aae8199fb7cfa006529fcfceff0533c2b8b88de Mon Sep 17 00:00:00 2001 From: Sandip Samal Date: Tue, 17 Dec 2024 15:55:37 -0500 Subject: [PATCH] code cleanup --- chrisClient.py | 67 +------------------------------------------------- 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/chrisClient.py b/chrisClient.py index 70f1fcf..d071e1f 100644 --- a/chrisClient.py +++ b/chrisClient.py @@ -63,69 +63,4 @@ def anonymize(self, params: dict, pv_id: int): "pushToRemote": params["push"]["aec"] } } - pipe.workflow_schedule(pv_id,"PACS query, retrieve, and registration verification in CUBE 20241217",plugin_params) - # workflow = pipe.pipelineWithName_getNodes("PACS query, retrieve, and registration verification in CUBE 20241217",{}) - def anonymize_(self, params: dict, pv_id: int): - prefix = "dynanon" - pl_px_qy_id = self.__get_plugin_id({"name": "pl-pacs_query", "version": "1.0.3"}) - pl_px_rt_id = self.__get_plugin_id({"name": "pl-pacs_retrieve", "version": "1.0.2"}) - pl_rg_ch_id = self.__get_plugin_id({"name": "pl-reg_chxr", "version": "1.0.7"}) - - # 1) Run PACS query - px_qy_params = {"PACSurl": params["pull"]["url"], - "PACSname": params["pull"]["pacs"], - "PACSdirective": json.dumps(params["search"]), - "previous_id" : pv_id - } - px_qy_inst_id = self.__create_feed(pl_px_qy_id, px_qy_params) - - # 2) Run PACS retrieve - px_rt_params = {"PACSurl": params["pull"]["url"], - "PACSname": params["pull"]["pacs"], - "inputJSONfile": "search_results.json", - "copyInputFile": True, - "previous_id": px_qy_inst_id - } - px_rt_inst_id = self.__create_feed(pl_px_rt_id, px_rt_params) - - # 3) Verify registration and run anonymize and push - anon_params = json.dumps(params["anon"]) - rg_ch_params = {"CUBEurl": self.cl.url, - "CUBEuser": self.cl.username, - "CUBEpassword": self.cl.password, - "inputJSONfile": "search_results.json", - "tagStruct": anon_params, - "orthancUrl": params["push"]["url"], - "username": params["push"]["username"], - "password": params["push"]["password"], - "pushToRemote": params["push"]["aec"], - "previous_id": px_rt_inst_id} - rg_ch_inst_id = self.__create_feed(pl_rg_ch_id, rg_ch_params) - - def __wait_for_node(self,pl_inst_id): - """ - Wait for a node to transition to a finishedState - """ - response = self.cl.get_plugin_instance_by_id(pl_inst_id) - poll_count = 0 - total_polls = 50 - wait_poll = 5 - while 'finished' not in response['status'] and poll_count <= total_polls: - response = self.cl.get_plugin_instance_by_id(pl_inst_id) - time.sleep(wait_poll) - poll_count += 1 - - def __create_feed(self, plugin_id: str,params: dict): - response = self.cl.create_plugin_instance(plugin_id, params) - return response['id'] - - def __get_plugin_id(self, params: dict): - response = self.cl.get_plugins(params) - if response['total'] > 0: - return response['data'][0]['id'] - raise Exception(f"No plugin found with matching search criteria {params}") - - - - - + pipe.workflow_schedule(pv_id,"PACS query, retrieve, and registration verification in CUBE 20241217",plugin_params) \ No newline at end of file