refactor!: drop never-real dcp fields, deprecate the unused ones
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
DataCollectionParameters cleanup (AareDB audit 2026-09-08, 12,494 prod samples + consumer grep across AareDAQ / AareProc / AareDB): Removed — early-development leftovers, never populated, read by nothing; the beamlines have no aperture: aperture, rescutkey, rescutvalue, trustedhigh, chiphiangles. Stored blobs still carrying the keys are ignored on input (extra keys are dropped), not rejected. Deprecated (Field(deprecated=...), warn on access, flagged in the JSON schema; removed next major): autoprocfull, procfull, adpenabled, ffcscampaign, datacollectiontype — never set by users, no consumer; the stored values are importer-era noise (false / 'standard'). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GPer4T34EcvqVJGpeiEJ4Y
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
39d7ae8dd3
commit
8267b704df
@@ -68,29 +68,34 @@ class DataCollectionParameters(BaseModel):
|
||||
transmission: Annotated[float, Field(ge=0.0, le=1.0)] | None = None
|
||||
targetresolution: float | None = None # Only accept positive float
|
||||
beamsize: str | None = None
|
||||
aperture: int | None = None # Optional string field
|
||||
datacollectiontype: str | None = (
|
||||
None # Only accept "standard", other types might be added later
|
||||
# Deprecated (2026-09): only ever held "standard" and nothing reads it.
|
||||
datacollectiontype: str | None = Field(
|
||||
default=None, deprecated="datacollectiontype is unused and will be removed"
|
||||
)
|
||||
processingpipeline: str | None = "" # Only accept "gopy", "autoproc", "xia2dials"
|
||||
spacegroupnumber: int | None = None # Only accept positive integers between 1 and 230
|
||||
unitcell: str | None = Field( # was cellparameters
|
||||
default=None, validation_alias=AliasChoices("unitcell", "cellparameters")
|
||||
) # Must be a set of six positive floats or integers
|
||||
rescutkey: str | None = None # Only accept "is" or "cchalf"
|
||||
rescutvalue: float | None = None # Must be a positive float if rescutkey is provided
|
||||
processingresolution: float | None = Field( # was userresolution
|
||||
default=None, validation_alias=AliasChoices("processingresolution", "userresolution")
|
||||
)
|
||||
pdbid: str | None = "" # Accepts either the format of the protein data bank code or {provided}
|
||||
autoprocfull: bool | None = None
|
||||
procfull: bool | None = None
|
||||
adpenabled: bool | None = None
|
||||
# Deprecated (2026-09): never set by users, read by no consumer (AareDAQ /
|
||||
# AareProc / AareDB); the importer used to default them to False. Removed
|
||||
# in the next major once the stored blobs have been cleaned.
|
||||
autoprocfull: bool | None = Field(
|
||||
default=None, deprecated="autoprocfull is unused and will be removed"
|
||||
)
|
||||
procfull: bool | None = Field(default=None, deprecated="procfull is unused and will be removed")
|
||||
adpenabled: bool | None = Field(
|
||||
default=None, deprecated="adpenabled is unused and will be removed"
|
||||
)
|
||||
noano: bool | None = None
|
||||
ffcscampaign: bool | None = None
|
||||
trustedhigh: float | None = None # Should be a float between 0 and 2.0
|
||||
ffcscampaign: bool | None = Field(
|
||||
default=None, deprecated="ffcscampaign is unused and will be removed"
|
||||
)
|
||||
autoprocextraparams: str | None = None # Optional string field
|
||||
chiphiangles: float | None = None # Optional float field between 0 and 30
|
||||
dose: float | None = None # Optional float field
|
||||
cloud: bool = True
|
||||
pdbmodel: str | None = None
|
||||
|
||||
@@ -39,11 +39,6 @@ def test_directory_accepts_valid_macros():
|
||||
assert params.directory == "{date}/{prefix}/run"
|
||||
|
||||
|
||||
def test_aperture_accepts_float_string():
|
||||
params = DataCollectionParameters(aperture="2.0")
|
||||
assert params.aperture == 2
|
||||
|
||||
|
||||
def test_processingpipeline_accepts_unknown_value_after_refactor():
|
||||
params = DataCollectionParameters(processingpipeline="xia2")
|
||||
assert params.processingpipeline == "xia2"
|
||||
@@ -94,3 +89,29 @@ def test_transmission_rejects_percent_scale_values():
|
||||
def test_transmission_rejects_negative_values():
|
||||
with pytest.raises(ValidationError):
|
||||
DataCollectionParameters(transmission=-0.1)
|
||||
|
||||
|
||||
def test_removed_fields_are_ignored_on_input():
|
||||
# aperture / rescutkey / rescutvalue / trustedhigh / chiphiangles were early-
|
||||
# development leftovers (the beamlines have no aperture) that nothing ever
|
||||
# read; stored blobs still carry the keys, so they must be ignored, not rejected.
|
||||
params = DataCollectionParameters(
|
||||
aperture="50um", rescutkey="isig", rescutvalue=2.0, trustedhigh=1.0, chiphiangles=5.0
|
||||
)
|
||||
for name in ("aperture", "rescutkey", "rescutvalue", "trustedhigh", "chiphiangles"):
|
||||
assert name not in DataCollectionParameters.model_fields
|
||||
assert not hasattr(params, name)
|
||||
|
||||
|
||||
def test_deprecated_fields_still_validate_but_warn():
|
||||
params = DataCollectionParameters(
|
||||
autoprocfull=False,
|
||||
procfull=False,
|
||||
adpenabled=False,
|
||||
ffcscampaign=False,
|
||||
datacollectiontype="standard",
|
||||
)
|
||||
for name in ("autoprocfull", "procfull", "adpenabled", "ffcscampaign", "datacollectiontype"):
|
||||
assert DataCollectionParameters.model_fields[name].deprecated
|
||||
with pytest.warns(DeprecationWarning):
|
||||
getattr(params, name)
|
||||
|
||||
Reference in New Issue
Block a user