Adaptations to allow for stand alone scripts.
This commit is contained in:
@@ -339,7 +339,6 @@ class Reagent(BaseClass):
|
||||
|
||||
submissions = association_proxy("reagent_submission_associations", "submission") #: Association proxy to SubmissionSampleAssociation.samples
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
if self.name != None:
|
||||
return f"<Reagent({self.name}-{self.lot})>"
|
||||
|
||||
@@ -41,7 +41,8 @@ class Organization(BaseClass):
|
||||
|
||||
@classmethod
|
||||
@setup_lookup
|
||||
def query(cls,
|
||||
def query(cls,
|
||||
id:int|None=None,
|
||||
name:str|None=None,
|
||||
limit:int=0,
|
||||
) -> Organization|List[Organization]:
|
||||
@@ -56,6 +57,12 @@ class Organization(BaseClass):
|
||||
Organization|List[Organization]:
|
||||
"""
|
||||
query: Query = cls.__database_session__.query(cls)
|
||||
match id:
|
||||
case int():
|
||||
query = query.filter(cls.id==id)
|
||||
limit = 1
|
||||
case _:
|
||||
pass
|
||||
match name:
|
||||
case str():
|
||||
# logger.debug(f"Looking up organization with name: {name}")
|
||||
|
||||
@@ -1242,9 +1242,9 @@ class Wastewater(BasicSubmission):
|
||||
outstr = super().enforce_name(instr=instr, data=data)
|
||||
try:
|
||||
outstr = re.sub(r"PCR(-|_)", "", outstr)
|
||||
except AttributeError as e:
|
||||
except (AttributeError, TypeError) as e:
|
||||
logger.error(f"Problem using regex: {e}")
|
||||
outstr = RSLNamer.construct_new_plate_name(instr=outstr)
|
||||
outstr = RSLNamer.construct_new_plate_name(data=data)
|
||||
outstr = outstr.replace("RSLWW", "RSL-WW")
|
||||
outstr = re.sub(r"WW(\d{4})", r"WW-\1", outstr, flags=re.IGNORECASE)
|
||||
outstr = re.sub(r"(\d{4})-(\d{2})-(\d{2})", r"\1\2\3", outstr)
|
||||
|
||||
Reference in New Issue
Block a user