Mid-progress adding controls to pydantic creation.

This commit is contained in:
lwark
2024-11-21 08:46:41 -06:00
parent 506aac80c1
commit 7d1e6dc606
16 changed files with 224 additions and 187 deletions

View File

@@ -16,6 +16,7 @@ from typing import List, Literal, Tuple, Generator
from dateutil.parser import parse
from re import Pattern
logger = logging.getLogger(f"submissions.{__name__}")
@@ -429,6 +430,10 @@ class PCRControl(Control):
fig = PCRFigure(df=df, modes=[])
return report, fig
def to_pydantic(self):
from backend.validators import PydPCRControl
return PydPCRControl(**self.to_sub_dict())
class IridaControl(Control):
@@ -878,3 +883,7 @@ class IridaControl(Control):
exclude = [re.sub(rerun_regex, "", sample) for sample in sample_names if rerun_regex.search(sample)]
df = df[df.name not in exclude]
return df
def to_pydantic(self):
from backend.validators import PydIridaControl
return PydIridaControl(**self.__dict__)