Merge pull request #93 from SDSRV-IDP/trungpt/minor_fix
update average processing time
This commit is contained in:
commit
98b3e3953e
@ -46,7 +46,8 @@ class ReportAccumulateByRequest:
|
||||
},
|
||||
'average_processing_time': {
|
||||
'imei': IterAvg(),
|
||||
'invoice': IterAvg()
|
||||
'invoice': IterAvg(),
|
||||
'avg': IterAvg(),
|
||||
},
|
||||
'usage': {
|
||||
'imei':0,
|
||||
@ -92,7 +93,8 @@ class ReportAccumulateByRequest:
|
||||
},
|
||||
'average_processing_time': {
|
||||
'imei': IterAvg(),
|
||||
'invoice': IterAvg()
|
||||
'invoice': IterAvg(),
|
||||
'avg': IterAvg(),
|
||||
},
|
||||
'usage': {
|
||||
'imei': 0,
|
||||
@ -145,6 +147,7 @@ class ReportAccumulateByRequest:
|
||||
print(f"[WARM]: Weird doctype: {report_file.doc_type}")
|
||||
total["average_processing_time"][report_file.doc_type] = IterAvg()
|
||||
total["average_processing_time"][report_file.doc_type].add_avg(report_file.time_cost, 1) if report_file.time_cost else 0
|
||||
total["average_processing_time"]["avg"].add_avg(report_file.time_cost, 1) if report_file.time_cost else 0
|
||||
|
||||
doc_type = "imei"
|
||||
if report_file.doc_type in ["imei", "invoice", "all"]:
|
||||
@ -184,6 +187,7 @@ class ReportAccumulateByRequest:
|
||||
print(f"[WARM]: Weird doctype: {report_file.doc_type}")
|
||||
day_data["average_processing_time"][report_file.doc_type] = IterAvg()
|
||||
day_data["average_processing_time"][report_file.doc_type].add_avg(report_file.time_cost, 1) if report_file.time_cost else 0
|
||||
day_data["average_processing_time"]['avg'].add_avg(report_file.time_cost, 1) if report_file.time_cost else 0
|
||||
day_data["review_progress"].append(report_file.review_status)
|
||||
return day_data
|
||||
|
||||
@ -248,6 +252,7 @@ class ReportAccumulateByRequest:
|
||||
|
||||
_average_OCR_time["invoice"] = 0 if _average_OCR_time["invoice"] is None else _average_OCR_time["invoice"]
|
||||
_average_OCR_time["imei"] = 0 if _average_OCR_time["imei"] is None else _average_OCR_time["imei"]
|
||||
if "avg" not in _average_OCR_time:
|
||||
_average_OCR_time["avg"] = (_average_OCR_time["invoice"]*_average_OCR_time["invoice_count"] + _average_OCR_time["imei"]*_average_OCR_time["imei_count"])/(_average_OCR_time["imei_count"] + _average_OCR_time["invoice_count"]) if (_average_OCR_time["imei_count"] + _average_OCR_time["invoice_count"]) > 0 else None
|
||||
acumulated_acc = {"feedback_accuracy": {},
|
||||
"reviewed_accuracy": {}}
|
||||
|
@ -495,9 +495,8 @@ def dict2xlsx(input: json, _type='report'):
|
||||
'N': 'average_accuracy_rate.purchase_date',
|
||||
'O': 'average_accuracy_rate.retailer_name',
|
||||
'P': 'average_accuracy_rate.invoice_number',
|
||||
'Q': 'average_processing_time.imei',
|
||||
'R': 'average_processing_time.invoice',
|
||||
'S': 'review_progress'
|
||||
'Q': 'average_processing_time.avg',
|
||||
'R': 'review_progress'
|
||||
}
|
||||
start_index = 5
|
||||
|
||||
|
Binary file not shown.
@ -63,8 +63,8 @@ services:
|
||||
- AUTH_TOKEN_LIFE_TIME=${AUTH_TOKEN_LIFE_TIME}
|
||||
- IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME}
|
||||
- INTERNAL_SDS_KEY=${INTERNAL_SDS_KEY}
|
||||
- ADMIN_USER_NAME=${ADMIN_USER_NAME}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
- ADMIN_USER_NAME=${FI_USER_NAME}
|
||||
- ADMIN_PASSWORD=${FI_PASSWORD}
|
||||
- STANDARD_USER_NAME=${STANDARD_USER_NAME}
|
||||
- STANDARD_PASSWORD=${STANDARD_PASSWORD}
|
||||
- S3_ENDPOINT=${S3_ENDPOINT}
|
||||
@ -89,12 +89,7 @@ services:
|
||||
depends_on:
|
||||
db-sbt:
|
||||
condition: service_started
|
||||
command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
|
||||
python manage.py makemigrations &&
|
||||
python manage.py migrate &&
|
||||
python manage.py compilemessages &&
|
||||
gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
|
||||
# command: bash -c "tail -f > /dev/null"
|
||||
command: "sleep infinity"
|
||||
|
||||
minio:
|
||||
image: minio/minio
|
||||
@ -196,7 +191,7 @@ services:
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||
- POSTGRES_DB=${DB_SCHEMA}
|
||||
ports:
|
||||
- 5432:5432
|
||||
- 15432:5432
|
||||
|
||||
rabbitmq-sbt:
|
||||
mem_reservation: 600m
|
||||
@ -209,46 +204,46 @@ services:
|
||||
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
|
||||
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
|
||||
|
||||
# Front-end services
|
||||
fe-sbt:
|
||||
restart: always
|
||||
build:
|
||||
context: cope2n-fe
|
||||
shm_size: 10gb
|
||||
dockerfile: Dockerfile
|
||||
image: sidp/cope2n-fe-fi-sbt:latest
|
||||
shm_size: 10gb
|
||||
privileged: true
|
||||
ports:
|
||||
- 9881:80
|
||||
depends_on:
|
||||
be-ctel-sbt:
|
||||
condition: service_started
|
||||
be-celery-sbt:
|
||||
condition: service_started
|
||||
environment:
|
||||
- VITE_PROXY=http://be-ctel-sbt:${BASE_PORT}
|
||||
- VITE_API_BASE_URL=http://fe-sbt:80
|
||||
volumes:
|
||||
- BE_static:/backend-static
|
||||
networks:
|
||||
- ctel-sbt
|
||||
# # Front-end services
|
||||
# fe-sbt:
|
||||
# restart: always
|
||||
# build:
|
||||
# context: cope2n-fe
|
||||
# shm_size: 10gb
|
||||
# dockerfile: Dockerfile
|
||||
# image: sidp/cope2n-fe-fi-sbt:latest
|
||||
# shm_size: 10gb
|
||||
# privileged: true
|
||||
# ports:
|
||||
# - 9881:80
|
||||
# depends_on:
|
||||
# be-ctel-sbt:
|
||||
# condition: service_started
|
||||
# be-celery-sbt:
|
||||
# condition: service_started
|
||||
# environment:
|
||||
# - VITE_PROXY=http://be-ctel-sbt:${BASE_PORT}
|
||||
# - VITE_API_BASE_URL=http://fe-sbt:80
|
||||
# volumes:
|
||||
# - BE_static:/backend-static
|
||||
# networks:
|
||||
# - ctel-sbt
|
||||
|
||||
dashboard_refresh:
|
||||
build:
|
||||
context: api-cronjob
|
||||
dockerfile: Dockerfile
|
||||
image: sidp/api-caller-sbt:latest
|
||||
environment:
|
||||
- PROXY=http://be-ctel-sbt:9000
|
||||
- ADMIN_USER_NAME=${ADMIN_USER_NAME}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
depends_on:
|
||||
be-ctel-sbt:
|
||||
condition: service_healthy
|
||||
restart: always
|
||||
networks:
|
||||
- ctel-sbt
|
||||
# dashboard_refresh:
|
||||
# build:
|
||||
# context: api-cronjob
|
||||
# dockerfile: Dockerfile
|
||||
# image: sidp/api-caller-sbt:latest
|
||||
# environment:
|
||||
# - PROXY=http://be-ctel-sbt:9000
|
||||
# - ADMIN_USER_NAME=${ADMIN_USER_NAME}
|
||||
# - ADMIN_PASSWORD=${ADMIN_PASSWORD}
|
||||
# depends_on:
|
||||
# be-ctel-sbt:
|
||||
# condition: service_healthy
|
||||
# restart: always
|
||||
# networks:
|
||||
# - ctel-sbt
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
|
Loading…
Reference in New Issue
Block a user