tiki-deprecated / platform-cap-receipt

Upload receipts for free OCR processing
https://mytiki.com/solutions/receipt-ocr
GNU Affero General Public License v3.0
0 stars 0 forks source link

Fix the output format #18

Closed ricardobrg closed 1 week ago

ricardobrg commented 6 months ago

Reason

The output format should have a simpler structure

Description

Currently the lineitemgroups structure looks like this:

{
  "LineItemGroups": [
    {
      "LineItemGroupIndex": 1,
      "LineItems": [
        {
          "LineItemExpenseFields": [
            {
              "PRODUCT_CODE": {
                "confidenceKey": 91.53479,
                "confidenceValue": 91.41411,
                "value": "647658036793"
              },
              "ITEM": null,
              "PRICE": null,
              "EXPENSE_ROW": null
            },
            {
              "PRODUCT_CODE": null,
              "ITEM": {
                "confidenceKey": 99.543,
                "confidenceValue": 99.20062,
                "value": "CNCL 2002 HOLIDAY"
              },
              "PRICE": null,
              "EXPENSE_ROW": null
            },
            {
              "PRODUCT_CODE": null,
              "ITEM": null,
              "PRICE": {
                "confidenceKey": 99.499245,
                "confidenceValue": 99.487785,
                "value": "6.00"
              },
              "EXPENSE_ROW": null
            },
            {
              "PRODUCT_CODE": null,
              "ITEM": null,
              "PRICE": null,
              "EXPENSE_ROW": null
            },
            {
              "PRODUCT_CODE": null,
              "ITEM": null,
              "PRICE": null,
              "EXPENSE_ROW": {
                "confidenceKey": 91.68216,
                "confidenceValue": 91.39553,
                "value": "CNCL 2002 HOLIDAY 647658036793 19.99 6.00 P\n6.00"
              }
            }
          ]
        },

But it should remove the nulls and aggregate the lineitems data in one field, like this:

"LineItemGroups": [
    {
      "LineItemGroupIndex": 1,
      "LineItems": [
        {
          "LineItemExpenseFields": [
            {
              "PRODUCT_CODE": {
                "confidenceKey": 91.53479,
                "confidenceValue": 91.41411,
                "value": "647658036793"
              },

Success Criteria

Additional Information

No response