From 4682bf67de88f9ccd2c801176499be2f3b3ef112 Mon Sep 17 00:00:00 2001 From: dx-tan Date: Mon, 20 May 2024 11:07:39 +0700 Subject: [PATCH] Remove: feedback validation --- cope2n-api/fwd_api/celery_worker/internal_task.py | 4 ++-- cope2n-api/fwd_api/utils/accuracy.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cope2n-api/fwd_api/celery_worker/internal_task.py b/cope2n-api/fwd_api/celery_worker/internal_task.py index ec53777..90a7a68 100755 --- a/cope2n-api/fwd_api/celery_worker/internal_task.py +++ b/cope2n-api/fwd_api/celery_worker/internal_task.py @@ -127,7 +127,7 @@ def process_csv_feedback(csv_file_path, feedback_id): print(f"[ERROR] image.doc_type: {image.doc_type} - image.index_in_request: {image.index_in_request} - time_cost: {time_cost} - {e}") if not validate_feedback_file(_feedback_result, _predict_result): status[request_id] = "Missalign imei number between feedback and predict" - continue + # continue if image.doc_type == "invoice": _predict_result["imei_number"] = [] if _feedback_result: @@ -136,7 +136,7 @@ def process_csv_feedback(csv_file_path, feedback_id): else: try: _predict_result = {"retailername": None, "sold_to_party": None, "invoice_no": None, "purchase_date": [], "imei_number": [_predict_result["imei_number"][image.index_in_request]]} - _feedback_result = {"retailername": None, "sold_to_party": None, "invoice_no": None, "purchase_date": None, "imei_number": [_feedback_result["imei_number"][image.index_in_request]]} if _feedback_result else None + _feedback_result = {"retailername": None, "sold_to_party": None, "invoice_no": None, "purchase_date": None, "imei_number": [_feedback_result["imei_number"][image.index_in_request]]} if _feedback_result and len(_feedback_result["imei_number"]) > image.index_in_request else None except Exception as e: print (f"[ERROR]: {request_id} - {e}") image.predict_result = _predict_result diff --git a/cope2n-api/fwd_api/utils/accuracy.py b/cope2n-api/fwd_api/utils/accuracy.py index 1d5e938..a45e435 100755 --- a/cope2n-api/fwd_api/utils/accuracy.py +++ b/cope2n-api/fwd_api/utils/accuracy.py @@ -529,6 +529,7 @@ def validate_feedback_file(feedback, predict): num_imei_predict = len(predict.get("imei_number", [])) if num_imei_feedback != num_imei_predict: return False + feedback["imei_number"] = imei_feedback return True def first_of_list(the_list):