added error recognition in spreadsheet

This commit is contained in:
GotthardG
2024-11-07 10:10:53 +01:00
parent eed50aa942
commit 8f82a3b7fe
5 changed files with 165 additions and 59 deletions

View File

@ -1,5 +1,6 @@
import re
from typing import Any, Optional
from typing import Any, Optional, List, Dict
from pydantic import BaseModel, Field, field_validator
from typing_extensions import Annotated
@ -267,4 +268,17 @@ class SpreadsheetModel(BaseModel):
username: str
puck_number: int
prefix: Optional[str]
folder: Optional[str]
folder: Optional[str]
class SpreadsheetResponse(BaseModel):
data: List[SpreadsheetModel] # Validated data rows as SpreadsheetModel instances
errors: List[Dict[str, Any]] # Errors encountered during validation
raw_data: List[Dict[str, Any]] # Raw data extracted from the spreadsheet
dewars_count: int
dewars: List[str]
pucks_count: int
pucks: List[str]
samples_count: int
samples: List[str]
__all__ = ['SpreadsheetModel', 'SpreadsheetResponse']