Skip to content

Commit

Permalink
Demo: updated validator to use new method to more easily build condit…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
sebastian-echeverria committed Oct 3, 2024
1 parent 6894570 commit fa40461
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 43 deletions.
4 changes: 1 addition & 3 deletions demo/scenarios/values/multiple_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class MultipleAccuracy(Array):
@classmethod
def all_accuracies_more_or_equal_than(cls, threshold: float) -> Condition:
"""Checks if the accuracy for multiple populations is fair by checking if all of them are over the given threshold."""
condition: Condition = Condition(
"all_accuracies_more_than",
[threshold],
condition: Condition = Condition.build_condition(
lambda value: Success(
f"All accuracies are equal to or over threshold {threshold}"
)
Expand Down
4 changes: 1 addition & 3 deletions demo/scenarios/values/multiple_ranksums.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def deserialize(
@classmethod
def all_p_values_greater_or_equal_than(cls, threshold: float) -> Condition:
"""Checks if the p-value for multiple ranksums is below given threshold."""
condition: Condition = Condition(
"all_p_values_greater_or_equal_than",
[threshold],
condition: Condition = Condition.build_condition(
lambda value: Success(
f"All p-values are equal to or over threshold {value.get_total_p_value_threshold(threshold)}"
)
Expand Down
28 changes: 0 additions & 28 deletions demo/scenarios/values/operational_performance.py

This file was deleted.

4 changes: 1 addition & 3 deletions demo/scenarios/values/ranksums.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class RankSums(Array):

@classmethod
def p_value_greater_or_equal_to(cls, threshold: float) -> Condition:
condition: Condition = Condition(
"p_value_greater_or_equal_to",
[threshold],
condition: Condition = Condition.build_condition(
lambda value: Success(
f"P-Value {value.array[1]} is greater or equal to {threshold}"
)
Expand Down
8 changes: 2 additions & 6 deletions demo/scenarios/values/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def deserialize(
@classmethod
def contains(cls, substring: str) -> Condition:
"""Checks if the p-value for multiple ranksums is below given threshold."""
condition: Condition = Condition(
"contains",
[substring],
condition: Condition = Condition.build_condition(
lambda value: Success(
f"Substring '{substring}' is contained in the string value."
)
Expand All @@ -50,9 +48,7 @@ def contains(cls, substring: str) -> Condition:
@classmethod
def equal_to(cls, other_string: str) -> Condition:
"""Checks if the p-value for multiple ranksums is below given threshold."""
condition: Condition = Condition(
"equal_to",
[other_string],
condition: Condition = Condition.build_condition(
lambda value: Success(
f"String '{other_string}' is equal to the internal string value."
)
Expand Down

0 comments on commit fa40461

Please sign in to comment.