sbt-idp/cope2n-api
2024-07-22 10:34:43 +07:00
..
EDA Add logging 2024-06-26 14:58:24 +07:00
env_sample Add: BE, FE 2023-11-30 18:19:06 +07:00
fwd Update: Imei with maximum 14 characters 2024-07-22 10:34:43 +07:00
fwd_api Update: Imei with maximum 14 characters 2024-07-22 10:34:43 +07:00
locale Fix: false aggregate results 2023-12-26 21:07:19 +07:00
scripts Fix: #61 2024-03-04 15:38:38 +07:00
static Feature: feedback csv API 2024-01-11 18:27:34 +07:00
billing_report.xlsx update write file 2024-03-06 16:32:50 +07:00
celery_config.txt Update: API, logic 2024-05-17 19:39:31 +07:00
dev.docker-compose.yml.dev Add: BE, FE 2023-11-30 18:19:06 +07:00
docker-compose.yml Add: BE, FE 2023-11-30 18:19:06 +07:00
docker-persistent.yml Add: BE, FE 2023-11-30 18:19:06 +07:00
Dockerfile Update: API, logic 2024-05-17 19:39:31 +07:00
Dockerfile-dev Add: BE, FE 2023-11-30 18:19:06 +07:00
Dockerfile.base Merged from vietanh99, Add APIs 2024-01-31 10:00:18 +07:00
manage.py Add: BE, FE 2023-11-30 18:19:06 +07:00
modified.txt Update: API, logic 2024-05-17 19:39:31 +07:00
README.md Add: README 2024-07-17 17:45:44 +07:00
report_detail.xlsx change detail report format 2024-04-02 13:12:21 +07:00
report.xlsx Roll back old report format 2024-03-22 10:31:55 +07:00
requirements.txt WIP on main: 782d99a Merge branch 'main' of https://code.sdsdev.co.kr/SDSRV-IDP/sbt-idp into main 2024-06-11 14:22:17 +07:00
TODO.md Add: BE, FE 2023-11-30 18:19:06 +07:00

Project AI Backend for Frontend

1. Run DB and RabbitMQ (skip ì you already install)

docker compose -f docker-persistent up --build

2. Migrate Database Schema ( If needed )

1.1 Make migration file python manage.py makemigrations

1.2 Apply to database python manage.py migrate

3. Run Project

2.1 Run with Docker

2.1.1 Add file .env at same folder level with docker-compose.yml.

Sample at env_sample/example_{OS}_env (Window / Linux)

2.1.2 Build & Run Image By Command

docker compose up --build

2.2 Local Development Run

2.2.1 Add file .env at same folder level with docker-compose.yml.

Sample at env_sample/example_local_env

2.2.2 Run API

python manage.py runserver 0.0.0.0:8000

2.2.3 Run Worker

celery -A fwd_api.proj.worker worker -l INFO --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo

Feature

Semi correction

API URL: /api/automation/

Exclaimer: This process will overwrite all request files (images) reason and counter measure with the provided rule

How to use

Example: subsidiary: SESP
Invoice_Purchase Date_Accuracy: 100%
Invoice_Sold_To_Party_OCR: != ""
Invoice_Retailer_OCR: Samsung Brand Store
Reason to fill: Wrong Feedback
Counter Measure: Update revised resutl and re-calculate accuracy
The config would be as following

  {
    "subsidiary": "SESP",
    "predict_result": {
      "retailername": "Samsung Brand Store",
      "sold_to_party": "notEmpty"
    },
    "feedback_accuracy": {
      "purchase_date": 1
    },
    "reason": "Wrong Feedback",
    "counter_measures": "Update revised result and re-calculate accuracy"
  },

Supported special commands: ["<", "Empty", "notEmpty", "starts_with"]
To use the commands with values, you need to sperate it with the value by || for example: "<||1.0" means <100% and "starts_with||Shopee" means Shopee*

Modify a duration with a rule:

curl -X 'POST' \
  '<server_url>/api/automation/<rule_id>/scan/' \
  -H 'accept: application/json' \
  -H 'Authorization: <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "start_date": "2024-05-17T07:27:19.087Z",
  "end_date": "2024-07-17T07:27:19.087Z"
}'

To get the list of URLS:

curl -X 'GET' \
  '<server_url>/api/automation/' \
  -H 'accept: application/json' \
  -H 'Authorization: <token>'

More infomation, please refer to the swagger page