Moments before disaster.
This commit is contained in:
@@ -577,7 +577,7 @@ class SubmissionType(Base):
|
|||||||
info_map = Column(JSON) #: Where basic information is found in the excel workbook corresponding to this type.
|
info_map = Column(JSON) #: Where basic information is found in the excel workbook corresponding to this type.
|
||||||
instances = relationship("BasicSubmission", backref="submission_type")
|
instances = relationship("BasicSubmission", backref="submission_type")
|
||||||
# regex = Column(String(512))
|
# regex = Column(String(512))
|
||||||
template_file = Column(BLOB)
|
# template_file = Column(BLOB)
|
||||||
|
|
||||||
submissiontype_kit_associations = relationship(
|
submissiontype_kit_associations = relationship(
|
||||||
"SubmissionTypeKitTypeAssociation",
|
"SubmissionTypeKitTypeAssociation",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import math
|
|||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from . import Reagent, SubmissionType, KitType, Organization
|
from . import Reagent, SubmissionType, KitType, Organization
|
||||||
from sqlalchemy import Column, String, TIMESTAMP, INTEGER, ForeignKey, Table, JSON, FLOAT, case
|
from sqlalchemy import Column, String, TIMESTAMP, INTEGER, ForeignKey, Table, JSON, FLOAT, case
|
||||||
from sqlalchemy.orm import relationship, validates, Query
|
from sqlalchemy.orm import relationship, validates, Query, declared_attr
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
@@ -42,7 +42,9 @@ class BasicSubmission(Base):
|
|||||||
"""
|
"""
|
||||||
Concrete of basic submission which polymorphs into BacterialCulture and Wastewater
|
Concrete of basic submission which polymorphs into BacterialCulture and Wastewater
|
||||||
"""
|
"""
|
||||||
|
# @declared_attr
|
||||||
|
# def __tablename__(cls):
|
||||||
|
# return cls.__name__.lower()
|
||||||
__tablename__ = "_submissions"
|
__tablename__ = "_submissions"
|
||||||
__table_args__ = {'extend_existing': True}
|
__table_args__ = {'extend_existing': True}
|
||||||
|
|
||||||
@@ -601,6 +603,7 @@ class BacterialCulture(BasicSubmission):
|
|||||||
"""
|
"""
|
||||||
derivative submission type from BasicSubmission
|
derivative submission type from BasicSubmission
|
||||||
"""
|
"""
|
||||||
|
# id = Column(INTEGER, ForeignKey('basicsubmission.id'), primary_key=True)
|
||||||
controls = relationship("Control", back_populates="submission", uselist=True) #: A control sample added to submission
|
controls = relationship("Control", back_populates="submission", uselist=True) #: A control sample added to submission
|
||||||
__mapper_args__ = {"polymorphic_identity": "Bacterial Culture", "polymorphic_load": "inline"}
|
__mapper_args__ = {"polymorphic_identity": "Bacterial Culture", "polymorphic_load": "inline"}
|
||||||
|
|
||||||
@@ -714,6 +717,7 @@ class Wastewater(BasicSubmission):
|
|||||||
"""
|
"""
|
||||||
derivative submission type from BasicSubmission
|
derivative submission type from BasicSubmission
|
||||||
"""
|
"""
|
||||||
|
# id = Column(INTEGER, ForeignKey('basicsubmission.id'), primary_key=True)
|
||||||
ext_technician = Column(String(64))
|
ext_technician = Column(String(64))
|
||||||
pcr_technician = Column(String(64))
|
pcr_technician = Column(String(64))
|
||||||
__mapper_args__ = {"polymorphic_identity": "Wastewater", "polymorphic_load": "inline"}
|
__mapper_args__ = {"polymorphic_identity": "Wastewater", "polymorphic_load": "inline"}
|
||||||
@@ -840,6 +844,7 @@ class WastewaterArtic(BasicSubmission):
|
|||||||
"""
|
"""
|
||||||
derivative submission type for artic wastewater
|
derivative submission type for artic wastewater
|
||||||
"""
|
"""
|
||||||
|
# id = Column(INTEGER, ForeignKey('basicsubmission.id'), primary_key=True)
|
||||||
__mapper_args__ = {"polymorphic_identity": "Wastewater Artic", "polymorphic_load": "inline"}
|
__mapper_args__ = {"polymorphic_identity": "Wastewater Artic", "polymorphic_load": "inline"}
|
||||||
artic_technician = Column(String(64))
|
artic_technician = Column(String(64))
|
||||||
|
|
||||||
@@ -924,10 +929,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 = "Error"
|
# plate = "Error"
|
||||||
source_row = 0
|
# source_row = 0
|
||||||
source_column = 0
|
# source_column = 0
|
||||||
# continue
|
continue
|
||||||
samples.append(dict(
|
samples.append(dict(
|
||||||
sample=sample.submitter_id,
|
sample=sample.submitter_id,
|
||||||
destination_column=destination_column,
|
destination_column=destination_column,
|
||||||
@@ -955,6 +960,9 @@ class BasicSample(Base):
|
|||||||
Base of basic sample which polymorphs into BCSample and WWSample
|
Base of basic sample which polymorphs into BCSample and WWSample
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# @declared_attr
|
||||||
|
# def __tablename__(cls):
|
||||||
|
# return cls.__name__.lower()
|
||||||
__tablename__ = "_samples"
|
__tablename__ = "_samples"
|
||||||
__table_args__ = {'extend_existing': True}
|
__table_args__ = {'extend_existing': True}
|
||||||
|
|
||||||
@@ -1147,6 +1155,7 @@ class WastewaterSample(BasicSample):
|
|||||||
"""
|
"""
|
||||||
Derivative wastewater sample
|
Derivative wastewater sample
|
||||||
"""
|
"""
|
||||||
|
# id = Column(INTEGER, ForeignKey('basicsample.id'), primary_key=True)
|
||||||
ww_processing_num = Column(String(64)) #: wastewater processing number
|
ww_processing_num = Column(String(64)) #: wastewater processing number
|
||||||
ww_full_sample_id = Column(String(64))
|
ww_full_sample_id = Column(String(64))
|
||||||
rsl_number = Column(String(64)) #: rsl plate identification number
|
rsl_number = Column(String(64)) #: rsl plate identification number
|
||||||
@@ -1212,6 +1221,7 @@ class BacterialCultureSample(BasicSample):
|
|||||||
"""
|
"""
|
||||||
base of bacterial culture sample
|
base of bacterial culture sample
|
||||||
"""
|
"""
|
||||||
|
# id = Column(INTEGER, ForeignKey('basicsample.id'), primary_key=True)
|
||||||
organism = Column(String(64)) #: bacterial specimen
|
organism = Column(String(64)) #: bacterial specimen
|
||||||
concentration = Column(String(16)) #: sample concentration
|
concentration = Column(String(16)) #: sample concentration
|
||||||
__mapper_args__ = {"polymorphic_identity": "Bacterial Culture Sample", "polymorphic_load": "inline"}
|
__mapper_args__ = {"polymorphic_identity": "Bacterial Culture Sample", "polymorphic_load": "inline"}
|
||||||
@@ -1234,6 +1244,10 @@ class SubmissionSampleAssociation(Base):
|
|||||||
table containing submission/sample associations
|
table containing submission/sample associations
|
||||||
DOC: https://docs.sqlalchemy.org/en/14/orm/extensions/associationproxy.html
|
DOC: https://docs.sqlalchemy.org/en/14/orm/extensions/associationproxy.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# @declared_attr
|
||||||
|
# def __tablename__(cls):
|
||||||
|
# return cls.__name__.lower()
|
||||||
__tablename__ = "_submission_sample"
|
__tablename__ = "_submission_sample"
|
||||||
__table_args__ = {'extend_existing': True}
|
__table_args__ = {'extend_existing': True}
|
||||||
|
|
||||||
@@ -1393,6 +1407,9 @@ class WastewaterAssociation(SubmissionSampleAssociation):
|
|||||||
"""
|
"""
|
||||||
Derivative custom Wastewater/Submission Association... fancy.
|
Derivative custom Wastewater/Submission Association... fancy.
|
||||||
"""
|
"""
|
||||||
|
# submission_id = Column(INTEGER, ForeignKey("submissionsampleassociation.submission_id"), primary_key=True)
|
||||||
|
# row = Column(INTEGER, ForeignKey("submissionsampleassociation.row"), nullable=False)
|
||||||
|
# column = Column(INTEGER, ForeignKey("submissionsampleassociation.column"), primary_key=True)
|
||||||
ct_n1 = Column(FLOAT(2)) #: AKA ct for N1
|
ct_n1 = Column(FLOAT(2)) #: AKA ct for N1
|
||||||
ct_n2 = Column(FLOAT(2)) #: AKA ct for N2
|
ct_n2 = Column(FLOAT(2)) #: AKA ct for N2
|
||||||
n1_status = Column(String(32)) #: positive or negative for N1
|
n1_status = Column(String(32)) #: positive or negative for N1
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from PyQt6.QtGui import QAction, QCursor, QPixmap, QPainter
|
|||||||
from backend.db.functions import submissions_to_df
|
from backend.db.functions import submissions_to_df
|
||||||
from backend.db.models import BasicSubmission
|
from backend.db.models import BasicSubmission
|
||||||
from backend.excel import make_hitpicks, make_report_html, make_report_xlsx
|
from backend.excel import make_hitpicks, make_report_html, make_report_xlsx
|
||||||
from tools import check_if_app, Settings, Report, Result
|
from tools import check_if_app, Report, Result
|
||||||
from tools import jinja_template_loading
|
from tools import jinja_template_loading
|
||||||
from xhtml2pdf import pisa
|
from xhtml2pdf import pisa
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -159,19 +159,19 @@ class SubmissionsSheet(QTableView):
|
|||||||
self.menu = QMenu(self)
|
self.menu = QMenu(self)
|
||||||
renameAction = QAction('Delete', self)
|
renameAction = QAction('Delete', self)
|
||||||
detailsAction = QAction('Details', self)
|
detailsAction = QAction('Details', self)
|
||||||
barcodeAction = QAction("Print Barcode", self)
|
# barcodeAction = QAction("Print Barcode", self)
|
||||||
commentAction = QAction("Add Comment", self)
|
commentAction = QAction("Add Comment", self)
|
||||||
hitpickAction = QAction("Hitpicks", self)
|
# hitpickAction = QAction("Hitpicks", self)
|
||||||
renameAction.triggered.connect(lambda: self.delete_item(event))
|
renameAction.triggered.connect(lambda: self.delete_item(event))
|
||||||
detailsAction.triggered.connect(lambda: self.show_details())
|
detailsAction.triggered.connect(lambda: self.show_details())
|
||||||
barcodeAction.triggered.connect(lambda: self.create_barcode())
|
# barcodeAction.triggered.connect(lambda: self.create_barcode())
|
||||||
commentAction.triggered.connect(lambda: self.add_comment())
|
commentAction.triggered.connect(lambda: self.add_comment())
|
||||||
hitpickAction.triggered.connect(lambda: self.hit_pick())
|
# hitpickAction.triggered.connect(lambda: self.hit_pick())
|
||||||
self.menu.addAction(detailsAction)
|
self.menu.addAction(detailsAction)
|
||||||
self.menu.addAction(renameAction)
|
self.menu.addAction(renameAction)
|
||||||
self.menu.addAction(barcodeAction)
|
# self.menu.addAction(barcodeAction)
|
||||||
self.menu.addAction(commentAction)
|
self.menu.addAction(commentAction)
|
||||||
self.menu.addAction(hitpickAction)
|
# self.menu.addAction(hitpickAction)
|
||||||
# add other required actions
|
# add other required actions
|
||||||
self.menu.popup(QCursor.pos())
|
self.menu.popup(QCursor.pos())
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ class SubmissionDetails(QDialog):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
# self.ctx = ctx
|
# self.ctx = ctx
|
||||||
try:
|
try:
|
||||||
self.app = parent.parent().parent().parent().parent().parent().parent
|
self.app = parent.parent().parent().parent().parent().parent().parent()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.app = None
|
self.app = None
|
||||||
self.setWindowTitle("Submission Details")
|
self.setWindowTitle("Submission Details")
|
||||||
@@ -643,7 +643,7 @@ class SubmissionComment(QDialog):
|
|||||||
try:
|
try:
|
||||||
# For some reason .append results in new comment being ignores, so have to concatenate lists.
|
# For some reason .append results in new comment being ignores, so have to concatenate lists.
|
||||||
sub.comment = sub.comment + full_comment
|
sub.comment = sub.comment + full_comment
|
||||||
except AttributeError as e:
|
except (AttributeError, TypeError) as e:
|
||||||
logger.error(f"Hit error {e} creating comment")
|
logger.error(f"Hit error {e} creating comment")
|
||||||
sub.comment = full_comment
|
sub.comment = full_comment
|
||||||
# logger.debug(sub.comment)
|
# logger.debug(sub.comment)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SubmissionFormContainer(QWidget):
|
|||||||
def __init__(self, parent: QWidget) -> None:
|
def __init__(self, parent: QWidget) -> None:
|
||||||
logger.debug(f"Setting form widget...")
|
logger.debug(f"Setting form widget...")
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.app = self.parent().parent#().parent().parent().parent().parent().parent
|
self.app = self.parent().parent()
|
||||||
self.report = Report()
|
self.report = Report()
|
||||||
# self.parent = parent
|
# self.parent = parent
|
||||||
self.setAcceptDrops(True)
|
self.setAcceptDrops(True)
|
||||||
|
|||||||
Reference in New Issue
Block a user