Updated kit creation.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
## 202305.02
|
||||
|
||||
- Updated kit creation methods to keep pace with new cost calculations.
|
||||
|
||||
## 202305.01
|
||||
|
||||
- Improved kit cost calculation.
|
||||
@@ -5,7 +9,7 @@
|
||||
## 202304.04
|
||||
|
||||
- Added in discounts for kits based on kit used and submitting client.
|
||||
- Kraken controls graph now only pulls top 20 results to prevent crashing.
|
||||
- Kraken controls graph now only pulls top 50 results to prevent crashing.
|
||||
- Improved cost calculations per column in a 96 well plate.
|
||||
|
||||
## 202304.01
|
||||
|
||||
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
|
||||
# Version of the realpython-reader package
|
||||
__project__ = "submissions"
|
||||
__version__ = "202305.1b"
|
||||
__version__ = "202305.2b"
|
||||
__author__ = {"name":"Landon Wark", "email":"Landon.Wark@phac-aspc.gc.ca"}
|
||||
__copyright__ = "2022-2023, Government of Canada"
|
||||
|
||||
|
||||
@@ -477,7 +477,12 @@ def create_kit_from_yaml(ctx:dict, exp:dict) -> dict:
|
||||
continue
|
||||
# A submission type may use multiple kits.
|
||||
for kt in exp[type]['kits']:
|
||||
kit = models.KitType(name=kt, used_for=[type.replace("_", " ").title()], constant_cost=exp[type]["kits"][kt]["constant_cost"], mutable_cost_column=exp[type]["kits"][kt]["mutable_cost_column"])
|
||||
kit = models.KitType(name=kt,
|
||||
used_for=[type.replace("_", " ").title()],
|
||||
constant_cost=exp[type]["kits"][kt]["constant_cost"],
|
||||
mutable_cost_column=exp[type]["kits"][kt]["mutable_cost_column"],
|
||||
mutable_cost_sample=exp[type]["kits"][kt]["mutable_cost_sample"]
|
||||
)
|
||||
# A kit contains multiple reagent types.
|
||||
for r in exp[type]['kits'][kt]['reagenttypes']:
|
||||
# check if reagent type already exists.
|
||||
@@ -488,7 +493,11 @@ def create_kit_from_yaml(ctx:dict, exp:dict) -> dict:
|
||||
rt = look_up
|
||||
rt.kits.append(kit)
|
||||
# add this because I think it's necessary to get proper back population
|
||||
try:
|
||||
kit.reagent_types_id.append(rt.id)
|
||||
except AttributeError as e:
|
||||
logger.error(f"Error appending reagent id to kit.reagent_types_id: {e}, creating new.")
|
||||
# kit.reagent_types_id = [rt.id]
|
||||
ctx['database_session'].add(rt)
|
||||
logger.debug(f"Kit construction reagent type: {rt.__dict__}")
|
||||
logger.debug(f"Kit construction kit: {kit.__dict__}")
|
||||
|
||||
@@ -5,7 +5,7 @@ from PyQt6.QtWidgets import (
|
||||
QTabWidget, QWidget, QVBoxLayout,
|
||||
QPushButton, QFileDialog,
|
||||
QLineEdit, QMessageBox, QComboBox, QDateEdit, QHBoxLayout,
|
||||
QSpinBox, QScrollArea
|
||||
QSpinBox, QDoubleSpinBox, QScrollArea
|
||||
)
|
||||
|
||||
logger = logging.getLogger(f"submissions.{__name__}")
|
||||
@@ -49,7 +49,7 @@ def extract_form_info(object) -> dict:
|
||||
dicto[item.objectName()] = item.currentText()
|
||||
case QDateEdit():
|
||||
dicto[item.objectName()] = item.date().toPyDate()
|
||||
case QSpinBox():
|
||||
case QSpinBox() | QDoubleSpinBox():
|
||||
dicto[item.objectName()] = item.value()
|
||||
case ReagentTypeForm():
|
||||
reagent = extract_form_info(item)
|
||||
|
||||
@@ -7,7 +7,7 @@ from PyQt6.QtWidgets import (
|
||||
QLabel, QVBoxLayout,
|
||||
QLineEdit, QComboBox, QDialog,
|
||||
QDialogButtonBox, QDateEdit, QSizePolicy, QWidget,
|
||||
QGridLayout, QPushButton, QSpinBox,
|
||||
QGridLayout, QPushButton, QSpinBox, QDoubleSpinBox,
|
||||
QHBoxLayout,
|
||||
)
|
||||
from PyQt6.QtCore import Qt, QDate, QSize
|
||||
@@ -145,18 +145,25 @@ class KitAdder(QWidget):
|
||||
# set cost per run
|
||||
self.grid.addWidget(QLabel("Constant cost per full plate (plates, work hours, etc.):"),4,0)
|
||||
# widget to get constant cost
|
||||
const_cost = QSpinBox()
|
||||
const_cost = QDoubleSpinBox() #QSpinBox()
|
||||
const_cost.setObjectName("const_cost")
|
||||
const_cost.setMinimum(0)
|
||||
const_cost.setMaximum(9999)
|
||||
self.grid.addWidget(const_cost,4,1)
|
||||
self.grid.addWidget(QLabel("Mutable cost per full plate (tips, reagents, etc.):"),5,0)
|
||||
# widget to get mutable costs
|
||||
mut_cost = QSpinBox()
|
||||
mut_cost.setObjectName("mut_cost")
|
||||
mut_cost.setMinimum(0)
|
||||
mut_cost.setMaximum(9999)
|
||||
self.grid.addWidget(mut_cost,5,1)
|
||||
self.grid.addWidget(QLabel("Cost per column (multidrop reagents, etc.):"),5,0)
|
||||
# widget to get mutable costs per column
|
||||
mut_cost_col = QDoubleSpinBox() #QSpinBox()
|
||||
mut_cost_col.setObjectName("mut_cost_col")
|
||||
mut_cost_col.setMinimum(0)
|
||||
mut_cost_col.setMaximum(9999)
|
||||
self.grid.addWidget(mut_cost_col,5,1)
|
||||
self.grid.addWidget(QLabel("Cost per sample (tips, reagents, etc.):"),6,0)
|
||||
# widget to get mutable costs per column
|
||||
mut_cost_samp = QDoubleSpinBox() #QSpinBox()
|
||||
mut_cost_samp.setObjectName("mut_cost_samp")
|
||||
mut_cost_samp.setMinimum(0)
|
||||
mut_cost_samp.setMaximum(9999)
|
||||
self.grid.addWidget(mut_cost_samp,6,1)
|
||||
# button to add additional reagent types
|
||||
self.add_RT_btn = QPushButton("Add Reagent Type")
|
||||
self.grid.addWidget(self.add_RT_btn)
|
||||
@@ -191,7 +198,8 @@ class KitAdder(QWidget):
|
||||
yml_type[used]['kits'] = {}
|
||||
yml_type[used]['kits'][info['kit_name']] = {}
|
||||
yml_type[used]['kits'][info['kit_name']]['constant_cost'] = info["const_cost"]
|
||||
yml_type[used]['kits'][info['kit_name']]['mutable_cost'] = info["mut_cost"]
|
||||
yml_type[used]['kits'][info['kit_name']]['mutable_cost_column'] = info["mut_cost_col"]
|
||||
yml_type[used]['kits'][info['kit_name']]['mutable_cost_sample'] = info["mut_cost_samp"]
|
||||
yml_type[used]['kits'][info['kit_name']]['reagenttypes'] = reagents
|
||||
logger.debug(yml_type)
|
||||
# send to kit constructor
|
||||
|
||||
Reference in New Issue
Block a user