2022-01-10 00:00:14 +08:00
|
|
|
from typing import Dict, List, Optional
|
2021-01-06 19:52:14 +08:00
|
|
|
|
2022-01-10 00:00:14 +08:00
|
|
|
from pydantic import BaseModel
|
2021-01-06 19:52:14 +08:00
|
|
|
|
2023-03-19 23:21:32 +08:00
|
|
|
from felicity.apps.analysis.schemas import AnalysisBaseInDB, QCLevelInDB
|
|
|
|
from felicity.core.uid_gen import FelicityIDType
|
2023-01-15 14:04:29 +08:00
|
|
|
|
2022-01-10 00:00:14 +08:00
|
|
|
#
|
2021-01-06 19:52:14 +08:00
|
|
|
# WorkSheet Schemas
|
2022-01-10 00:00:14 +08:00
|
|
|
#
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
# Shared properties
|
|
|
|
class WorkSheetBase(BaseModel):
|
2023-03-19 23:21:32 +08:00
|
|
|
analyst_uid: Optional[FelicityIDType] = None
|
|
|
|
template_uid: Optional[FelicityIDType] = None
|
2021-04-11 16:15:52 +08:00
|
|
|
worksheet_id: Optional[str] = None
|
2023-03-19 23:21:32 +08:00
|
|
|
instrument_uid: Optional[FelicityIDType] = None
|
|
|
|
sample_type_uid: Optional[FelicityIDType] = None
|
|
|
|
analysis_uid: Optional[FelicityIDType] = None
|
2022-03-19 20:41:29 +08:00
|
|
|
analysis: Optional[AnalysisBaseInDB] = None
|
2021-01-06 19:52:14 +08:00
|
|
|
reserved: Optional[Dict] = {}
|
|
|
|
number_of_samples: Optional[int] = None
|
|
|
|
worksheet_type: Optional[int] = 0
|
|
|
|
rows: Optional[int] = None
|
|
|
|
cols: Optional[int] = None
|
|
|
|
row_wise: Optional[bool] = True
|
|
|
|
template: Optional[Dict] = {}
|
2021-09-10 14:48:06 +08:00
|
|
|
state: Optional[str] = None
|
2021-01-06 19:52:14 +08:00
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
class WorkSheetBaseInDB(WorkSheetBase):
|
2023-03-19 23:21:32 +08:00
|
|
|
uid: Optional[FelicityIDType] = None
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
orm_mode = True
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties to receive via API on creation
|
|
|
|
class WorkSheetCreate(WorkSheetBase):
|
|
|
|
pass
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties to receive via API on update
|
|
|
|
class WorkSheetUpdate(WorkSheetBase):
|
2021-02-27 19:24:39 +08:00
|
|
|
pass
|
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
# Properties to return via API
|
|
|
|
class WorkSheet(WorkSheetBaseInDB):
|
|
|
|
pass
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties stored in DB
|
|
|
|
class WorkSheetInDB(WorkSheetBaseInDB):
|
2021-02-27 19:24:39 +08:00
|
|
|
pass
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
|
2022-01-10 00:00:14 +08:00
|
|
|
#
|
2021-01-06 19:52:14 +08:00
|
|
|
# WSTemplate Schemas
|
2022-01-10 00:00:14 +08:00
|
|
|
#
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
# Shared properties
|
|
|
|
class WSTemplateBase(BaseModel):
|
|
|
|
name: Optional[str] = None
|
|
|
|
description: Optional[str] = None
|
2023-03-19 23:21:32 +08:00
|
|
|
instrument_uid: Optional[FelicityIDType] = None
|
|
|
|
sample_type_uid: Optional[FelicityIDType] = None
|
|
|
|
analysis_uid: Optional[FelicityIDType] = None
|
2022-03-19 20:41:29 +08:00
|
|
|
analysis: Optional[AnalysisBaseInDB] = None
|
2021-10-07 15:17:20 +08:00
|
|
|
qc_analyses: Optional[List[AnalysisBaseInDB]] = []
|
|
|
|
qc_levels: Optional[List[QCLevelInDB]] = []
|
2021-01-06 19:52:14 +08:00
|
|
|
reserved: Optional[Dict] = {}
|
2021-10-01 15:37:34 +08:00
|
|
|
number_of_samples: Optional[int] = None
|
2022-01-10 00:00:14 +08:00
|
|
|
worksheet_type: Optional[str] = "flat"
|
2021-10-01 15:37:34 +08:00
|
|
|
rows: Optional[int] = None
|
|
|
|
cols: Optional[int] = None
|
2021-01-06 19:52:14 +08:00
|
|
|
row_wise: Optional[bool] = True
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
class WSTemplateBaseInDB(WSTemplateBase):
|
2023-03-19 23:21:32 +08:00
|
|
|
uid: Optional[FelicityIDType] = None
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
orm_mode = True
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties to receive via API on creation
|
|
|
|
class WSTemplateCreate(WSTemplateBase):
|
|
|
|
pass
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties to receive via API on update
|
|
|
|
class WSTemplateUpdate(WSTemplateBase):
|
2021-02-27 19:24:39 +08:00
|
|
|
pass
|
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
|
|
|
|
# Properties to return via API
|
|
|
|
class WSTemplate(WSTemplateBaseInDB):
|
|
|
|
pass
|
|
|
|
|
2021-02-27 19:24:39 +08:00
|
|
|
|
2021-01-06 19:52:14 +08:00
|
|
|
# Properties stored in DB
|
|
|
|
class WSTemplateInDB(WSTemplateBaseInDB):
|
2021-02-27 19:24:39 +08:00
|
|
|
pass
|