sbt-idp/cope2n-api/fwd_api/models/Report.py
2024-03-26 16:26:10 +07:00

50 lines
2.5 KiB
Python
Executable File

from django.db import models
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
error_status = models.JSONField(null=True)
created_at = models.DateTimeField(default=timezone.now, db_index=True)
updated_at = models.DateTimeField(auto_now=True)
start_at = models.DateTimeField(null=True)
end_at = models.DateTimeField(null=True)
include_for_test_sample = models.BooleanField(default=False)
status = models.CharField(max_length=100)
is_daily_report = models.BooleanField(default=False)
errors = models.TextField(default="", null=True)
subsidiary = models.CharField(default="", null=True, max_length=200)
include_reviewed = models.TextField(default="", null=True, )
include_test = models.CharField(max_length=200, default="")
# Data
S3_uploaded = models.BooleanField(default=False)
S3_file_name = models.TextField(default=None, null=True)
S3_dashboard_file_name = models.TextField(default=None, null=True)
number_request = models.IntegerField(default=0)
number_images = models.IntegerField(default=0)
number_bad_images = models.IntegerField(default=0)
number_imei = models.IntegerField(default=0)
number_invoice = models.IntegerField(default=0)
num_reviewed = models.IntegerField(default=0)
num_not_reviewed = models.IntegerField(default=0)
num_no_reviewed = models.IntegerField(default=0)
number_imei_transaction = models.IntegerField(default=0)
number_invoice_transaction = models.IntegerField(default=0)
average_client_time_profile = models.JSONField(null=True) # {"0.1": 100, 0.2: 200, ...} | Future feature
average_OCR_time_profile = models.JSONField(null=True) # {"0.1": 98, 0.2: 202, ...} | Future feature
average_OCR_time = models.JSONField(null=True) # {"invoice": 0.1, "imei": 0.1} | Future feature
average_client_time = models.JSONField(null=True) # {"invoice": 0.1, "imei": 0.1}
feedback_accuracy = models.JSONField(null=True)
reviewed_accuracy = models.JSONField(null=True)
combined_accuracy = models.JSONField(null=True)
report_type = models.CharField(max_length=10, choices=[
("BILLING", "billing"), ("ACCURACY", "accuracy")], default="accuracy")