From 965fa8e9cad5df0403d523c8debd2de08ec23d68 Mon Sep 17 00:00:00 2001 From: dx-tan Date: Wed, 24 Jan 2024 14:14:33 +0700 Subject: [PATCH] Update: table design --- .gitmodules | 3 +++ cope2n-api/fwd_api/models/Report.py | 17 +++++++++++------ .../fwd_api/models/SubscriptionRequest.py | 4 ++++ .../fwd_api/models/SubscriptionRequestFile.py | 7 +++++-- cope2n-api/fwd_api/utils/sdsvkvu | 1 + 5 files changed, 24 insertions(+), 8 deletions(-) create mode 160000 cope2n-api/fwd_api/utils/sdsvkvu diff --git a/.gitmodules b/.gitmodules index 3d4203a..1198d96 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "cope2n-ai-fi/modules/sdsvkvu"] path = cope2n-ai-fi/modules/sdsvkvu url = https://code.sdsdev.co.kr/SDSRV-IDP/sdsvkvu.git +[submodule "cope2n-api/fwd_api/utils/sdsvkvu"] + path = cope2n-api/fwd_api/utils/sdsvkvu + url = https://code.sdsdev.co.kr/SDSRV-IDP/sdsvkvu diff --git a/cope2n-api/fwd_api/models/Report.py b/cope2n-api/fwd_api/models/Report.py index b5bfa8d..ef03c59 100644 --- a/cope2n-api/fwd_api/models/Report.py +++ b/cope2n-api/fwd_api/models/Report.py @@ -3,24 +3,29 @@ from django.utils import timezone from fwd_api.models.Subscription import Subscription class Report(models.Model): + # Metadata id = models.AutoField(primary_key=True) report_id = models.CharField(max_length=200) # Change to request_id local_file_name = models.CharField(max_length=200) # Change to request_id - origin_name = models.CharField(max_length=200) # Change to request_id error_status = models.JSONField(null=True) created_at = models.DateTimeField(default=timezone.now, db_index=True) updated_at = models.DateTimeField(auto_now=True) - subscription = models.ForeignKey(Subscription, on_delete=models.CASCADE) - S3_uploaded = models.BooleanField(default=False) start_at = models.DateTimeField(null=True) end_at = models.DateTimeField(null=True) include_for_test_sample = models.BooleanField(default=False) status = models.CharField(null=True) + is_daily_report = models.BooleanField(default=False) + + # Data + S3_uploaded = models.BooleanField(default=False) number_request = models.IntegerField(default=0) number_images = models.IntegerField(default=0) number_bad_images = models.IntegerField(default=0) average_client_time_profile = models.JSONField(default=0) # {"0.1": 100, 0.2: 200, ...} average_OCR_time_profile = models.JSONField(default=0) # {"0.1": 98, 0.2: 202, ...} - average_OCR_time = models.FloatField(default=0) # {"0.1": 98, 0.2: 202, ...} - average_client_time = models.FloatField(default=0) # {"0.1": 98, 0.2: 202, ...} - accuracy = models.JSONField(null=True) # {"imei": {}, "purchase_date": {}, "retailer_name": {}} \ No newline at end of file + average_OCR_time = models.JSONField(null=True) # {"invoice": 0.1, "imei": 0.1} + average_client_time = models.JSONField(null=True) # {"invoice": 0.1, "imei": 0.1} + imei_accuracy = models.FloatField(default=-1) + purchase_date_accuracy = models.FloatField(default=-1) + retailer_name_accuracy = models.FloatField(default=-1) + sold_to_party_accuracy = models.FloatField(default=-1) \ No newline at end of file diff --git a/cope2n-api/fwd_api/models/SubscriptionRequest.py b/cope2n-api/fwd_api/models/SubscriptionRequest.py index 62d70ec..3839c3a 100755 --- a/cope2n-api/fwd_api/models/SubscriptionRequest.py +++ b/cope2n-api/fwd_api/models/SubscriptionRequest.py @@ -21,6 +21,10 @@ class SubscriptionRequest(models.Model): updated_at = models.DateTimeField(auto_now=True) is_test_request = models.BooleanField(default=False) S3_uploaded = models.BooleanField(default=False) + imei_accuracy = models.FloatField(default=-1) + purchase_date_accuracy = models.FloatField(default=-1) + retailer_name_accuracy = models.FloatField(default=-1) + sold_to_party_accuracy = models.FloatField(default=-1) ai_inference_profile = models.JSONField(null=True) preprocessing_time = models.FloatField(default=-1) diff --git a/cope2n-api/fwd_api/models/SubscriptionRequestFile.py b/cope2n-api/fwd_api/models/SubscriptionRequestFile.py index bcb1d36..6293421 100755 --- a/cope2n-api/fwd_api/models/SubscriptionRequestFile.py +++ b/cope2n-api/fwd_api/models/SubscriptionRequestFile.py @@ -19,10 +19,13 @@ class SubscriptionRequestFile(models.Model): request = models.ForeignKey(SubscriptionRequest, related_name="files", on_delete=models.CASCADE) created_at = models.DateTimeField(default=timezone.now, db_index=True) updated_at = models.DateTimeField(auto_now=True) - accuracy = models.JSONField(null=True) is_bad_image_quality = models.BooleanField(default=False) doc_type = models.CharField(max_length=100, default="") index_in_request = models.IntegerField(default=0) processing_time = models.IntegerField(default=-1) # in milisecond reason = models.TextField(blank=True) - counter_measures = models.TextField(blank=True) \ No newline at end of file + counter_measures = models.TextField(blank=True) + imei_accuracy = models.FloatField(default=-1) + purchase_date_accuracy = models.FloatField(default=-1) + retailer_name_accuracy = models.FloatField(default=-1) + sold_to_party_accuracy = models.FloatField(default=-1) \ No newline at end of file diff --git a/cope2n-api/fwd_api/utils/sdsvkvu b/cope2n-api/fwd_api/utils/sdsvkvu new file mode 160000 index 0000000..b6d4fab --- /dev/null +++ b/cope2n-api/fwd_api/utils/sdsvkvu @@ -0,0 +1 @@ +Subproject commit b6d4fab46f7f8689dd6b050cfbff2faa6a6f3fec