Skip to content

Commit 3aae819

Browse files
committed
code cleanup
1 parent 7d85a5b commit 3aae819

File tree

1 file changed

+1
-66
lines changed

1 file changed

+1
-66
lines changed

chrisClient.py

+1-66
Original file line numberDiff line numberDiff line change
@@ -63,69 +63,4 @@ def anonymize(self, params: dict, pv_id: int):
6363
"pushToRemote": params["push"]["aec"]
6464
}
6565
}
66-
pipe.workflow_schedule(pv_id,"PACS query, retrieve, and registration verification in CUBE 20241217",plugin_params)
67-
# workflow = pipe.pipelineWithName_getNodes("PACS query, retrieve, and registration verification in CUBE 20241217",{})
68-
def anonymize_(self, params: dict, pv_id: int):
69-
prefix = "dynanon"
70-
pl_px_qy_id = self.__get_plugin_id({"name": "pl-pacs_query", "version": "1.0.3"})
71-
pl_px_rt_id = self.__get_plugin_id({"name": "pl-pacs_retrieve", "version": "1.0.2"})
72-
pl_rg_ch_id = self.__get_plugin_id({"name": "pl-reg_chxr", "version": "1.0.7"})
73-
74-
# 1) Run PACS query
75-
px_qy_params = {"PACSurl": params["pull"]["url"],
76-
"PACSname": params["pull"]["pacs"],
77-
"PACSdirective": json.dumps(params["search"]),
78-
"previous_id" : pv_id
79-
}
80-
px_qy_inst_id = self.__create_feed(pl_px_qy_id, px_qy_params)
81-
82-
# 2) Run PACS retrieve
83-
px_rt_params = {"PACSurl": params["pull"]["url"],
84-
"PACSname": params["pull"]["pacs"],
85-
"inputJSONfile": "search_results.json",
86-
"copyInputFile": True,
87-
"previous_id": px_qy_inst_id
88-
}
89-
px_rt_inst_id = self.__create_feed(pl_px_rt_id, px_rt_params)
90-
91-
# 3) Verify registration and run anonymize and push
92-
anon_params = json.dumps(params["anon"])
93-
rg_ch_params = {"CUBEurl": self.cl.url,
94-
"CUBEuser": self.cl.username,
95-
"CUBEpassword": self.cl.password,
96-
"inputJSONfile": "search_results.json",
97-
"tagStruct": anon_params,
98-
"orthancUrl": params["push"]["url"],
99-
"username": params["push"]["username"],
100-
"password": params["push"]["password"],
101-
"pushToRemote": params["push"]["aec"],
102-
"previous_id": px_rt_inst_id}
103-
rg_ch_inst_id = self.__create_feed(pl_rg_ch_id, rg_ch_params)
104-
105-
def __wait_for_node(self,pl_inst_id):
106-
"""
107-
Wait for a node to transition to a finishedState
108-
"""
109-
response = self.cl.get_plugin_instance_by_id(pl_inst_id)
110-
poll_count = 0
111-
total_polls = 50
112-
wait_poll = 5
113-
while 'finished' not in response['status'] and poll_count <= total_polls:
114-
response = self.cl.get_plugin_instance_by_id(pl_inst_id)
115-
time.sleep(wait_poll)
116-
poll_count += 1
117-
118-
def __create_feed(self, plugin_id: str,params: dict):
119-
response = self.cl.create_plugin_instance(plugin_id, params)
120-
return response['id']
121-
122-
def __get_plugin_id(self, params: dict):
123-
response = self.cl.get_plugins(params)
124-
if response['total'] > 0:
125-
return response['data'][0]['id']
126-
raise Exception(f"No plugin found with matching search criteria {params}")
127-
128-
129-
130-
131-
66+
pipe.workflow_schedule(pv_id,"PACS query, retrieve, and registration verification in CUBE 20241217",plugin_params)

0 commit comments

Comments
 (0)