in tooling/enrichment/firestore_client.py [0:0]
def is_product_processed(self, product_id):
"""Check if a product has already been processed successfully."""
doc_ref = self.collection.document(str(product_id))
doc = doc_ref.get()
if doc.exists:
status = doc.to_dict().get('status')
retry_count = doc.to_dict().get('retry_count', 0)
# Return True if completed or failed too many times
return status == 'completed' or retry_count >= 3
return False