Skip to content

Effect weight fields should be mutually exclusive #53

@nebfield

Description

@nebfield

re: PGS002253 discussions

@model_validator(mode="after")
def check_effect_weights(self) -> Self:
match (
self.effect_weight,
self.dosage_0_weight,
self.dosage_1_weight,
self.dosage_2_weight,
):
case None, None, None, None:
raise ValueError("All effect weight fields are missing")
case None, zero, one, two if any(x is None for x in (zero, one, two)):
raise ValueError("Dosage missing effect weight")
case _:
return self

If effect_weight and dosage_0... columns are both present, a ValueError should be raised in the CatalogScoreVariant model, right @smlmbrt ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions