Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effect weight fields should be mutually exclusive #53

Open
nebfield opened this issue Oct 7, 2024 · 0 comments
Open

Effect weight fields should be mutually exclusive #53

nebfield opened this issue Oct 7, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nebfield
Copy link
Member

nebfield commented Oct 7, 2024

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 ?

@nebfield nebfield added the enhancement New feature or request label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant