Prior to major database rebuild.
This commit is contained in:
@@ -49,12 +49,16 @@ def store_submission(ctx:Settings, base_submission:models.BasicSubmission) -> No
|
||||
base_submission.rsl_plate_num = typer.parsed_name
|
||||
for sample in base_submission.samples:
|
||||
logger.debug(f"Typer: {typer.submission_type}")
|
||||
logger.debug(f"sample going in: {type(sample)}\n{sample.__dict__}")
|
||||
# Suuuuuper hacky way to be sure that the artic doesn't overwrite the ww plate in a ww sample
|
||||
# need something more elegant
|
||||
if "_artic" not in typer.submission_type.lower():
|
||||
if "_artic" not in typer.submission_type:
|
||||
sample.rsl_plate = base_submission
|
||||
else:
|
||||
sample.artic_rsl_plate = base_submission
|
||||
logger.debug(f"{sample.ww_sample_full_id} is an ARTIC sample.")
|
||||
# base_submission.samples.remove(sample)
|
||||
# sample.rsl_plate = sample.rsl_plate
|
||||
# sample.artic_rsl_plate = base_submission
|
||||
logger.debug(f"Attempting to add sample: {sample.to_string()}")
|
||||
try:
|
||||
# ctx['database_session'].add(sample)
|
||||
@@ -62,6 +66,7 @@ def store_submission(ctx:Settings, base_submission:models.BasicSubmission) -> No
|
||||
except (sqlite3.IntegrityError, sqlalchemy.exc.IntegrityError) as e:
|
||||
logger.debug(f"Hit an integrity error : {e}")
|
||||
continue
|
||||
logger.debug(f"Here is the sample to be stored in the DB: {sample.__dict__}")
|
||||
# Add submission to submission table
|
||||
# ctx['database_session'].add(base_submission)
|
||||
ctx.database_session.add(base_submission)
|
||||
@@ -650,7 +655,7 @@ def get_control_subtypes(ctx:Settings, type:str, mode:str) -> list[str]:
|
||||
# Only the first control of type is necessary since they all share subtypes
|
||||
try:
|
||||
outs = get_all_controls_by_type(ctx=ctx, con_type=type)[0]
|
||||
except TypeError:
|
||||
except (TypeError, IndexError):
|
||||
return []
|
||||
# Get analysis mode data as dict
|
||||
jsoner = json.loads(getattr(outs, mode))
|
||||
|
||||
@@ -156,39 +156,3 @@ class BCSample(Base):
|
||||
col=well_col,
|
||||
positive=False)
|
||||
|
||||
# class ArticSample(Base):
|
||||
# """
|
||||
# base of artic sample
|
||||
# """
|
||||
# __tablename__ = "_artic_samples"
|
||||
|
||||
# id = Column(INTEGER, primary_key=True) #: primary key
|
||||
# well_number = Column(String(8)) #: location on parent plate
|
||||
# rsl_plate = relationship("WastewaterArtic", back_populates="samples") #: relationship to parent plate
|
||||
# rsl_plate_id = Column(INTEGER, ForeignKey("_submissions.id", ondelete="SET NULL", name="fk_WWA_submission_id"))
|
||||
# ww_sample_full_id = Column(String(64), nullable=False)
|
||||
# lims_sample_id = Column(String(64), nullable=False)
|
||||
# ct_1 = Column(FLOAT(2)) #: first ct value in column
|
||||
# ct_2 = Column(FLOAT(2)) #: second ct value in column
|
||||
|
||||
# def to_string(self) -> str:
|
||||
# """
|
||||
# string representing sample object
|
||||
|
||||
# Returns:
|
||||
# str: string representing location and sample id
|
||||
# """
|
||||
# return f"{self.well_number}: {self.ww_sample_full_id}"
|
||||
|
||||
# def to_sub_dict(self) -> dict:
|
||||
# """
|
||||
# gui friendly dictionary
|
||||
|
||||
# Returns:
|
||||
# dict: well location and name (sample id, organism) NOTE: keys must sync with WWSample to_sub_dict above
|
||||
# """
|
||||
# return {
|
||||
# "well": self.well_number,
|
||||
# "name": self.ww_sample_full_id,
|
||||
# }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user