Add spreadsheet enhancements and default handling

Implemented a toggleable spreadsheet UI component for sample data, added fields such as priority and comments, and improved backend validation. Default values for "directory" are now assigned when missing, with feedback highlighted in green on the front end.
This commit is contained in:
GotthardG
2025-01-06 14:40:02 +01:00
parent 9cb6ffbfb4
commit 54975b5919
12 changed files with 436 additions and 134 deletions

View File

@ -1,5 +1,4 @@
# Adjusting the ShipmentProcessor for better error handling and alignment
from sqlalchemy.orm import Session
from app.models import Shipment, Dewar, Puck, Sample, DataCollectionParameters
from app.schemas import ShipmentCreate, ShipmentResponse
@ -47,14 +46,17 @@ class ShipmentProcessor:
self.db.refresh(puck)
for sample_data in puck_data.samples:
data_collection_params = DataCollectionParameters(
data_collection_parameters = DataCollectionParameters(
**sample_data.data_collection_parameters.dict(by_alias=True)
)
sample = Sample(
puck_id=puck.id,
sample_name=sample_data.sample_name,
proteinname=sample_data.proteinname,
position=sample_data.position,
data_collection_parameters=data_collection_params,
priority=sample_data.priority,
comments=sample_data.comments,
data_collection_parameters=data_collection_parameters,
)
self.db.add(sample)
self.db.commit()