Added function to check conditions before generating insights