Add beamtime relationships and enhance sample handling
This commit adds relationships to link Pucks and Samples to Beamtime in the models, enabling better data association. Includes changes to assign beamtime IDs during data generation and updates in API response models for improved data loading. Removed redundant code in testfunctions.ipynb to clean up the notebook.
This commit is contained in:
@ -534,6 +534,7 @@ class PuckCreate(BaseModel):
|
||||
puck_type: str
|
||||
puck_location_in_dewar: int
|
||||
samples: List[SampleCreate] = []
|
||||
beamtime_id: Optional[int] = None
|
||||
|
||||
|
||||
class PuckUpdate(BaseModel):
|
||||
@ -541,6 +542,7 @@ class PuckUpdate(BaseModel):
|
||||
puck_type: Optional[str] = None
|
||||
puck_location_in_dewar: Optional[int] = None
|
||||
dewar_id: Optional[int] = None
|
||||
beamtime_id: Optional[int] = None
|
||||
|
||||
|
||||
class Puck(BaseModel):
|
||||
@ -549,6 +551,7 @@ class Puck(BaseModel):
|
||||
puck_type: str
|
||||
puck_location_in_dewar: int
|
||||
dewar_id: int
|
||||
beamtime_id: Optional[int] = None
|
||||
events: List[PuckEvent] = []
|
||||
samples: List[Sample] = []
|
||||
|
||||
@ -800,6 +803,24 @@ class BeamtimeCreate(BaseModel):
|
||||
local_contact_id: Optional[int]
|
||||
|
||||
|
||||
class BeamtimeResponse(BaseModel):
|
||||
id: int
|
||||
pgroups: str
|
||||
shift: str
|
||||
beamtime_name: str
|
||||
beamline: str
|
||||
start_date: date
|
||||
end_date: date
|
||||
status: str
|
||||
comments: Optional[str] = None
|
||||
proposal_id: Optional[int]
|
||||
local_contact_id: Optional[int]
|
||||
local_contact: Optional[LocalContact]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ImageCreate(BaseModel):
|
||||
pgroup: str
|
||||
sample_id: int
|
||||
|
Reference in New Issue
Block a user