I have a json file where I have extracted data of some entities including line_item. And I have a Image(Invoice) and OCR textract output in csv format containing these columns (page_num,block_num,line_num,word_num,left,right,top,bottom,width,height,conf,text,image_height,image_width) .
Now I want to map all the line item on image from json using ocr output. And create bounding box for each line_items and Print those bounding box on image.
A sample json output :
{
    "invoice_details": {
        "invoice_number": "2268",
        "invoice_date": "10-Dec-2020",
        "invoice_due_date": "None",
        "order_id": "None",
        "vendor_name": "",
        "buyer_name": "",
        "shipto_name": "None"
    },
    "Payment Details": {
        "vendor_ifsccode": "",
        "vendor_bankname": "",
        "account_number": ""
    },
    "address_details": {
        "vendor_address": "",
        "billto_address": "",
        "shipto_address": ""
    },
    "amounts_and_tax": {
        "Subtotal_or_taxable_amount": "",
        "total_sgst_amount": "",
        "total_cgst_amount": "",
        "total_igst_amount": "None",
        "total_amount_after_tax": "",
        "billto_GSTIN": "",
        "vendor_GSTIN": "",
        "shipto_GSTIN": "None"
    },
    "line_items": [
        {
            "hsn_code": "8443",
            "description": "Hp 1606 Pressure Roller",
            "unit_of_measurement_or_uom": "NOS",
            "unit_price": "750.00",
            "quantity": "3",
            "sgst_rate": "None",
            "sgst_amount": "None",
            "cgst_rate": "None",
            "cgst_amount": "None",
            "igst_rate": "None",
            "igst_amount": "None",
            "taxable_amount_or_subtotal": "2250.00",
            "total_amount_or_gross_amount_of_the_item": "None"
        },
        {
            "hsn_code": "8443",
            "description": "Teflon 1010 (OG)",
            "unit_of_measurement_or_uom": "NOS",
            "unit_price": "800.00",
            "quantity": "3",
            "sgst_rate": "None",
            "sgst_amount": "None",
            "cgst_rate": "None",
            "cgst_amount": "None",
            "igst_rate": "None",
            "igst_amount": "None",
            "taxable_amount_or_subtotal": "2400.00",
            "total_amount_or_gross_amount_of_the_item": "None"
        },
        {
            "hsn_code": "84439959",
            "description": "Pick Up Roll 1606",
            "unit_of_measurement_or_uom": "NOS",
            "unit_price": "250.00",
            "quantity": "3",
            "sgst_rate": "None",
            "sgst_amount": "None",
            "cgst_rate": "None",
            "cgst_amount": "None",
            "igst_rate": "None",
            "igst_amount": "None",
            "taxable_amount_or_subtotal": "750.00",
            "total_amount_or_gross_amount_of_the_item": "None"
        },
        {
            "hsn_code": "8443",
            "description": "Hp 1606 Lower Bush",
            "unit_of_measurement_or_uom": "NOS",
            "unit_price": "250.00",
            "quantity": "2",
            "sgst_rate": "None",
            "sgst_amount": "None",
            "cgst_rate": "None",
            "cgst_amount": "None",
            "igst_rate": "None",
            "igst_amount": "None",
            "taxable_amount_or_subtotal": "500.00",
            "total_amount_or_gross_amount_of_the_item": "None"
        },
        {
            "hsn_code": "8443",
            "description": "1505 /1606 Fuser Drive Gear",
            "unit_of_measurement_or_uom": "NOS",
            "unit_price": "250.00",
            "quantity": "1",
            "sgst_rate": "None",
            "sgst_amount": "None",
            "cgst_rate": "None",
            "cgst_amount": "None",
            "igst_rate": "None",
            "igst_amount": "None",
            "taxable_amount_or_subtotal": "250.00",
            "total_amount_or_gross_amount_of_the_item": "None"
        }
    ],
    "table_column_names_in_reading_order": "Sl No.,Description of Goods,HSN/SAC,Quantity,Rate,per,Disc. %,Amount"
}
You have to write a dynamic python code to map bounding box.