fixing bugs with ci pipeline

This commit is contained in:
GotthardG
2024-12-16 22:50:04 +01:00
parent e0e176881b
commit 0178de96fd
14 changed files with 145 additions and 96 deletions

View File

@ -15,7 +15,8 @@ class SpreadsheetModel(BaseModel):
...,
max_length=64,
title="Crystal Name",
description="max_length imposed by MTZ file header format https://www.ccp4.ac.uk/html/mtzformat.html",
description="max_length imposed by MTZ file header"
"format https://www.ccp4.ac.uk/html/mtzformat.html",
alias="crystalname",
),
]
@ -27,31 +28,31 @@ class SpreadsheetModel(BaseModel):
oscillation: Optional[float] = None # Only accept positive float
exposure: Optional[float] = None # Only accept positive floats between 0 and 1
totalrange: Optional[int] = None # Only accept positive integers between 0 and 360
transmission: Optional[int] = (
None # Only accept positive integers between 0 and 100
)
transmission: Optional[
int
] = None # Only accept positive integers between 0 and 100
targetresolution: Optional[float] = None # Only accept positive float
aperture: Optional[str] = None # Optional string field
datacollectiontype: Optional[str] = (
None # Only accept "standard", other types might be added later
)
processingpipeline: Optional[str] = (
"" # Only accept "gopy", "autoproc", "xia2dials"
)
spacegroupnumber: Optional[int] = (
None # Only accept positive integers between 1 and 230
)
cellparameters: Optional[str] = (
None # Must be a set of six positive floats or integers
)
datacollectiontype: Optional[
str
] = None # Only accept "standard", other types might be added later
processingpipeline: Optional[
str
] = "" # Only accept "gopy", "autoproc", "xia2dials"
spacegroupnumber: Optional[
int
] = None # Only accept positive integers between 1 and 230
cellparameters: Optional[
str
] = None # Must be a set of six positive floats or integers
rescutkey: Optional[str] = None # Only accept "is" or "cchalf"
rescutvalue: Optional[float] = (
None # Must be a positive float if rescutkey is provided
)
rescutvalue: Optional[
float
] = None # Must be a positive float if rescutkey is provided
userresolution: Optional[float] = None
pdbid: Optional[str] = (
"" # Accepts either the format of the protein data bank code or {provided}
)
pdbid: Optional[
str
] = "" # Accepts either the format of the protein data bank code or {provided}
autoprocfull: Optional[bool] = None
procfull: Optional[bool] = None
adpenabled: Optional[bool] = None
@ -206,11 +207,13 @@ class SpreadsheetModel(BaseModel):
v = int(v)
if not (0 <= v <= 360):
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 0 and 360."
f" '{v}' is not valid."
f"Value must be an integer between 0 and 360."
)
except (ValueError, TypeError) as e:
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 0 and 360."
f" '{v}' is not valid."
f"Value must be an integer between 0 and 360."
) from e
return v
@ -222,11 +225,13 @@ class SpreadsheetModel(BaseModel):
v = int(v)
if not (0 <= v <= 100):
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 0 and 100."
f" '{v}' is not valid."
f"Value must be an integer between 0 and 100."
)
except (ValueError, TypeError) as e:
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 0 and 100."
f" '{v}' is not valid."
f"Value must be an integer between 0 and 100."
) from e
return v
@ -235,7 +240,7 @@ class SpreadsheetModel(BaseModel):
def datacollectiontype_allowed(cls, v):
allowed = {"standard"} # Other types of data collection might be added later
if v and v.lower() not in allowed:
raise ValueError(f" '{v}' is not valid. Value must be one of {allowed}.")
raise ValueError(f" '{v}' is not valid." f"Value must be one of {allowed}.")
return v
@field_validator("processingpipeline", mode="before")
@ -243,7 +248,7 @@ class SpreadsheetModel(BaseModel):
def processingpipeline_allowed(cls, v):
allowed = {"gopy", "autoproc", "xia2dials"}
if v and v.lower() not in allowed:
raise ValueError(f" '{v}' is not valid. Value must be one of {allowed}.")
raise ValueError(f" '{v}' is not valid." f"Value must be one of {allowed}.")
return v
@field_validator("spacegroupnumber", mode="before")
@ -254,11 +259,13 @@ class SpreadsheetModel(BaseModel):
v = int(v)
if not (1 <= v <= 230):
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 1 and 230."
f" '{v}' is not valid."
f"Value must be an integer between 1 and 230."
)
except (ValueError, TypeError) as e:
raise ValueError(
f" '{v}' is not valid. Value must be an integer between 1 and 230."
f" '{v}' is not valid."
f"Value must be an integer between 1 and 230."
) from e
return v
@ -269,7 +276,8 @@ class SpreadsheetModel(BaseModel):
values = [float(i) for i in v.split(",")]
if len(values) != 6 or any(val <= 0 for val in values):
raise ValueError(
f" '{v}' is not valid. Value must be a set of six positive floats or integers."
f" '{v}' is not valid."
f"Value must be a set of six positive floats or integers."
)
return v
@ -295,11 +303,13 @@ class SpreadsheetModel(BaseModel):
v = float(v)
if not (0 <= v <= 2.0):
raise ValueError(
f" '{v}' is not valid. Value must be a float between 0 and 2.0."
f" '{v}' is not valid."
f"Value must be a float between 0 and 2.0."
)
except (ValueError, TypeError) as e:
raise ValueError(
f" '{v}' is not valid. Value must be a float between 0 and 2.0."
f" '{v}' is not valid."
f"Value must be a float between 0 and 2.0."
) from e
return v
@ -311,7 +321,8 @@ class SpreadsheetModel(BaseModel):
v = float(v)
if not (0 <= v <= 30):
raise ValueError(
f" '{v}' is not valid. Value must be a float between 0 and 30."
f" '{v}' is not valid."
f"Value must be a float between 0 and 30."
)
except (ValueError, TypeError) as e:
raise ValueError(