Compare recipe: prevent accepting blank annotation

It seems that prodigy allows annotators to accept blank annotation, e.g. not selecting an option in compare recipe. Does prodigy provide a callback when annotators do an action?

Thanks for the support :'D

Yes, it sounds like what you're looking for is the validate_answer callback: https://prodi.gy/docs/custom-recipes#validate_answer

This lets you define a Python function that runs every time an answer is submitted and receives the full JSON data. You can then raise custom errors that are shown as alerts in the UI. So if you're using the multiple choice interface, you can do something like this to ensure that a selection was made:

def validate_answer(eg):
    if not eg.get("accept", []):
        raise ValueError("Please select one option.")