diff --git a/cope2n-ai-fi/modules/sdsvkvu b/cope2n-ai-fi/modules/sdsvkvu index b6d4fab..6907ea0 160000 --- a/cope2n-ai-fi/modules/sdsvkvu +++ b/cope2n-ai-fi/modules/sdsvkvu @@ -1 +1 @@ -Subproject commit b6d4fab46f7f8689dd6b050cfbff2faa6a6f3fec +Subproject commit 6907ea0183b141e3b4f3c21758c9123f1e9b2a27 diff --git a/cope2n-api/fwd_api/management/commands/migrate-csv.py b/cope2n-api/fwd_api/management/commands/migrate-csv.py index 2be1be0..ddb63d1 100644 --- a/cope2n-api/fwd_api/management/commands/migrate-csv.py +++ b/cope2n-api/fwd_api/management/commands/migrate-csv.py @@ -53,14 +53,14 @@ class Command(BaseCommand): is_match = True if field == 'imei_number': - if not reviewed_result == request_review: + if not reviewed_result in request_review["imei_number"]: request_review["imei_number"].append(reviewed_result) - if not user_feedback == request_feedback: + if not user_feedback in request_feedback["imei_number"]: request_feedback["imei_number"].append(user_feedback) else: - if not reviewed_result == request_review: + if not reviewed_result == request_review[field]: request_review[field] = reviewed_result - if not user_feedback == request_feedback: + if not user_feedback == request_feedback[field]: request_feedback[field] = user_feedback _predict_result = copy.deepcopy(predict_result_to_ready(request.predict_result)) diff --git a/cope2n-api/fwd_api/utils/file.py b/cope2n-api/fwd_api/utils/file.py index 4b5e55e..c5094fb 100644 --- a/cope2n-api/fwd_api/utils/file.py +++ b/cope2n-api/fwd_api/utils/file.py @@ -443,20 +443,21 @@ def dict2xlsx(input: json, _type='report'): mapping = { 'A': 'subs', 'B': 'extraction_date', - 'C': 'num_imei', - 'D': 'num_invoice', - 'E': 'total_images', - 'F': 'images_quality.successful', - 'G': 'images_quality.successful_percent', - 'H': 'images_quality.bad', - 'I': 'images_quality.bad_percent', - 'J': 'average_accuracy_rate.imei', - 'K': 'average_accuracy_rate.purchase_date', - 'L': 'average_accuracy_rate.retailer_name', - 'M': 'average_processing_time.imei', - 'N': 'average_processing_time.invoice', - 'O': 'usage.imei', - 'P': 'usage.invoice', + 'C': 'usage.total_images', + 'D': 'usage.imei', + 'E': 'usage.invoice', + 'F': 'total_images', + 'G': 'num_imei', + 'H': 'num_invoice', + 'I': 'images_quality.successful', + 'J': 'images_quality.successful_percent', + 'K': 'images_quality.bad', + 'L': 'images_quality.bad_percent', + 'M': 'average_accuracy_rate.imei', + 'N': 'average_accuracy_rate.purchase_date', + 'O': 'average_accuracy_rate.retailer_name', + 'P': 'average_processing_time.imei', + 'Q': 'average_processing_time.invoice', } start_index = 5 @@ -464,26 +465,27 @@ def dict2xlsx(input: json, _type='report'): wb = load_workbook(filename = 'report_detail.xlsx') ws = wb['Sheet1'] mapping = { - 'A': 'request_id', - 'B': 'redemption_number', - 'C': 'image_type', - 'D': 'imei_user_submitted', - 'E': "imei_ocr_retrieved", - 'F': "imei1_accuracy", - 'G': "invoice_purchase_date_consumer", - 'H': "invoice_purchase_date_ocr", - 'I': "invoice_purchase_date_accuracy", - 'J': "invoice_retailer_consumer", - 'K': "invoice_retailer_ocr", - 'L': "invoice_retailer_accuracy", - 'M': "ocr_image_accuracy", - 'N': "ocr_image_speed", - 'O': "is_reviewed", - 'P': "bad_image_reasons", - 'Q': "countermeasures", - 'R': 'imei_revised_accuracy', - 'S': 'purchase_date_revised_accuracy', - 'T': 'retailer_revised_accuracy', + 'A': 'subs', + 'B': 'request_id', + 'C': 'redemption_number', + 'D': 'image_type', + 'E': 'imei_user_submitted', + 'F': "imei_ocr_retrieved", + 'G': "imei1_accuracy", + 'H': "invoice_purchase_date_consumer", + 'I': "invoice_purchase_date_ocr", + 'J': "invoice_purchase_date_accuracy", + 'K': "invoice_retailer_consumer", + 'L': "invoice_retailer_ocr", + 'M': "invoice_retailer_accuracy", + 'N': "ocr_image_accuracy", + 'O': "ocr_image_speed", + 'P': "is_reviewed", + 'Q': "bad_image_reasons", + 'R': "countermeasures", + 'S': 'imei_revised_accuracy', + 'T': 'purchase_date_revised_accuracy', + 'U': 'retailer_revised_accuracy', } start_index = 4 @@ -497,7 +499,7 @@ def dict2xlsx(input: json, _type='report'): if subtotal['subs'] == '+': ws[key + str(start_index)].font = font_black_bold if key_index in [6, 8, 9, 10, 11, 12, 13]: - ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00 + ws[key + str(start_index)].number_format = '0.0' if key_index == 0 or (key_index >= 9 and key_index <= 15): ws[key + str(start_index)].fill = fill_gray elif key_index == 1: @@ -506,25 +508,27 @@ def dict2xlsx(input: json, _type='report'): ws[key + str(start_index)].fill = fill_yellow else: if 'average_accuracy_rate' in mapping[key] and type(value) in [int, float]: - if value < 95: + if value < 98: ws[key + str(start_index)].style = normal_cell_red - ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00 + ws[key + str(start_index)].number_format = '0.0' elif 'average_processing_time' in mapping[key] and type(value) in [int, float]: if value > 2.0: ws[key + str(start_index)].style = normal_cell_red - ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00 + ws[key + str(start_index)].number_format = '0.0' elif 'bad_percent' in mapping[key] and type(value) in [int, float]: if value > 10: ws[key + str(start_index)].style = normal_cell_red - ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00 + ws[key + str(start_index)].number_format = '0.0' elif 'percent' in mapping[key] and type(value) in [int, float]: - ws[key + str(start_index)].number_format = numbers.FORMAT_NUMBER_00 + ws[key + str(start_index)].number_format = '0.0' else : ws[key + str(start_index)].style = normal_cell elif _type == 'report_detail': if 'accuracy' in mapping[key] and type(value) in [int, float] and value < 75: + ws[key + str(start_index)].number_format = '0.0' ws[key + str(start_index)].style = normal_cell_red elif 'speed' in mapping[key] and type(value) in [int, float] and value > 2.0: + ws[key + str(start_index)].number_format = '0.0' ws[key + str(start_index)].style = normal_cell_red else: ws[key + str(start_index)].style = normal_cell diff --git a/cope2n-api/report.xlsx b/cope2n-api/report.xlsx index fc5b37d..a7fa7e2 100644 Binary files a/cope2n-api/report.xlsx and b/cope2n-api/report.xlsx differ diff --git a/cope2n-api/report_detail.xlsx b/cope2n-api/report_detail.xlsx index 6850d8e..566defc 100644 Binary files a/cope2n-api/report_detail.xlsx and b/cope2n-api/report_detail.xlsx differ