Bugfix for commenting submissions.
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
submissions.frontend.custom\_widgets package
|
|
||||||
============================================
|
|
||||||
|
|
||||||
Submodules
|
|
||||||
----------
|
|
||||||
|
|
||||||
submissions.frontend.custom\_widgets.misc module
|
|
||||||
------------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.custom_widgets.misc
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
submissions.frontend.custom\_widgets.pop\_ups module
|
|
||||||
----------------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.custom_widgets.pop_ups
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
submissions.frontend.custom\_widgets.sub\_details module
|
|
||||||
--------------------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.custom_widgets.sub_details
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
Module contents
|
|
||||||
---------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.custom_widgets
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
@@ -7,27 +7,8 @@ Subpackages
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 4
|
:maxdepth: 4
|
||||||
|
|
||||||
submissions.frontend.custom_widgets
|
|
||||||
submissions.frontend.visualizations
|
submissions.frontend.visualizations
|
||||||
|
submissions.frontend.widgets
|
||||||
Submodules
|
|
||||||
----------
|
|
||||||
|
|
||||||
submissions.frontend.all\_window\_functions module
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.all_window_functions
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
submissions.frontend.main\_window\_functions module
|
|
||||||
---------------------------------------------------
|
|
||||||
|
|
||||||
.. automodule:: submissions.frontend.main_window_functions
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
Module contents
|
Module contents
|
||||||
---------------
|
---------------
|
||||||
|
|||||||
77
source/submissions.frontend.widgets.rst
Normal file
77
source/submissions.frontend.widgets.rst
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
submissions.frontend.widgets package
|
||||||
|
====================================
|
||||||
|
|
||||||
|
Submodules
|
||||||
|
----------
|
||||||
|
|
||||||
|
submissions.frontend.widgets.app module
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.app
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.controls\_chart module
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.controls_chart
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.functions module
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.functions
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.kit\_creator module
|
||||||
|
------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.kit_creator
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.misc module
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.misc
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.pop\_ups module
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.pop_ups
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.submission\_table module
|
||||||
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.submission_table
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
submissions.frontend.widgets.submission\_widget module
|
||||||
|
------------------------------------------------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets.submission_widget
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
Module contents
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. automodule:: submissions.frontend.widgets
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
@@ -20,6 +20,7 @@ class ControlType(Base):
|
|||||||
"""
|
"""
|
||||||
__tablename__ = '_control_types'
|
__tablename__ = '_control_types'
|
||||||
|
|
||||||
|
|
||||||
id = Column(INTEGER, primary_key=True) #: primary key
|
id = Column(INTEGER, primary_key=True) #: primary key
|
||||||
name = Column(String(255), unique=True) #: controltype name (e.g. MCS)
|
name = Column(String(255), unique=True) #: controltype name (e.g. MCS)
|
||||||
targets = Column(JSON) #: organisms checked for
|
targets = Column(JSON) #: organisms checked for
|
||||||
|
|||||||
@@ -360,12 +360,16 @@ class BasicSubmission(Base):
|
|||||||
logger.debug(f"Hello from {cls.__mapper_args__['polymorphic_identity']} PCR parser!")
|
logger.debug(f"Hello from {cls.__mapper_args__['polymorphic_identity']} PCR parser!")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def save(self):
|
def save(self, original:bool=True):
|
||||||
|
if original:
|
||||||
self.uploaded_by = getuser()
|
self.uploaded_by = getuser()
|
||||||
self.metadata.session.add(self)
|
self.metadata.session.add(self)
|
||||||
self.metadata.session.commit()
|
self.metadata.session.commit()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
backup = self.to_dict()
|
backup = self.to_dict()
|
||||||
try:
|
try:
|
||||||
@@ -408,7 +412,7 @@ class BasicSubmission(Base):
|
|||||||
Returns:
|
Returns:
|
||||||
models.BasicSubmission | List[models.BasicSubmission]: Submission(s) of interest
|
models.BasicSubmission | List[models.BasicSubmission]: Submission(s) of interest
|
||||||
"""
|
"""
|
||||||
logger.debug(kwargs)
|
logger.debug(f"kwargs coming into query: {kwargs}")
|
||||||
# NOTE: if you go back to using 'model' change the appropriate cls to model in the query filters
|
# NOTE: if you go back to using 'model' change the appropriate cls to model in the query filters
|
||||||
if submission_type == None:
|
if submission_type == None:
|
||||||
model = cls.find_subclasses(attrs=kwargs)
|
model = cls.find_subclasses(attrs=kwargs)
|
||||||
@@ -651,7 +655,7 @@ class BacterialCulture(BasicSubmission):
|
|||||||
outstr = super().enforce_name(instr=instr, data=data)
|
outstr = super().enforce_name(instr=instr, data=data)
|
||||||
def construct(data:dict|None=None) -> str:
|
def construct(data:dict|None=None) -> str:
|
||||||
"""
|
"""
|
||||||
DEPRECIATED due to slowness. Search for the largest rsl number and increment by 1
|
Create default plate name.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: new RSL number
|
str: new RSL number
|
||||||
@@ -912,9 +916,10 @@ class WastewaterArtic(BasicSubmission):
|
|||||||
source_row = lookup_ssa.row
|
source_row = lookup_ssa.row
|
||||||
source_column = lookup_ssa.column
|
source_column = lookup_ssa.column
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
plate = ""
|
plate = "Error"
|
||||||
source_row = 0
|
source_row = 0
|
||||||
source_column = 0
|
source_column = 0
|
||||||
|
# continue
|
||||||
samples.append(dict(
|
samples.append(dict(
|
||||||
sample=sample.submitter_id,
|
sample=sample.submitter_id,
|
||||||
destination_column=destination_column,
|
destination_column=destination_column,
|
||||||
@@ -931,7 +936,7 @@ class WastewaterArtic(BasicSubmission):
|
|||||||
df = pd.DataFrame.from_records(samples).fillna(value="")
|
df = pd.DataFrame.from_records(samples).fillna(value="")
|
||||||
df.source_row = df.source_row.astype(int)
|
df.source_row = df.source_row.astype(int)
|
||||||
df.source_column = df.source_column.astype(int)
|
df.source_column = df.source_column.astype(int)
|
||||||
df.sort_values(by=['destination_column', 'destination_row'], inplace=True)
|
df.sort_values(by=['plate_number', 'source_column', 'source_row'], inplace=True)
|
||||||
input_dict['csv'] = df
|
input_dict['csv'] = df
|
||||||
return input_dict
|
return input_dict
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class SubmissionsSheet(QTableView):
|
|||||||
index = (self.selectionModel().currentIndex())
|
index = (self.selectionModel().currentIndex())
|
||||||
value = index.sibling(index.row(),1).data()
|
value = index.sibling(index.row(),1).data()
|
||||||
logger.debug(f"Selected value: {value}")
|
logger.debug(f"Selected value: {value}")
|
||||||
dlg = SubmissionComment(rsl=value)
|
dlg = SubmissionComment(parent=self, rsl=value)
|
||||||
if dlg.exec():
|
if dlg.exec():
|
||||||
dlg.add_comment()
|
dlg.add_comment()
|
||||||
|
|
||||||
@@ -455,8 +455,10 @@ class SubmissionDetails(QDialog):
|
|||||||
|
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
# self.ctx = ctx
|
# self.ctx = ctx
|
||||||
|
try:
|
||||||
self.app = parent.parent().parent().parent().parent().parent().parent
|
self.app = parent.parent().parent().parent().parent().parent().parent
|
||||||
print(f"App: {self.app}")
|
except AttributeError:
|
||||||
|
self.app = None
|
||||||
self.setWindowTitle("Submission Details")
|
self.setWindowTitle("Submission Details")
|
||||||
# create scrollable interior
|
# create scrollable interior
|
||||||
interior = QScrollArea()
|
interior = QScrollArea()
|
||||||
@@ -605,10 +607,12 @@ class SubmissionComment(QDialog):
|
|||||||
"""
|
"""
|
||||||
a window for adding comment text to a submission
|
a window for adding comment text to a submission
|
||||||
"""
|
"""
|
||||||
def __init__(self, rsl:str) -> None:
|
def __init__(self, parent, rsl:str) -> None:
|
||||||
|
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
# self.ctx = ctx
|
# self.ctx = ctx
|
||||||
|
self.app = parent.parent().parent().parent().parent().parent().parent
|
||||||
|
print(f"App: {self.app}")
|
||||||
self.rsl = rsl
|
self.rsl = rsl
|
||||||
self.setWindowTitle(f"{self.rsl} Submission Comment")
|
self.setWindowTitle(f"{self.rsl} Submission Comment")
|
||||||
# create text field
|
# create text field
|
||||||
@@ -632,16 +636,18 @@ class SubmissionComment(QDialog):
|
|||||||
commenter = getuser()
|
commenter = getuser()
|
||||||
comment = self.txt_editor.toPlainText()
|
comment = self.txt_editor.toPlainText()
|
||||||
dt = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S")
|
dt = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S")
|
||||||
full_comment = {"name":commenter, "time": dt, "text": comment}
|
|
||||||
|
full_comment = [{"name":commenter, "time": dt, "text": comment}]
|
||||||
logger.debug(f"Full comment: {full_comment}")
|
logger.debug(f"Full comment: {full_comment}")
|
||||||
# sub = lookup_submission_by_rsl_num(ctx = self.ctx, rsl_num=self.rsl)
|
|
||||||
# sub = lookup_submissions(ctx = self.ctx, rsl_number=self.rsl)
|
|
||||||
sub = BasicSubmission.query(rsl_number=self.rsl)
|
sub = BasicSubmission.query(rsl_number=self.rsl)
|
||||||
try:
|
try:
|
||||||
sub.comment.append(full_comment)
|
# For some reason .append results in new comment being ignores, so have to concatenate lists.
|
||||||
except AttributeError:
|
sub.comment = sub.comment + full_comment
|
||||||
sub.comment = [full_comment]
|
except AttributeError as e:
|
||||||
logger.debug(sub.__dict__)
|
logger.error(f"Hit error {e} creating comment")
|
||||||
sub.save()
|
sub.comment = full_comment
|
||||||
|
# logger.debug(sub.comment)
|
||||||
|
sub.save(original=False)
|
||||||
|
# logger.debug(f"Save result: {result}")
|
||||||
|
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ class SubmissionFormContainer(QWidget):
|
|||||||
# obj.ctx.database_session.add(sub)
|
# obj.ctx.database_session.add(sub)
|
||||||
logger.debug(f"Existing {type(sub.pcr_info)}: {sub.pcr_info}")
|
logger.debug(f"Existing {type(sub.pcr_info)}: {sub.pcr_info}")
|
||||||
logger.debug(f"Inserting {type(json.dumps(parser.pcr))}: {json.dumps(parser.pcr)}")
|
logger.debug(f"Inserting {type(json.dumps(parser.pcr))}: {json.dumps(parser.pcr)}")
|
||||||
sub.save()
|
sub.save(original=False)
|
||||||
logger.debug(f"Got {len(parser.samples)} samples to update!")
|
logger.debug(f"Got {len(parser.samples)} samples to update!")
|
||||||
logger.debug(f"Parser samples: {parser.samples}")
|
logger.debug(f"Parser samples: {parser.samples}")
|
||||||
for sample in sub.samples:
|
for sample in sub.samples:
|
||||||
|
|||||||
Reference in New Issue
Block a user