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

Plan the receipt data schema #3

Closed MiroBenicio closed 6 months ago

MiroBenicio commented 6 months ago

Reason

Define a readable return to the client

Description

We should analyze the data that comes from amazon text extract and define how we gonna process it and what is the schema that the client side will receive It should be a JSON that has all core information from the receipt

Success Criteria

Additional Information

No response

MiroBenicio commented 6 months ago

this value (the cleaned json):

{
  ...
  "Type": {
    "Confidence": 92.48912,
    "Text": "PRODUCT_CODE"
  },
  "ValueDetection": {
    "Confidence": 92.48831,
    "Text": "020108870398"
  }
  ...
}

should become this:

{
... 
    "PRODUCT_CODE": { 
        "confidenceKey": 92.48912,
        "confidenceValye": 92.48831 ,
        "value": "020108870398"
    }
...
}
MiroBenicio commented 6 months ago
ReceiptExtract {
    DocumentMetadata: {
        Pages: number;
    };
    ExpenseDocuments: {
        Blocks:         
        [{
                Confidence: number;
                Text:       string;
        }];
        ExpenseIndex:   number;
        LineItemGroups: [{
            LineItemGroupIndex: number;
            LineItems:          [
                [{
                    LineItemExpenseFields: [
                        {
                            PRODUCT_CODE?: {
                                confidenceKey:   number;
                                confidenceValue: number;
                                value:           string;
                            };
                            ITEM?:         {
                                confidenceKey:   number;
                                confidenceValue: number;
                                value:           string;
                            };
                            PRICE?:        {
                                confidenceKey:   number;
                                confidenceValue: number;
                                value:           string;
                            };
                            EXPENSE_ROW?:  {
                                confidenceKey:   number;
                                confidenceValue: number;
                                value:           string;
                            };
                        }
                    ]
                }]
            ];
        }];
        SummaryFields:  [ {
            key: string: {
            confidenceKey:   number;
            confidenceValue: number;
            value:           string;
        }}];
    };
}