diff --git a/cope2n-ai-fi/common/utils_kvu/split_docs.py b/cope2n-ai-fi/common/utils_kvu/split_docs.py index c20d10d..495e099 100755 --- a/cope2n-ai-fi/common/utils_kvu/split_docs.py +++ b/cope2n-ai-fi/common/utils_kvu/split_docs.py @@ -107,9 +107,9 @@ def merge_sbt_output(loutputs): merged_output = [] combined_output = {"retailername": None, "sold_to_party": None, - "invoice_no": None, "purchase_date": [], - "imei_number": []} # place holder for the output + "imei_number": [], + "invoice_no": None} # place holder for the output for output in loutputs: fields = output['fields'] if "doc_type" not in output: # Should not contain more than 1 page diff --git a/cope2n-api/fwd_api/celery_worker/process_result_tasks.py b/cope2n-api/fwd_api/celery_worker/process_result_tasks.py index da03539..331e7f1 100755 --- a/cope2n-api/fwd_api/celery_worker/process_result_tasks.py +++ b/cope2n-api/fwd_api/celery_worker/process_result_tasks.py @@ -29,8 +29,9 @@ def aggregate_result(results): des_result["content"]["total_pages"] = 0 des_result["content"]["ocr_num_pages"] = 0 des_result["content"]["document"][0]["end_page"] = 0 - des_result["content"]["document"][0]["content"][4]["value"] = [None for _ in range(doc_types.count("imei"))] - des_result["content"]["document"][0]["content"][3]["value"] = [] + des_result["content"]["document"][0]["content"][2]["value"] = [] + des_result["content"]["document"][0]["content"][3]["value"] = [None for _ in range(doc_types.count("imei"))] + imei_count = 0 for doc_type, result in sorted_results: @@ -38,14 +39,14 @@ def aggregate_result(results): des_result["content"]["ocr_num_pages"] += 1 des_result["content"]["document"][0]["end_page"] += 1 if doc_type == "imei": - if len(result["content"]["document"][0]["content"][4]["value"]): - des_result["content"]["document"][0]["content"][4]["value"][imei_count] = result["content"]["document"][0]["content"][4]["value"][0] + if len(result["content"]["document"][0]["content"][3]["value"]): + des_result["content"]["document"][0]["content"][3]["value"][imei_count] = result["content"]["document"][0]["content"][3]["value"][0] imei_count += 1 elif doc_type == "invoice": des_result["content"]["document"][0]["content"][0]["value"] = result["content"]["document"][0]["content"][0]["value"] des_result["content"]["document"][0]["content"][1]["value"] = result["content"]["document"][0]["content"][1]["value"] - des_result["content"]["document"][0]["content"][2]["value"] = result["content"]["document"][0]["content"][2]["value"] - des_result["content"]["document"][0]["content"][3]["value"] += result["content"]["document"][0]["content"][3]["value"] + des_result["content"]["document"][0]["content"][4]["value"] = result["content"]["document"][0]["content"][4]["value"] + des_result["content"]["document"][0]["content"][2]["value"] += result["content"]["document"][0]["content"][2]["value"] elif doc_type == "all": des_result.update(result) else: @@ -142,7 +143,6 @@ def process_invoice_sbt_result(rq_id, result, metadata): global random_processor_name if random_processor_name is None: random_processor_name = uuid.uuid4() - print(rq_id, random_processor_name) print_id(f"[DEBUG]: Received SBT request with id {rq_id}") try: page_index = int(rq_id.split("_sub_")[1])