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:
GotthardG
2025-05-06 11:28:36 +02:00
parent 102a11eed7
commit 4328b84795
10 changed files with 222 additions and 28 deletions

View File

@ -425,6 +425,7 @@ def create_result(payload: ResultCreate, db: Session = Depends(get_db)):
result_entry = ResultsModel(
sample_id=payload.sample_id,
status=payload.status,
run_id=payload.run_id,
result=payload.result.model_dump(), # Serialize entire result to JSON
)
@ -435,6 +436,7 @@ def create_result(payload: ResultCreate, db: Session = Depends(get_db)):
return ResultResponse(
id=result_entry.id,
status=result_entry.status,
sample_id=result_entry.sample_id,
run_id=result_entry.run_id,
result=payload.result, # return original payload directly