Refactor AareDB backend and update schemas and paths.
Revised backend schema definitions, removing unnecessary attributes and adding new configurations. Updated file path references to align with the aaredb structure. Cleaned up redundant notebook content and commented out unused database regeneration logic in the backend. Added posting a result to the database
This commit is contained in:
@ -352,16 +352,6 @@ class SampleEventCreate(BaseModel):
|
||||
event_type: Literal[
|
||||
"Mounting", "Centering", "Failed", "Lost", "Collecting", "Unmounting"
|
||||
]
|
||||
# event_type: str
|
||||
# Validate event_type against accepted event types
|
||||
# @field_validator("event_type", mode="before")
|
||||
# def validate_event_type(cls, value):
|
||||
# allowed = {"Mounting", "Centering", "Failed",
|
||||
# "Lost", "Collecting", "Unmounting"}
|
||||
# if value not in allowed:
|
||||
# raise ValueError(f"Invalid event_type: {value}.
|
||||
# Accepted values are: {allowed}")
|
||||
# return value
|
||||
|
||||
|
||||
class SampleEventResponse(SampleEventCreate):
|
||||
@ -374,10 +364,7 @@ class SampleEventResponse(SampleEventCreate):
|
||||
|
||||
|
||||
class Results(BaseModel):
|
||||
id: int
|
||||
pgroup: str
|
||||
sample_id: int
|
||||
method: str
|
||||
pipeline: str
|
||||
resolution: float
|
||||
unit_cell: str
|
||||
spacegroup: str
|
||||
@ -393,10 +380,6 @@ class Results(BaseModel):
|
||||
unique_refl: int
|
||||
comments: Optional[constr(max_length=200)] = None
|
||||
|
||||
# Define attributes for Results here
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ContactCreate(BaseModel):
|
||||
pgroups: str
|
||||
@ -822,6 +805,21 @@ class ImageInfo(BaseModel):
|
||||
id: int
|
||||
filepath: str
|
||||
comment: Optional[str] = None
|
||||
event_type: str
|
||||
# run_number: Optional[int]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class characterizationParameters(BaseModel):
|
||||
omegaStart_deg: float
|
||||
oscillation_deg: float
|
||||
omegaStep: float
|
||||
chi: float
|
||||
phi: float
|
||||
numberOfImages: int
|
||||
exposureTime_s: float
|
||||
|
||||
|
||||
class RotationParameters(BaseModel):
|
||||
@ -882,6 +880,7 @@ class BeamlineParameters(BaseModel):
|
||||
beamSizeWidth: Optional[float] = None
|
||||
beamSizeHeight: Optional[float] = None
|
||||
# dose_MGy: float
|
||||
characterization: Optional[characterizationParameters] = None
|
||||
rotation: Optional[RotationParameters] = None
|
||||
gridScan: Optional[gridScanParamers] = None
|
||||
jet: Optional[jetParameters] = None
|
||||
@ -922,15 +921,18 @@ class SampleResult(BaseModel):
|
||||
|
||||
class ResultCreate(BaseModel):
|
||||
sample_id: int
|
||||
result_id: int
|
||||
result: Optional[dict]
|
||||
run_id: int
|
||||
result: Results
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ResultResponse(BaseModel):
|
||||
id: int
|
||||
sample_id: int
|
||||
result_id: int
|
||||
result: Optional[dict]
|
||||
run_id: int
|
||||
result: Results
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
Reference in New Issue
Block a user