Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed May 17, 2024
1 parent 607386c commit deaaa16
Showing 1 changed file with 45 additions and 48 deletions.
93 changes: 45 additions & 48 deletions pypx/status.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Global modules
import subprocess
import pudb
import json
import pfmisc
from pfmisc._colors import Colors
from argparse import Namespace
import subprocess
import pudb
import json
import pfmisc
from pfmisc._colors import Colors
from argparse import Namespace

# PYPX modules
from .base import Base
from pypx import smdb
from .base import Base
from pypx import smdb


class Status(Base):
"""
Expand All @@ -32,56 +33,52 @@ def __init__(self, arg):
"""

super(Status, self).__init__(arg)
self.dp = pfmisc.debug(
verbosity = self.verbosity,
within = 'Find',
syslog = False
)
self.log = self.dp.qprint
self.db = smdb.SMDB(
Namespace(str_logDir = self.arg['dblogbasepath'])
)
self.dp = pfmisc.debug(verbosity=self.verbosity, within="Find", syslog=False)
self.log = self.dp.qprint
self.db = smdb.SMDB(Namespace(str_logDir=self.arg["dblogbasepath"]))

def status_init(self):
"""
Intialize the status model
"""
d_status = {
'state' : {
'study': "NoStudyFound",
'series': "NoSeriesFound",
'images': "NoImagesFound",
d_status = {
"state": {
"study": "NoStudyFound",
"series": "NoSeriesFound",
"images": "NoImagesFound",
},
"study": {},
"series": {},
"images": {
"received": {"count": -1},
"requested": {"count": -1},
"packed": {"count": -1},
"pushed": {"count": -1},
"registered": {"count": -1},
},
'study' : {},
'series' : {},
'images' : {
'received' : {'count' : -1},
'requested' : {'count' : -1},
'packed' : {'count' : -1},
'pushed' : {'count' : -1},
'registered' : {'count' : -1}
}
}
return d_status

def run(self, opt={}) -> dict:
# pudb.set_trace()
d_status : dict = self.status_init()
d_status.update(self.db.study_seriesContainsVerify(
opt['StudyInstanceUID'],
opt['SeriesInstanceUID'],
opt['verifySeriesInStudy']
))
d_status['state']['study'] = d_status['study']['state']
if opt['verifySeriesInStudy']:
if 'seriesListInStudy' in d_status['study'].keys():
if not d_status['study']['seriesListInStudy']['status']:
d_status['state']['series'] = 'SeriesNotInStudy'
d_status: dict = self.status_init()
d_status.update(
self.db.study_seriesContainsVerify(
opt["StudyInstanceUID"],
opt["SeriesInstanceUID"],
opt["verifySeriesInStudy"],
)
)
d_status["state"]["study"] = d_status["study"]["state"]
if opt["verifySeriesInStudy"]:
if "seriesListInStudy" in d_status["study"].keys():
if not d_status["study"]["seriesListInStudy"]["status"]:
d_status["state"]["series"] = "SeriesNotInStudy"
return d_status
if d_status['status']:
d_status['images'] = self.db.series_receivedAndRequested(
opt['SeriesInstanceUID']
)
d_status['state']['series'] = d_status['series']['state']
d_status['state']['images'] = d_status['images']['state']
if d_status["status"]:
d_status["images"] = self.db.series_receivedAndRequested(
opt["SeriesInstanceUID"]
)
d_status["state"]["series"] = d_status["series"]["state"]
d_status["state"]["images"] = d_status["images"]["state"]
return d_status

0 comments on commit deaaa16

Please sign in to comment.