From df267d8eec0daef36ae91841da5601125c063329 Mon Sep 17 00:00:00 2001 From: Jadowyne Ulve Date: Mon, 30 Sep 2024 21:07:55 -0500 Subject: [PATCH] Worked on getting transactions and locations to match up, decided on using the name and barcode instead of the ids --- __pycache__/main.cpython-312.pyc | Bin 15849 -> 19484 bytes main.py | 99 ++++++++++++++++++++--- sites/test/site.ini | 9 --- sites/test/sql/create/brands.sql | 4 - sites/test/sql/create/food_info.sql | 7 -- sites/test/sql/create/groups.sql | 8 -- sites/test/sql/create/item.sql | 27 ------- sites/test/sql/create/item_info.sql | 15 ---- sites/test/sql/create/linked_items.sql | 8 -- sites/test/sql/create/locations.sql | 10 --- sites/test/sql/create/logins.sql | 16 ---- sites/test/sql/create/logistics_info.sql | 10 --- sites/test/sql/create/transactions.sql | 15 ---- sites/test/sql/create/zones.sql | 5 -- sites/test/sql/drop/brands.sql | 1 - sites/test/sql/drop/food_info.sql | 1 - sites/test/sql/drop/groups.sql | 1 - sites/test/sql/drop/item_info.sql | 1 - sites/test/sql/drop/items.sql | 1 - sites/test/sql/drop/linked_items.sql | 1 - sites/test/sql/drop/locations.sql | 1 - sites/test/sql/drop/logistics_info.sql | 1 - sites/test/sql/drop/transactions.sql | 1 - sites/test/sql/drop/zones.sql | 1 - 24 files changed, 87 insertions(+), 156 deletions(-) delete mode 100644 sites/test/site.ini delete mode 100644 sites/test/sql/create/brands.sql delete mode 100644 sites/test/sql/create/food_info.sql delete mode 100644 sites/test/sql/create/groups.sql delete mode 100644 sites/test/sql/create/item.sql delete mode 100644 sites/test/sql/create/item_info.sql delete mode 100644 sites/test/sql/create/linked_items.sql delete mode 100644 sites/test/sql/create/locations.sql delete mode 100644 sites/test/sql/create/logins.sql delete mode 100644 sites/test/sql/create/logistics_info.sql delete mode 100644 sites/test/sql/create/transactions.sql delete mode 100644 sites/test/sql/create/zones.sql delete mode 100644 sites/test/sql/drop/brands.sql delete mode 100644 sites/test/sql/drop/food_info.sql delete mode 100644 sites/test/sql/drop/groups.sql delete mode 100644 sites/test/sql/drop/item_info.sql delete mode 100644 sites/test/sql/drop/items.sql delete mode 100644 sites/test/sql/drop/linked_items.sql delete mode 100644 sites/test/sql/drop/locations.sql delete mode 100644 sites/test/sql/drop/logistics_info.sql delete mode 100644 sites/test/sql/drop/transactions.sql delete mode 100644 sites/test/sql/drop/zones.sql diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc index bb30c7f5403a84665bfca708a6543a60a7451e28..9276f36d6cd8cc5b13ded4564dcdee2394563620 100644 GIT binary patch delta 4977 zcmcIneNbChcE9gSPtp_8(>MA61Okf>fdPXtUrw;WkQifPJBfqs#R^Yk!5HEvIgYW2 z#B62_HH~5KAJJ^$9X#FHCF`BmTkp=K)0vKwIM`X+LBzDHXtLdGH-9v3wOUtf4PPU-LFP0TMJ^mytY9rJ^Ae%>5zt7FCb>TtU}xBVKj5 zOZ)PIdBd%b12cTkagEAw6avIk0CwsmK*x|+j zx04R%;DF9u7Z$U@W!+8WgrU>SHN44XB?t{$No<&N{TVoZ&owRBv%2A291zU7*Zq`6 zLK8-KOd9+zjwZnpK@hg}3KJ3WJB|vR7TFqYgqO5ryb~tiIE4cfa$kc1lZ!%8on#}L zh;i6UdhL4+$)<=gvLRMf^tb}Z%37c`s*ccGC?W|L08y@pF*{HSMMSVtg2=eXzi>a3 zYgdBJy~0eGr3~)?-a4Tw2|Y)-@Wp~osuM32>@xa2F9+m-F)8TTcj({&&$t^Kn;kbwJvwUGcDSRvWA72q zkmUCag@dO<8xTkT$k;$2JTx{M^1Rs9aj3&H8aN$nEeSP$&A^Dp`R9Av+m3X2#!DXq z9_|1~ij!7PN!D&i@{m?DZYd1mpBFx(d+ksIjWChnAa^b)6+wh+k z8HHhxybMq17cBl|QNEd{y$eT@ym0ZtwqhMgwi9yU6Pq`dNCFwDyzMUitw25He>E zowV5B?w;$$J+a-yxpz%~C?1-S-gNoI^obQ$)q@;-#hcG(zKQllWN^%VOqG9lSUj{6gMYX z{^I`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 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ #!/usr/bin/python import psycopg2 from config import config -import json, datetime, copy +import json, datetime, copy, csv def lst2pgarr(alist): return '{' + ','.join(alist) + '}' @@ -100,20 +100,18 @@ def add_transaction(site_name, barcode, qty, user_id, transaction_type = "info", with psycopg2.connect(**database_config) as conn: with conn.cursor() as cur: cur.execute(f"SELECT item_name, logistics_info_id FROM {site_name}_items WHERE barcode=%s;", (barcode, )) - row = cur.fetchone() - print(row) + item = cur.fetchone() with conn.cursor() as cur: - cur.execute(f"SELECT location_data, quantity_on_hand, primary_location FROM {site_name}_logistics_info WHERE id=%s;", (row[1],)) + cur.execute(f"SELECT location_data, quantity_on_hand, primary_location, barcode FROM {site_name}_logistics_info WHERE id=%s;", (item[1],)) logistics_info = cur.fetchone() - print(logistics_info) new_trans = copy.deepcopy(transaction_payload) new_trans["timestamp"] = datetime.datetime.now() - new_trans["logistics_info_id"] = row[1] + new_trans["logistics_info_id"] = item[1] new_trans["barcode"] = barcode new_trans["user_id"] = user_id - new_trans["name"] = row[0] + new_trans["name"] = item[0] new_trans["transaction_type"] = transaction_type new_trans["description"] = description new_trans["quantity"] = qty @@ -131,11 +129,34 @@ def add_transaction(site_name, barcode, qty, user_id, transaction_type = "info", print(error) conn.rollback() return False + if not location: mover = logistics_info[2] else: mover = location + + location_items = None + location_id = None + try: + with conn.cursor() as cur: + cur.execute(f"SELECT id, items FROM {site_name}_locations WHERE name=%s;", (mover, )) + location = cur.fetchone() + if location: + location_id = location[0] + location_items = location[1] + except (Exception, psycopg2.DatabaseError) as error: + print(error) + conn.rollback() + return False + + if logistics_info[3] in location_items.keys(): + location_items[logistics_info[3]] = location_items[logistics_info[3]] + qty + else: + location_items[logistics_info[3]] = qty + + print(location_items) + if mover in logistics_info[0].keys(): logistics_info[0][mover] = logistics_info[0][mover] + qty else: @@ -143,10 +164,12 @@ def add_transaction(site_name, barcode, qty, user_id, transaction_type = "info", qty = logistics_info[1] + qty + set_location_data = f"UPDATE {site_name}_locations SET items = %s WHERE id = %s;" set_quantity_on_hand = f"UPDATE {site_name}_logistics_info SET quantity_on_hand = %s, location_data = %s WHERE id = %s;" try: with conn.cursor() as cur: cur.execute(set_quantity_on_hand, (qty, json.dumps(logistics_info[0]), new_trans["logistics_info_id"])) + cur.execute(set_location_data, (json.dumps(location_items), location_id)) except (Exception, psycopg2.DatabaseError) as error: print(error) conn.rollback() @@ -156,6 +179,8 @@ def add_transaction(site_name, barcode, qty, user_id, transaction_type = "info", def add_food_item(site_name: str, barcode: str, name: str, qty: float, payload: dict): + # TODO: I need to validate the name so that it doesnt have characters against the SQL database schema such as ' + defaults = config(filename=f"sites/{site_name}/site.ini", section="defaults") payload["logistics_info"]["primary_location"] = defaults["default_primary_location"] payload["logistics_info"]["auto_issue_location"] = defaults["default_auto_issue_location"] @@ -225,6 +250,9 @@ def delete_site(site_name): drop_table(f'sites/{site_name}/sql/drop/locations.sql') def create_site(site_name): + + site_config = config(f"sites/{site_name}/site.ini", 'defaults') + create_table(f'sites/{site_name}/sql/create/logins.sql') create_table(f'sites/{site_name}/sql/create/groups.sql') create_table(f'sites/{site_name}/sql/create/linked_items.sql') @@ -237,6 +265,33 @@ def create_site(site_name): create_table(f'sites/{site_name}/sql/create/zones.sql') create_table(f'sites/{site_name}/sql/create/locations.sql') + sql = f"INSERT INTO {site_name}_zones(name) VALUES (%s) RETURNING id;" + sqltwo = f"INSERT INTO {site_name}_locations(name, zone_id, items) VALUES (%s, %s, %s);" + + database_config = config() + with psycopg2.connect(**database_config) as conn: + zone_id = None + try: + with conn.cursor() as cur: + cur.execute(sql, (site_config["default_zone"], )) + rows = cur.fetchone() + if rows: + zone_id = rows[0] + except (Exception, psycopg2.DatabaseError) as error: + print(error) + conn.rollback() + return False + + try: + with conn.cursor() as cur: + cur.execute(sqltwo, (site_config["default_primary_location"], zone_id, json.dumps({}))) + except (Exception, psycopg2.DatabaseError) as error: + print(error) + conn.rollback() + return False + + + conn.commit() @@ -281,16 +336,36 @@ payload_food_item = { } } +def parse_csv(path_to_csv): + + payload = copy.deepcopy(payload_food_item) + + + with open(path_to_csv, "r+", encoding="utf-8") as file: + reader = csv.reader(file) + for line in reader: + if line[0] != "id": + payload["item_info"]["packaging"] = line[10] + payload["item_info"]["uom"] = line[13] + payload["item_info"]["cost"] = line[15] + if line[17] != "None": + payload["item_info"]["safety_stock"] = line[17] + qty = float(line[30]) + add_food_item(site_name="test", barcode=line[1], name=line[2], qty=qty, payload=payload) + + if __name__ == "__main__": - #print(add_item(site_name="main", barcode="1235", name="testone")) + #print(add_readitem(site_name="main", barcode="1235", name="testone")) database_config = config() - sql = "SELECT * FROM main_logistics_info WHERE id=2;" + sql = "SELECT items FROM test_locations WHERE id=1;" with psycopg2.connect(**database_config) as conn: with conn.cursor() as cur: cur.execute(sql) - rows = cur.fetchone() - print(rows) - print(type(rows[5])) \ No newline at end of file + items = cur.fetchone()[0] + for k, v in items.items(): + print(f"{k}: {v}") + + #parse_csv(r"C:\\Users\\jadow\Downloads\\2024-09-30-Pantry.csv") \ No newline at end of file diff --git a/sites/test/site.ini b/sites/test/site.ini deleted file mode 100644 index 8cf4684..0000000 --- a/sites/test/site.ini +++ /dev/null @@ -1,9 +0,0 @@ -[site] -site_name=test -site_owner=test -email= - -[defaults] -default_zone=default -default_primary_location=all -default_auto_issue_location=all diff --git a/sites/test/sql/create/brands.sql b/sites/test/sql/create/brands.sql deleted file mode 100644 index 6cd9f9c..0000000 --- a/sites/test/sql/create/brands.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_brands ( - id SERIAL PRIMARY KEY, - name VARCHAR(255) -); \ No newline at end of file diff --git a/sites/test/sql/create/food_info.sql b/sites/test/sql/create/food_info.sql deleted file mode 100644 index bedbe47..0000000 --- a/sites/test/sql/create/food_info.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_food_info ( - id SERIAL PRIMARY KEY, - food_groups TEXT [], - ingrediants TEXT [], - nutrients JSONB, - expires BOOLEAN -); \ No newline at end of file diff --git a/sites/test/sql/create/groups.sql b/sites/test/sql/create/groups.sql deleted file mode 100644 index b97fdab..0000000 --- a/sites/test/sql/create/groups.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_groups( - id SERIAL PRIMARY KEY, - name VARCHAR(255) NOT NULL, - description TEXT, - included_items INTEGER [], - group_type VARCHAR(255), - UNIQUE (name) -); \ No newline at end of file diff --git a/sites/test/sql/create/item.sql b/sites/test/sql/create/item.sql deleted file mode 100644 index 5f30ebb..0000000 --- a/sites/test/sql/create/item.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_items( - id SERIAL PRIMARY KEY, - barcode VARCHAR(255) NOT NULL, - item_name VARCHAR(255) NOT NULL, - brand INTEGER, - tags TEXT [], - links TEXT [], - item_info_id INTEGER NOT NULL, - logistics_info_id INTEGER NOT NULL, - food_info_id INTEGER, - row_type VARCHAR(255) NOT NULL, - item_type VARCHAR(255) NOT NULL, - search_string TEXT NOT NULL, - UNIQUE(barcode, item_info_id), - CONSTRAINT fk_item_info - FOREIGN KEY(item_info_id) - REFERENCES test_item_info(id), - CONSTRAINT fk_food_info - FOREIGN KEY(food_info_id) - REFERENCES test_food_info(id), - CONSTRAINT fk_brand - FOREIGN KEY(brand) - REFERENCES test_brands(id), - CONSTRAINT fk_logistics_info - FOREIGN KEY(logistics_info_id) - REFERENCES test_logistics_info(id) -); diff --git a/sites/test/sql/create/item_info.sql b/sites/test/sql/create/item_info.sql deleted file mode 100644 index 317106c..0000000 --- a/sites/test/sql/create/item_info.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE IF NOt EXISTS test_item_info ( - id SERIAL PRIMARY KEY, - barcode VARCHAR(255) NOT NULL, - linked_items INTEGER [], - shopping_lists INTEGER [], - recipes INTEGER [], - groups INTEGER [], - packaging VARCHAR(255), - uom VARCHAR(255), - cost FLOAT8, - safety_stock FLOAT8, - lead_time_days FLOAT8, - ai_pick BOOLEAN, - UNIQUE(barcode) -); \ No newline at end of file diff --git a/sites/test/sql/create/linked_items.sql b/sites/test/sql/create/linked_items.sql deleted file mode 100644 index 16a24e2..0000000 --- a/sites/test/sql/create/linked_items.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_itemlinks ( - id SERIAL PRIMARY KEY, - barcode VARCHAR(255) NOt NULL, - link INTEGER NOT NULL, - data JSONB NOT NULL, - conv_factor FLOAT8 NOt NULL, - UNIQUE(barcode) -); \ No newline at end of file diff --git a/sites/test/sql/create/locations.sql b/sites/test/sql/create/locations.sql deleted file mode 100644 index 32c6a98..0000000 --- a/sites/test/sql/create/locations.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_locations( - id SERIAL PRIMARY KEY, - name VARCHAR(32) NOT NULL, - zone_id INTEGER NOT NULL, - items JSONB, - UNIQUE(name), - CONSTRAINT fk_zone - FOREIGN KEY(zone_id) - REFERENCES test_zones(id) -); \ No newline at end of file diff --git a/sites/test/sql/create/logins.sql b/sites/test/sql/create/logins.sql deleted file mode 100644 index f69b01b..0000000 --- a/sites/test/sql/create/logins.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE IF NOT EXISTS logins( - id SERIAL PRIMARY KEY, - username VARCHAR(255), - password VARCHAR(255), - favorites JSONB, - unseen_pantry_items INTEGER [], - unseen_groups INTEGER [], - unseen_shopping_lists INTEGER [], - unseen_recipes INTEGER [], - seen_pantry_items INTEGER [], - seen_groups INTEGER[], - seen_shopping_lists INTEGER [], - seen_recipes INTEGER [], - flags JSONB -); - diff --git a/sites/test/sql/create/logistics_info.sql b/sites/test/sql/create/logistics_info.sql deleted file mode 100644 index ed6202f..0000000 --- a/sites/test/sql/create/logistics_info.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_logistics_info( - id SERIAL PRIMARY KEY, - barcode VARCHAR(255) NOT NULL, - primary_location VARCHAR(16), - auto_issue_location VARCHAR(16), - dynamic_locations JSONB, - location_data JSONB, - quantity_on_hand FLOAT8 NOT NULL, - UNIQUE(barcode) -); \ No newline at end of file diff --git a/sites/test/sql/create/transactions.sql b/sites/test/sql/create/transactions.sql deleted file mode 100644 index c781b14..0000000 --- a/sites/test/sql/create/transactions.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_Transactions ( - id SERIAL PRIMARY KEY, - timestamp TIMESTAMP, - logistics_info_id INTEGER NOT NULL, - barcode VARCHAR(255) NOT NULL, - name VARCHAR(255), - transaction_type VARCHAR(255) NOT NULL, - quantity FLOAT8 NOT NULL, - description TEXT, - user_id INTEGER NOT NULL, - data JSONB, - CONSTRAINT fk_logistics_info - FOREIGN KEY(logistics_info_id) - REFERENCES test_logistics_info(id) -); \ No newline at end of file diff --git a/sites/test/sql/create/zones.sql b/sites/test/sql/create/zones.sql deleted file mode 100644 index 0ed0a9e..0000000 --- a/sites/test/sql/create/zones.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE IF NOT EXISTS test_zones( - id SERIAL PRIMARY KEY, - name VARCHAR(32) NOT NULL, - UNIQUE(name) -); diff --git a/sites/test/sql/drop/brands.sql b/sites/test/sql/drop/brands.sql deleted file mode 100644 index f407a8c..0000000 --- a/sites/test/sql/drop/brands.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_brands CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/food_info.sql b/sites/test/sql/drop/food_info.sql deleted file mode 100644 index a4c3056..0000000 --- a/sites/test/sql/drop/food_info.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_food_info CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/groups.sql b/sites/test/sql/drop/groups.sql deleted file mode 100644 index 6b62f3b..0000000 --- a/sites/test/sql/drop/groups.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_groups CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/item_info.sql b/sites/test/sql/drop/item_info.sql deleted file mode 100644 index c84b0d1..0000000 --- a/sites/test/sql/drop/item_info.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_item_info CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/items.sql b/sites/test/sql/drop/items.sql deleted file mode 100644 index 097b9a7..0000000 --- a/sites/test/sql/drop/items.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_items CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/linked_items.sql b/sites/test/sql/drop/linked_items.sql deleted file mode 100644 index bcc9093..0000000 --- a/sites/test/sql/drop/linked_items.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_itemlinks CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/locations.sql b/sites/test/sql/drop/locations.sql deleted file mode 100644 index 4a1f42e..0000000 --- a/sites/test/sql/drop/locations.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_locations CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/logistics_info.sql b/sites/test/sql/drop/logistics_info.sql deleted file mode 100644 index cb5abcd..0000000 --- a/sites/test/sql/drop/logistics_info.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_logistics_info CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/transactions.sql b/sites/test/sql/drop/transactions.sql deleted file mode 100644 index 1356e47..0000000 --- a/sites/test/sql/drop/transactions.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_transactions CASCADE; \ No newline at end of file diff --git a/sites/test/sql/drop/zones.sql b/sites/test/sql/drop/zones.sql deleted file mode 100644 index c84c67b..0000000 --- a/sites/test/sql/drop/zones.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE test_zones CASCADE; \ No newline at end of file