38 lines
1.7 KiB
Python
Executable File
38 lines
1.7 KiB
Python
Executable File
from django.db import models
|
|
|
|
from fwd_api.constant.common import FileCategory
|
|
from fwd_api.models import SubscriptionRequest
|
|
from fwd_api.models.fields.EncryptedCharField import EncryptedCharField
|
|
from django.utils import timezone
|
|
import uuid
|
|
|
|
|
|
class SubscriptionRequestFile(models.Model):
|
|
def gen_random_code():
|
|
return f"FIL{uuid.uuid4().hex}"
|
|
|
|
code = models.CharField(max_length=300, default=gen_random_code)
|
|
origin_name = models.CharField(max_length=300, default="")
|
|
file_name = models.CharField(max_length=300, default=None)
|
|
file_path = EncryptedCharField(max_length=500, default=None)
|
|
file_category = models.CharField(max_length=200, default=FileCategory.Origin.value)
|
|
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)
|
|
is_bad_image_quality = models.BooleanField(default=False)
|
|
doc_type = models.CharField(max_length=10, default="")
|
|
index_in_request = models.IntegerField(default=0) # by doc_type
|
|
processing_time = models.FloatField(default=-1) # in milisecond
|
|
reason = models.TextField(blank=True)
|
|
counter_measures = models.TextField(blank=True)
|
|
is_reviewed = models.BooleanField(default=False)
|
|
is_required = models.BooleanField(default=True)
|
|
# subsidiary = models.CharField(default="", null=True, max_length=200) # save already in SubscriptionRequest
|
|
|
|
predict_result = models.JSONField(null=True)
|
|
feedback_result = models.JSONField(null=True)
|
|
reviewed_result = models.JSONField(null=True)
|
|
|
|
feedback_accuracy = models.JSONField(null=True)
|
|
reviewed_accuracy = models.JSONField(null=True)
|