diff --git a/cope2n-api/fwd/settings.py b/cope2n-api/fwd/settings.py index a57387a..86d4832 100755 --- a/cope2n-api/fwd/settings.py +++ b/cope2n-api/fwd/settings.py @@ -307,4 +307,6 @@ REASON_SOLUTION_MAP = {"Invalid image": "Remove this image from the evaluation r "Handwritten": "Remove this image from the evaluation report", "Wrong feedback": "Update revised resutl and re-calculate accuracy", "Ocr cannot extract": "Improve OCR", - } \ No newline at end of file + } + +IMEI_MAX_LENGHT = 14 \ No newline at end of file diff --git a/cope2n-api/fwd_api/utils/ocr_utils/sbt_report.py b/cope2n-api/fwd_api/utils/ocr_utils/sbt_report.py index d742c33..cf77f21 100644 --- a/cope2n-api/fwd_api/utils/ocr_utils/sbt_report.py +++ b/cope2n-api/fwd_api/utils/ocr_utils/sbt_report.py @@ -5,6 +5,7 @@ import time import json import glob import shutil +from django.conf import settings import pandas as pd from tqdm import tqdm from pathlib import Path @@ -64,6 +65,9 @@ def post_processing_str(class_name: str, s: str, is_gt: bool, sub: str) -> str: s = convert_datetime_format(s) if class_name == "retailername": s = normalise_retailer_name(s, sub) + if class_name == "imei_number" and isinstance(s, str): + if len(s) > settings.IMEI_MAX_LENGHT: + s = s[:settings.IMEI_MAX_LENGHT] return s