Bug fixes

This commit is contained in:
lwark
2025-04-02 13:08:32 -05:00
parent d3807dac57
commit 3a318fff38
4 changed files with 82 additions and 76 deletions

View File

@@ -34,7 +34,7 @@ class ConcentrationsChart(CustomFigure):
# logger.debug(f"DF after changes:\n{self.df}")
scatter = px.scatter(data_frame=self.df, x='submission', y="concentration",
hover_data=["name", "submission", "submitted_date", "concentration"],
color="positive", color_discrete_map={True: "red", False: "green"}
color="positive", color_discrete_map={"positive": "red", "negative": "green", "sample":"orange"}
)
except (ValueError, AttributeError) as e:
logger.error(f"Error constructing chart: {e}")

View File

@@ -80,8 +80,8 @@ class App(QMainWindow):
helpMenu.addAction(self.docsAction)
helpMenu.addAction(self.githubAction)
fileMenu.addAction(self.importAction)
fileMenu.addAction(self.yamlExportAction)
fileMenu.addAction(self.yamlImportAction)
# fileMenu.addAction(self.yamlExportAction)
# fileMenu.addAction(self.yamlImportAction)
methodsMenu.addAction(self.searchSample)
maintenanceMenu.addAction(self.joinExtractionAction)
maintenanceMenu.addAction(self.joinPCRAction)
@@ -112,8 +112,8 @@ class App(QMainWindow):
self.docsAction = QAction("&Docs", self)
self.searchSample = QAction("Search Sample", self)
self.githubAction = QAction("Github", self)
self.yamlExportAction = QAction("Export Type Example", self)
self.yamlImportAction = QAction("Import Type Template", self)
# self.yamlExportAction = QAction("Export Type Example", self)
# self.yamlImportAction = QAction("Import Type Template", self)
self.editReagentAction = QAction("Edit Reagent", self)
self.manageOrgsAction = QAction("Manage Clients", self)
self.manageKitsAction = QAction("Manage Kits", self)
@@ -130,8 +130,8 @@ class App(QMainWindow):
self.docsAction.triggered.connect(self.openDocs)
self.searchSample.triggered.connect(self.runSampleSearch)
self.githubAction.triggered.connect(self.openGithub)
self.yamlExportAction.triggered.connect(self.export_ST_yaml)
self.yamlImportAction.triggered.connect(self.import_ST_yaml)
# self.yamlExportAction.triggered.connect(self.export_ST_yaml)
# self.yamlImportAction.triggered.connect(self.import_ST_yaml)
self.table_widget.pager.current_page.textChanged.connect(self.update_data)
self.editReagentAction.triggered.connect(self.edit_reagent)
self.manageOrgsAction.triggered.connect(self.manage_orgs)
@@ -186,46 +186,46 @@ class App(QMainWindow):
dlg = SearchBox(parent=self, object_type=Reagent, extras=[dict(name='Role', field="role")])
dlg.exec()
def export_ST_yaml(self):
"""
Copies submission type yaml to file system for editing and remport
# def export_ST_yaml(self):
# """
# Copies submission type yaml to file system for editing and remport
#
# Returns:
# None
# """
# if check_if_app():
# yaml_path = Path(sys._MEIPASS).joinpath("files", "resources", "viral_culture.yml")
# else:
# yaml_path = project_path.joinpath("src", "submissions", "resources", "viral_culture.yml")
# fname = select_save_file(obj=self, default_name="Submission Type Template.yml", extension="yml")
# shutil.copyfile(yaml_path, fname)
Returns:
None
"""
if check_if_app():
yaml_path = Path(sys._MEIPASS).joinpath("files", "resources", "viral_culture.yml")
else:
yaml_path = project_path.joinpath("src", "submissions", "resources", "viral_culture.yml")
fname = select_save_file(obj=self, default_name="Submission Type Template.yml", extension="yml")
shutil.copyfile(yaml_path, fname)
@check_authorization
def import_ST_yaml(self, *args, **kwargs):
"""
Imports a yml form into a submission type.
Args:
*args ():
**kwargs ():
Returns:
"""
fname = select_open_file(obj=self, file_extension="yml")
if not fname:
logger.info(f"Import cancelled.")
return
ap = AlertPop(message="This function will proceed in the debug window.", status="Warning", owner=self)
ap.exec()
st = SubmissionType.import_from_json(filepath=fname)
if st:
# NOTE: Do not delete the print statement below.
choice = input("Save the above submission type? [y/N]: ")
if choice.lower() == "y":
pass
else:
logger.warning("Save of submission type cancelled.")
# @check_authorization
# def import_ST_yaml(self, *args, **kwargs):
# """
# Imports a yml form into a submission type.
#
# Args:
# *args ():
# **kwargs ():
#
# Returns:
#
# """
# fname = select_open_file(obj=self, file_extension="yml")
# if not fname:
# logger.info(f"Import cancelled.")
# return
# ap = AlertPop(message="This function will proceed in the debug window.", status="Warning", owner=self)
# ap.exec()
# st = SubmissionType.import_from_json(filepath=fname)
# if st:
# # NOTE: Do not delete the print statement below.
# choice = input("Save the above submission type? [y/N]: ")
# if choice.lower() == "y":
# pass
# else:
# logger.warning("Save of submission type cancelled.")
def update_data(self):
self.table_widget.sub_wid.setData(page=self.table_widget.pager.page_anchor, page_size=page_size)