Skip to content

Commit

Permalink
Updated date formatting with testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpandit committed Sep 24, 2024
1 parent 9c6262d commit 2a03879
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
58 changes: 29 additions & 29 deletions source/backend/api_parsing_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -25,12 +25,12 @@
"{\n",
" \"message\": \"Togekiss logged in successfully.\"\n",
"}\n",
"<RequestsCookieJar[<Cookie session=.eJwlzjEOwjAMQNG7ZGaIHdeOew52lMQ2VAxILZ0QdycS89OX_ifdYvfjkdb3fvol3TZLayLskCkyj8agS1ciZ5JaW3SRilBcaywcylhY1B0CbSh3YpxdVSM07FlYDEaZ2rgheORCZarlHCWYu4K1jgKOjiS2aCvNRpoj5-H7_-b6uvtzO470_QGoMzGk.ZtJHig.lcF5gX8kv7VCH9pKAdFuLB_gSIU for receiptplus.pythonanywhere.com/>]>\n"
"<RequestsCookieJar[<Cookie session=.eJwlzjsOwjAMANC7ZGaIE3_inoO9ShwbKgaklk6Iu4PEO8F7pzV2P-5pee2nX9K6zbSk6Vq6ozGGWBOqNYLYmTtWb6J1RHfrw40VfFIW02mTug6LHEXZHKiKYi44EEitZVBtJCrAozEy1QaTG2jh8Nxr7jAwZ0JRTb_Iefj-31yfN39sx5E-X0bRMZg.ZvIKkg.aAXznj52OCD3YdsVflQ5sjdGhiA for 127.0.0.1/>]>\n"
]
}
],
"source": [
"url = 'https://receiptplus.pythonanywhere.com/api/login'\n",
"url = 'http://127.0.0.1:5000/api/login'\n",
"returning_user = {'user_id':'Togekiss',\n",
" 'password':'Togekiss'}\n",
"response = requests.post(url, json=returning_user)\n",
Expand All @@ -42,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -194,16 +194,16 @@
" \"quantity\": 1.28\n",
" }\n",
" ],\n",
" \"receipt_date\": \"10/21/23\",\n",
" \"receipt_date\": \"2023-10-21\",\n",
" \"store\": \"jobs.qfc.com\",\n",
" \"total\": 119.31\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/QFC_1.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand All @@ -223,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -240,16 +240,16 @@
" \"quantity\": 3.01\n",
" }\n",
" ],\n",
" \"receipt_date\": \"02/24/24\",\n",
" \"receipt_date\": \"2024-02-24\",\n",
" \"store\": \"QFC\",\n",
" \"total\": 2.08\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/QFC_2.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand All @@ -269,7 +269,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -326,16 +326,16 @@
" \"quantity\": 2.0\n",
" }\n",
" ],\n",
" \"receipt_date\": \"04-30-24\",\n",
" \"receipt_date\": \"2024-04-30\",\n",
" \"store\": \"TRADER JOE'S\",\n",
" \"total\": 32.3\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/TJ_1.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand All @@ -355,7 +355,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand All @@ -377,16 +377,16 @@
" \"quantity\": 4.0\n",
" }\n",
" ],\n",
" \"receipt_date\": \"03-29-24\",\n",
" \"receipt_date\": \"2024-03-29\",\n",
" \"store\": \"TRADER JOE'S\",\n",
" \"total\": 15.13\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/TJ_2.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand All @@ -406,7 +406,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -443,16 +443,16 @@
" \"quantity\": 1.0\n",
" }\n",
" ],\n",
" \"receipt_date\": \"03-29-24\",\n",
" \"receipt_date\": \"2024-03-29\",\n",
" \"store\": \"TRADER JOE'S\",\n",
" \"total\": 17.04\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/TJ_3.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand Down Expand Up @@ -620,7 +620,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -672,16 +672,16 @@
" \"quantity\": 1.0\n",
" }\n",
" ],\n",
" \"receipt_date\": \"Feb 12, 2024\",\n",
" \"receipt_date\": \"2024-02-12\",\n",
" \"store\": \"HMART\",\n",
" \"total\": 31.73\n",
"}\n"
]
}
],
"source": [
"# url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"url = 'http://127.0.0.1:5000/api/receipts_parsing'\n",
"# url = 'https://receiptplus.pythonanywhere.com/api/receipts_parsing'\n",
"image_path = os.path.join(os.getcwd(), \"sample_receipts/HMART_3.jpg\")\n",
"\n",
"# Open the image file in binary mode\n",
Expand Down Expand Up @@ -723,7 +723,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down
2 changes: 0 additions & 2 deletions source/backend/resource/resource_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ def receipts_parsing():

outputDate = year + "-" + month + "-" + day

print(outputDate)

output = {
'receipt_date': outputDate,
'total': result['amazon']['extracted_data'][0]['payment_information']['amount_due'],
Expand Down

0 comments on commit 2a03879

Please sign in to comment.