Created
February 14, 2023 20:48
-
-
Save Geczy/f84eb31f2a18f361c4eb409b60aaf505 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def has_passed_spe(unit_validation_df): | |
spe_tested = unit_validation_df['spe_ucn'] | |
last_spe_accepted = unit_validation_df['last_spe_accepted_by_algo'] | |
last_spe_days = unit_validation_df['days_since_last_spe'] | |
last_spe_recent = last_spe_days <= 120 | |
validation_conditions = { | |
'spe_passed': spe_tested & unit_validation_df['SPE_accepted_by_algo'], | |
'second_spe_passed': spe_tested & ~unit_validation_df['SPE_accepted_by_algo'] & unit_validation_df['second_spe_passed'], | |
'not_past_due': ~unit_validation_df['last_spe_is_past_due'], | |
'last_spe_passed_recent': ~spe_tested & last_spe_accepted & last_spe_recent, | |
'second_spe_passed_recent': ~spe_tested & ~last_spe_accepted & unit_validation_df['second_spe_passed'] & last_spe_recent | |
} | |
for condition in validation_conditions.values(): | |
if condition.any(): | |
return True | |
return False | |
valid_associated_spe = has_passed_spe(unit_validation_df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment