Skip to content

Commit

Permalink
check for missing predictions file before validating
Browse files Browse the repository at this point in the history
  • Loading branch information
vpchung committed May 1, 2024
1 parent 8d7dcab commit 7fb0c1e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ def main():
"""Main function."""
args = get_args()

invalid_reasons = validate(
gold_file=args.goldstandard_file,
pred_file=args.predictions_file
)
if "INVALID" in args.predictions_file:
with open(args.predictions_file, encoding="utf-8") as f:
errors = [f.read()]
else:
errors = validate(
gold_file=args.goldstandard_file,
pred_file=args.predictions_file
)

invalid_reasons = "\n".join(filter(None, invalid_reasons))
invalid_reasons = "\n".join(filter(None, errors))
status = "INVALID" if invalid_reasons else "VALIDATED"

# truncate validation errors if >500 (character limit for sending email)
Expand Down

0 comments on commit 7fb0c1e

Please sign in to comment.