done adding invoice_no
This commit is contained in:
parent
565e2c52a6
commit
b278350cf2
@ -135,9 +135,8 @@ def process_csv_feedback(csv_file_path, feedback_id):
|
||||
|
||||
else:
|
||||
try:
|
||||
_predict_result = {"retailername": None, "sold_to_party": None, "purchase_date": [], "imei_number": [_predict_result["imei_number"][image.index_in_request]]}
|
||||
_feedback_result = {"retailername": None, "sold_to_party": None, "purchase_date": None, "imei_number": [_feedback_result["imei_number"][image.index_in_request]]} if _feedback_result else None
|
||||
# _reviewed_result = {"retailername": None, "sold_to_party": None, "purchase_date": None, "imei_number": [_reviewed_result["imei_number"][image.index_in_request]]} if _reviewed_result else None
|
||||
_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
|
||||
except Exception as e:
|
||||
print (f"[ERROR]: {request_id} - {e}")
|
||||
image.predict_result = _predict_result
|
||||
|
@ -112,18 +112,20 @@ def create_accuracy_report(report_id, **kwargs):
|
||||
request.feedback_accuracy = {"imei_number": mean_list(request_att["acc"]["feedback"].get("imei_number", [None])),
|
||||
"purchase_date": mean_list(request_att["acc"]["feedback"].get("purchase_date", [None])),
|
||||
"retailername": mean_list(request_att["acc"]["feedback"].get("retailername", [None])),
|
||||
"sold_to_party": mean_list(request_att["acc"]["feedback"].get("sold_to_party", [None]))}
|
||||
"sold_to_party": mean_list(request_att["acc"]["feedback"].get("sold_to_party", [None])),
|
||||
"invoice_no": mean_list(request_att["acc"]["feedback"].get("invoice_no", [None]))}
|
||||
request.reviewed_accuracy = {"imei_number": mean_list(request_att["acc"]["reviewed"].get("imei_number", [None])),
|
||||
"purchase_date": mean_list(request_att["acc"]["reviewed"].get("purchase_date", [None])),
|
||||
"retailername": mean_list(request_att["acc"]["reviewed"].get("retailername", [None])),
|
||||
"sold_to_party": mean_list(request_att["acc"]["reviewed"].get("sold_to_party", [None]))}
|
||||
"sold_to_party": mean_list(request_att["acc"]["reviewed"].get("sold_to_party", [None])),
|
||||
"invoice_no": mean_list(request_att["acc"]["reviewed"].get("invoice_no", [None]))}
|
||||
request.save()
|
||||
number_images += request_att["total_images"]
|
||||
number_bad_images += request_att["bad_images"]
|
||||
bad_image_list += request_att["bad_image_list"]
|
||||
update_temp_accuracy(accuracy["feedback"], request_att["acc"]["feedback"], keys=["imei_number", "purchase_date", "retailername", "sold_to_party"])
|
||||
update_temp_accuracy(accuracy["reviewed"], request_att["acc"]["reviewed"], keys=["imei_number", "purchase_date", "retailername", "sold_to_party"])
|
||||
update_temp_accuracy(accuracy["acumulated"], request_att["acc"]["acumulated"], keys=["imei_number", "purchase_date", "retailername", "sold_to_party"])
|
||||
update_temp_accuracy(accuracy["feedback"], request_att["acc"]["feedback"], keys=["imei_number", "purchase_date", "invoice_no", "retailername", "sold_to_party"])
|
||||
update_temp_accuracy(accuracy["reviewed"], request_att["acc"]["reviewed"], keys=["imei_number", "purchase_date", "invoice_no", "retailername", "sold_to_party"])
|
||||
update_temp_accuracy(accuracy["acumulated"], request_att["acc"]["acumulated"], keys=["imei_number", "purchase_date", "invoice_no", "retailername", "sold_to_party"])
|
||||
|
||||
time_cost["imei"].add(request_att["time_cost"].get("imei", []))
|
||||
time_cost["invoice"].add(request_att["time_cost"].get("invoice", []))
|
||||
@ -233,7 +235,7 @@ def create_billing_report(report_id, **kwargs):
|
||||
"reviewed": {},
|
||||
"acumulated": {}}
|
||||
for acc_type in ["feedback", "reviewed", "acumulated"]:
|
||||
for key in ["imei_number", "purchase_date", "retailername", "sold_to_party"]:
|
||||
for key in ["imei_number", "purchase_date", "invoice_no", "retailername", "sold_to_party"]:
|
||||
acumulated_acc[acc_type][key] = None
|
||||
acumulated_acc[acc_type][key + "_count"] = None
|
||||
acumulated_acc[acc_type]["avg"] = None
|
||||
|
@ -540,23 +540,20 @@ def extract_report_detail_list(report_detail_list, lower=False, in_percent=True)
|
||||
"Image type": report_file.doc_type,
|
||||
"IMEI_user submitted": first_of_list(report_file.feedback_result.get("imei_number", [None])),
|
||||
"IMEI_OCR retrieved": first_of_list(report_file.predict_result.get("imei_number", [None])),
|
||||
"IMEI Revised": None,
|
||||
"IMEI Revised": first_of_list(report_file.reviewed_result.get("imei_number", [None])),
|
||||
"IMEI1 Accuracy": first_of_list(report_file.feedback_accuracy.get("imei_number", [None])),
|
||||
"Invoice_Number_User": None,
|
||||
"Invoice_Number_OCR": None,
|
||||
"Invoice_Number Revised": None,
|
||||
"Invoice_Number_Accuracy": None,
|
||||
"Invoice_Number_User": report_file.feedback_result.get("invoice_no", None),
|
||||
"Invoice_Number_OCR": report_file.predict_result.get("invoice_no", None),
|
||||
"Invoice_Number Revised": report_file.reviewed_result.get("invoice_no", None),
|
||||
"Invoice_Number_Accuracy": first_of_list(report_file.feedback_accuracy.get("invoice_no", [None])),
|
||||
"Invoice_Purchase Date_Consumer": report_file.feedback_result.get("purchase_date", None),
|
||||
"Invoice_Purchase Date_OCR": report_file.predict_result.get("purchase_date", []),
|
||||
"Invoice_Purchase Date Revised": None,
|
||||
"Invoice_Purchase Date Revised": report_file.reviewed_result.get("purchase_date", None),
|
||||
"Invoice_Purchase Date Accuracy": first_of_list(report_file.feedback_accuracy.get("purchase_date", [None])),
|
||||
"Invoice_Retailer_Consumer": report_file.feedback_result.get("retailername", None),
|
||||
"Invoice_Retailer_OCR": report_file.predict_result.get("retailername", None),
|
||||
"Invoice_Purchase Date Revised": None,
|
||||
"Invoice_Retailer Revised": report_file.reviewed_result.get("retailername", None),
|
||||
"Invoice_Retailer Accuracy": first_of_list(report_file.feedback_accuracy.get("retailername", [None])),
|
||||
"Invoice_No_Consumer": report_file.feedback_result.get("invoice_no", None),
|
||||
"Invoice_No_OCR": report_file.predict_result.get("invoice_no", None),
|
||||
"Invoice_No Accuracy": first_of_list(report_file.feedback_accuracy.get("invoice_no", [None])),
|
||||
"OCR Image Accuracy": report_file.acc,
|
||||
"OCR Image Speed (seconds)": report_file.time_cost,
|
||||
"Is Reviewed": report_file.is_reviewed,
|
||||
@ -565,7 +562,7 @@ def extract_report_detail_list(report_detail_list, lower=False, in_percent=True)
|
||||
"IMEI_Revised Accuracy": first_of_list(report_file.reviewed_accuracy.get("imei_number", [None])),
|
||||
"Purchase Date_Revised Accuracy": first_of_list(report_file.reviewed_accuracy.get("purchase_date", [None])),
|
||||
"Retailer_Revised Accuracy": first_of_list(report_file.reviewed_accuracy.get("retailername", [None])),
|
||||
"Invoice_No_Revised Accuracy": first_of_list(report_file.reviewed_accuracy.get("invoice_no", [None]))
|
||||
"Invoice_Number_Revised Accuracy": first_of_list(report_file.reviewed_accuracy.get("invoice_no", [None]))
|
||||
})
|
||||
if lower:
|
||||
for i, dat in enumerate(data):
|
||||
@ -644,12 +641,6 @@ def align_fine_result(ready_predict, fine_result):
|
||||
if ready_predict["invoice_no"] and not fine_result["invoice_no"]:
|
||||
fine_result["invoice_no"] = [None]
|
||||
fine_result["purchase_date"] = [fine_result["purchase_date"] for _ in range(len(ready_predict["purchase_date"]))]
|
||||
# fine_result["retailername"] = None if len(ready_predict["purchase_date"]))]
|
||||
# else:
|
||||
# fine_result = {}
|
||||
# for key in ready_predict.keys():
|
||||
# fine_result[key] = []
|
||||
# fine_result["purchase_date"] = [None for _ in range(len(ready_predict["purchase_date"]))]
|
||||
return ready_predict, fine_result
|
||||
|
||||
def update_temp_accuracy(accuracy, acc, keys):
|
||||
|
Loading…
Reference in New Issue
Block a user