2-8-2025 work on database code

This commit is contained in:
Jadowyne Ulve 2025-02-08 12:00:50 -06:00
parent 547f7ab711
commit 8e8738921d
73 changed files with 925 additions and 527 deletions

View File

@ -250,9 +250,9 @@ ROSEMARY EXTRACT AS PRESERVATVES. "DRIED","{'calcium': 0, 'calcium_serving'
259,%PenneNoodles%,Penne Noodles,,[''],[''],[''],[''],,"{'carbohydrates': '0', 'carbohydrates_100g': 0, 'carbohydrates_unit': '', 'carbohydrates_value': 0, 'energy': 0, 'energy-kcal': 0, 'energy-kcal_100g': 0, 'energy-kcal_unit': '', 'energy-kcal_value': 0, 'energy-kcal_value_computed': 0, 'energy_100g': 0, 'energy_unit': '', 'energy_value': 0, 'fat': 0, 'fat_100g': 0, 'fat_unit': '', 'fat_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'nova-group': 0, 'nova-group_100g': 0, 'nova-group_serving': 0, 'proteins': '0', 'proteins_100g': 0, 'proteins_unit': '', 'proteins_value': 0, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_unit': '', 'saturated-fat_value': 0, 'sugars': '0', 'sugars_100g': 0, 'sugars_unit': '', 'sugars_value': 0, 'serving': '', 'calories': '', 'fats': '', 'sodium': '', 'fibers': '', 'serving_unit': '', 'calories_unit': None, 'fats_unit': '', 'sodium_unit': '', 'fibers_unit': ''}",None,Penne Noodles,1,Box,None,1.84,262,1,0,[],[],FALSE,no,linked,FOOD,[],[],[],,259&Penne Noodles&,1
260,%072554298837%,KitKat Waffle Cones,,[],[],[],[],,"{'carbohydrates': 43.617021276596, 'carbohydrates_100g': 43.617021276596, 'carbohydrates_unit': 'g', 'carbohydrates_value': 43.617021276596, 'energy': 1251, 'energy-kcal': 298.93617021277, 'energy-kcal_100g': 298.93617021277, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 298.93617021277, 'energy-kcal_value_computed': 300.000000000005, 'energy_100g': 1251, 'energy_unit': 'kcal', 'energy_value': 298.93617021277, 'fat': 12.765957446809, 'fat_100g': 12.765957446809, 'fat_unit': 'g', 'fat_value': 12.765957446809, 'fiber': 1.063829787234, 'fiber_100g': 1.063829787234, 'fiber_unit': 'g', 'fiber_value': 1.063829787234, 'proteins': 2.1276595744681, 'proteins_100g': 2.1276595744681, 'proteins_unit': 'g', 'proteins_value': 2.1276595744681, 'salt': 0.2659574468085, 'salt_100g': 0.2659574468085, 'salt_unit': 'g', 'salt_value': 0.2659574468085, 'saturated-fat': 10.63829787234, 'saturated-fat_100g': 10.63829787234, 'saturated-fat_unit': 'g', 'saturated-fat_value': 10.63829787234, 'sodium': 0.1063829787234, 'sodium_100g': 0.1063829787234, 'sodium_unit': 'g', 'sodium_value': 0.1063829787234, 'sugars': 28.723404255319, 'sugars_100g': 28.723404255319, 'sugars_unit': 'g', 'sugars_value': 28.723404255319}",,KitKat Waffle Cones,0,Box,,6.73,263,0,0,[],[],FALSE,no,single,FOOD,[],[],[],,260&KitKat Waffle Cones&None,3
265,%082011570727%,Samoas,"girl scouts,Little Brownie Bakers,Ferrero","['girl-scouts', 'little-brownie-bakers', 'ferrero']","['Sandwich cookies', 'Biscuits', 'Cookie with chocolate covering', 'Biscuits/Cookies (Shelf Stable)', 'Cookies with chocolate and coconut']","['en:sugary-snacks', 'en:biscuits-and-cakes']","['en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:vegetable-oil', 'en:oil-and-fat', 'en:vegetable-oil-and-fat', 'en:flour', 'en:corn-syrup', 'en:coconut', 'en:fruit', 'en:sweetened-condensed-milk', 'en:dairy', 'en:milk', 'en:condensed-milk', 'en:e420', 'en:cocoa', 'en:plant', 'en:e422', 'en:invert-sugar', 'en:monosaccharide', 'en:cocoa-processed-with-alkali', 'en:corn-starch', 'en:starch', 'en:salt', 'en:e150a', 'en:dextrose', 'en:glucose', 'en:natural-and-artificial-flavouring', 'en:flavouring', 'en:natural-flavouring', 'en:artificial-flavouring', 'en:soya-lecithin', 'en:e322', 'en:e322i', 'en:e492', 'en:raising-agent', 'en:e407', 'en:palm-kernel-oil', 'en:palm-kernel-oil-and-fat', 'en:palm-oil', 'en:palm-oil-and-fat', 'en:soya-oil', 'en:wheat-flour', 'en:cereal', 'en:wheat', 'en:cereal-flour', 'en:e375', 'en:reduced-iron', 'en:minerals', 'en:iron', 'en:thiamin', 'en:e101', 'en:folic-acid', 'en:folate', 'en:e500ii', 'en:e500', 'en:e341i', 'en:e341', 'en:thiamin-mononitrate']","sugar, vegetable oil (palm kernel, palm oil, soybean oil), enriched flour (wheat flour, niacin, reduced iron, vitamin b1 [thiamin mononitrate], vitamin b2 [riboflavin], folic acid), corn syrup, coconut, sweetened condensed milk (milk, sugar), sorbitol, cocoa, glycerin, invert sugar, cocoa processed with alkali, cornstarch, salt, caramel color, dextrose, natural and artificial flavors, soy lecithin, sorbitan tristearate, leavening (baking soda, monocalcium phosphate), carrageenan","{'added-sugars': 10, 'added-sugars_100g': 34.5, 'added-sugars_serving': 10, 'added-sugars_unit': 'g', 'added-sugars_value': 10, 'calcium': 0.01, 'calcium_100g': 0.0345, 'calcium_serving': 0.01, 'calcium_unit': 'mg', 'calcium_value': 10, 'carbohydrates': 18, 'carbohydrates_100g': 62.1, 'carbohydrates_serving': 18, 'carbohydrates_unit': 'g', 'carbohydrates_value': 18, 'cholesterol': 0, 'cholesterol_100g': 0, 'cholesterol_serving': 0, 'cholesterol_unit': 'mg', 'cholesterol_value': 0, 'energy': 628, 'energy-kcal': 150, 'energy-kcal_100g': 517, 'energy-kcal_serving': 150, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 150, 'energy-kcal_value_computed': 148, 'energy_100g': 2170, 'energy_serving': 628, 'energy_unit': 'kcal', 'energy_value': 150, 'fat': 8, 'fat_100g': 27.6, 'fat_serving': 8, 'fat_unit': 'g', 'fat_value': 8, 'fiber': 0, 'fiber_100g': 0, 'fiber_serving': 0, 'fiber_unit': 'g', 'fiber_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 2.96875, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 2.96875, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 2.96875, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 2.96875, 'iron': 0.0006, 'iron_100g': 0.00207, 'iron_label': '0', 'iron_serving': 0.0006, 'iron_unit': 'mg', 'iron_value': 0.6, 'monounsaturated-fat': 1, 'monounsaturated-fat_100g': 3.45, 'monounsaturated-fat_label': '0', 'monounsaturated-fat_serving': 1, 'monounsaturated-fat_unit': 'g', 'monounsaturated-fat_value': 1, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 26, 'nutrition-score-fr_100g': 26, 'polyunsaturated-fat': 1, 'polyunsaturated-fat_100g': 3.45, 'polyunsaturated-fat_label': '0', 'polyunsaturated-fat_serving': 1, 'polyunsaturated-fat_unit': 'g', 'polyunsaturated-fat_value': 1, 'potassium': 0.045, 'potassium_100g': 0.155, 'potassium_serving': 0.045, 'potassium_unit': 'mg', 'potassium_value': 45, 'proteins': 1, 'proteins_100g': 3.45, 'proteins_serving': 1, 'proteins_unit': 'g', 'proteins_value': 1, 'salt': 0.15, 'salt_100g': 0.517, 'salt_serving': 0.15, 'salt_unit': 'mg', 'salt_value': 150, 'saturated-fat': 6, 'saturated-fat_100g': 20.7, 'saturated-fat_serving': 6, 'saturated-fat_unit': 'g', 'saturated-fat_value': 6, 'sodium': 0.06, 'sodium_100g': 0.207, 'sodium_serving': 0.06, 'sodium_unit': 'mg', 'sodium_value': 60, 'sugars': 11, 'sugars_100g': 37.9, 'sugars_serving': 11, 'sugars_unit': 'g', 'sugars_value': 11, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-d': 0, 'vitamin-d_100g': 0, 'vitamin-d_serving': 0, 'vitamin-d_unit': 'µg', 'vitamin-d_value': 0}","Box, Mixed plastic-bag, Paper-box",Samoas,0,g,7.5oz (212g),0,264,None,0,[],[],FALSE,no,single,,[],[],[],,"265&Samoas&girl scouts,Little Brownie Bakers,Ferrero",1
268,%089036422802%,Vanilla syrup,"Torani, R. Torre & Co.Inc.","['torani', 'r-torre-co-inc']","['Sweeteners', 'Syrups', 'Simple syrups']",[],"['en:cane-sugar', 'en:added-sugar', 'en:disaccharide', 'en:sugar', 'en:water', 'en:vanilla-extract-with-other-natural-flavors', 'en:e211', 'en:e202', 'en:e330', 'en:to-preserve-freshness']","Pure cane sugar, water, vanilla extract with other natural flavors, sodium benzoate (to preserve freshness), potassium sorbate (to preserve freshness), citric acid.","{'carbohydrates': 66.6667, 'carbohydrates_100g': 66.6667, 'carbohydrates_serving': 20, 'carbohydrates_unit': 'g', 'carbohydrates_value': 66.6667, 'energy': 1116, 'energy-kcal': 266.6667, 'energy-kcal_100g': 266.6667, 'energy-kcal_serving': 80, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 266.6667, 'energy-kcal_value_computed': 266.6668, 'energy_100g': 1116, 'energy_serving': 335, 'energy_unit': 'kcal', 'energy_value': 266.6667, 'fat': 0, 'fat_100g': 0, 'fat_serving': 0, 'fat_unit': 'g', 'fat_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'nova-group': 3, 'nova-group_100g': 3, 'nova-group_serving': 3, 'nutrition-score-fr': 13, 'nutrition-score-fr_100g': 13, 'proteins': 0, 'proteins_100g': 0, 'proteins_serving': 0, 'proteins_unit': 'g', 'proteins_value': 0, 'salt': 0, 'salt_100g': 0, 'salt_serving': 0, 'salt_unit': 'g', 'salt_value': 0, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_serving': 0, 'saturated-fat_unit': 'g', 'saturated-fat_value': 0, 'sodium': 0, 'sodium_100g': 0, 'sodium_serving': 0, 'sodium_unit': 'g', 'sodium_value': 0, 'sugars': 66.6667, 'sugars_100g': 66.6667, 'sugars_serving': 20, 'sugars_unit': 'g', 'sugars_value': 66.6667}","en:pet-bottle, en:pet-bottle",Vanilla syrup,0,,,,12,None,0,[],[],FALSE,no,single,,[],[],[],,"268&Vanilla syrup&Torani, R. Torre & Co.Inc.",1
269,%X002TJQR5D%,Torani Raspberry Syrup,,[],[],[],[],,"{'carbohydrates': 0, 'carbohydrates_100g': 0, 'carbohydrates_unit': '', 'carbohydrates_value': 0, 'energy': 0, 'energy-kcal': 0, 'energy-kcal_100g': 0, 'energy-kcal_unit': '', 'energy-kcal_value': 0, 'energy-kcal_value_computed': 0, 'energy_100g': 0, 'energy_unit': '', 'energy_value': 0, 'fat': 0, 'fat_100g': 0, 'fat_unit': '', 'fat_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'nova-group': 0, 'nova-group_100g': 0, 'nova-group_serving': 0, 'proteins': 0, 'proteins_100g': 0, 'proteins_unit': '', 'proteins_value': 0, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_unit': '', 'saturated-fat_value': 0, 'sugars': 0, 'sugars_100g': 0, 'sugars_unit': '', 'sugars_value': 0}",,Torani Raspberry Syrup,0,,,,13,None,0,[],[],FALSE,no,single,,[],[],[],,269&Torani Raspberry Syrup&None,1
270,%041789002328%,Maruchan instant lunch beef ramen noodle baby count,"Maruchan, Maruchan Inc.","['maruchan', 'maruchan-inc']","['Meals', 'Soups']","['en:composite-foods', 'en:one-dish-meals']","['en:salt', 'en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:contains-less-than-1-of', 'en:e621', 'en:lactose', 'en:soy-sauce', 'en:sauce', 'en:e150a', 'en:spice', 'en:condiment', 'en:beef-fat', 'en:oil-and-fat', 'en:fat', 'en:animal-fat', 'en:yeast-extract', 'en:yeast', 'en:hydrolyzed-corn', 'en:wheat', 'en:cereal', 'en:soy-protein', 'en:protein', 'en:plant-protein', 'en:vegetable', 'en:natural-flavouring', 'en:flavouring', 'en:e631', 'en:e627', 'en:maltodextrin', 'en:soya-bean', 'en:legume', 'en:pulse', 'en:soya', 'en:onion', 'en:root-vegetable', 'en:onion-family-vegetable', 'en:garlic', 'en:chives']","salt, sugar, contains less than 1% of: maltodextrin, monosodium glutamate, lactose, dehydrated soy sauce (wheat, soybeans, salt), caramel color, spices, beef fat,yeast extract, hydrolyzed corn, wheat and soy protein, dehydrated vegetables (onion, garlic, chive), natural flavor, disodium inosinate, disodium guanylate.","{'calcium': 0.047, 'calcium_100g': 0.047, 'calcium_serving': 0.0202, 'calcium_unit': 'mg', 'calcium_value': 47, 'carbohydrates': 62.790697674419, 'carbohydrates_100g': 62.790697674419, 'carbohydrates_serving': 27, 'carbohydrates_unit': 'g', 'carbohydrates_value': 62.790697674419, 'cholesterol': 0, 'cholesterol_100g': 0, 'cholesterol_serving': 0, 'cholesterol_unit': 'mg', 'cholesterol_value': 0, 'energy': 1849, 'energy-kcal': 441.86046511628, 'energy-kcal_100g': 441.86046511628, 'energy-kcal_serving': 190, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 441.86046511628, 'energy-kcal_value_computed': 439.534883720933, 'energy_100g': 1849, 'energy_serving': 795, 'energy_unit': 'kcal', 'energy_value': 441.86046511628, 'fat': 16.279069767442, 'fat_100g': 16.279069767442, 'fat_serving': 7, 'fat_unit': 'g', 'fat_value': 16.279069767442, 'fiber': 2.3255813953488, 'fiber_100g': 2.3255813953488, 'fiber_serving': 1, 'fiber_unit': 'g', 'fiber_value': 2.3255813953488, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 1.453488372093, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 1.453488372093, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 1.453488372093, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 1.453488372093, 'iron': 0.00335, 'iron_100g': 0.00335, 'iron_serving': 0.00144, 'iron_unit': 'mg', 'iron_value': 3.35, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 21, 'nutrition-score-fr_100g': 21, 'proteins': 9.3023255813953, 'proteins_100g': 9.3023255813953, 'proteins_serving': 4, 'proteins_unit': 'g', 'proteins_value': 9.3023255813953, 'salt': 4.186046511628, 'salt_100g': 4.186046511628, 'salt_serving': 1.8, 'salt_unit': 'g', 'salt_value': 4.186046511628, 'saturated-fat': 8.1395348837209, 'saturated-fat_100g': 8.1395348837209, 'saturated-fat_serving': 3.5, 'saturated-fat_unit': 'g', 'saturated-fat_value': 8.1395348837209, 'sodium': 1.6744186046512, 'sodium_100g': 1.6744186046512, 'sodium_serving': 0.72, 'sodium_unit': 'g', 'sodium_value': 1.6744186046512, 'sugars': 2.3255813953488, 'sugars_100g': 2.3255813953488, 'sugars_serving': 1, 'sugars_unit': 'g', 'sugars_value': 2.3255813953488, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-a': 6.99e-05, 'vitamin-a_100g': 6.99e-05, 'vitamin-a_serving': 3.01e-05, 'vitamin-a_unit': 'IU', 'vitamin-a_value': 233, 'vitamin-c': 0, 'vitamin-c_100g': 0, 'vitamin-c_serving': 0, 'vitamin-c_unit': 'mg', 'vitamin-c_value': 0}",,Maruchan instant lunch beef ramen noodle baby count,0,,,,4,None,0,[],[],FALSE,no,single,,[],[],[],,"270&Maruchan instant lunch beef ramen noodle baby count&Maruchan, Maruchan Inc.",4
268,%089036422802%,Vanilla syrup,"Torani, R. Torre & Co.Inc.","['torani', 'r-torre-co-inc']","['Sweeteners', 'Syrups', 'Simple syrups']",[],"['en:cane-sugar', 'en:added-sugar', 'en:disaccharide', 'en:sugar', 'en:water', 'en:vanilla-extract-with-other-natural-flavors', 'en:e211', 'en:e202', 'en:e330', 'en:to-preserve-freshness']","Pure cane sugar, water, vanilla extract with other natural flavors, sodium benzoate (to preserve freshness), potassium sorbate (to preserve freshness), citric acid.","{'carbohydrates': 66.6667, 'carbohydrates_100g': 66.6667, 'carbohydrates_serving': 20, 'carbohydrates_unit': 'g', 'carbohydrates_value': 66.6667, 'energy': 1116, 'energy-kcal': 266.6667, 'energy-kcal_100g': 266.6667, 'energy-kcal_serving': 80, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 266.6667, 'energy-kcal_value_computed': 266.6668, 'energy_100g': 1116, 'energy_serving': 335, 'energy_unit': 'kcal', 'energy_value': 266.6667, 'fat': 0, 'fat_100g': 0, 'fat_serving': 0, 'fat_unit': 'g', 'fat_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'nova-group': 3, 'nova-group_100g': 3, 'nova-group_serving': 3, 'nutrition-score-fr': 13, 'nutrition-score-fr_100g': 13, 'proteins': 0, 'proteins_100g': 0, 'proteins_serving': 0, 'proteins_unit': 'g', 'proteins_value': 0, 'salt': 0, 'salt_100g': 0, 'salt_serving': 0, 'salt_unit': 'g', 'salt_value': 0, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_serving': 0, 'saturated-fat_unit': 'g', 'saturated-fat_value': 0, 'sodium': 0, 'sodium_100g': 0, 'sodium_serving': 0, 'sodium_unit': 'g', 'sodium_value': 0, 'sugars': 66.6667, 'sugars_100g': 66.6667, 'sugars_serving': 20, 'sugars_unit': 'g', 'sugars_value': 66.6667}","en:pet-bottle, en:pet-bottle",Vanilla syrup,0,,,0,12,None,0,[],[],FALSE,no,single,,[],[],[],,"268&Vanilla syrup&Torani, R. Torre & Co.Inc.",1
269,%X002TJQR5D%,Torani Raspberry Syrup,,[],[],[],[],,"{'carbohydrates': 0, 'carbohydrates_100g': 0, 'carbohydrates_unit': '', 'carbohydrates_value': 0, 'energy': 0, 'energy-kcal': 0, 'energy-kcal_100g': 0, 'energy-kcal_unit': '', 'energy-kcal_value': 0, 'energy-kcal_value_computed': 0, 'energy_100g': 0, 'energy_unit': '', 'energy_value': 0, 'fat': 0, 'fat_100g': 0, 'fat_unit': '', 'fat_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'nova-group': 0, 'nova-group_100g': 0, 'nova-group_serving': 0, 'proteins': 0, 'proteins_100g': 0, 'proteins_unit': '', 'proteins_value': 0, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_unit': '', 'saturated-fat_value': 0, 'sugars': 0, 'sugars_100g': 0, 'sugars_unit': '', 'sugars_value': 0}",,Torani Raspberry Syrup,0,,,0,13,None,0,[],[],FALSE,no,single,,[],[],[],,269&Torani Raspberry Syrup&None,1
270,%041789002328%,Maruchan instant lunch beef ramen noodle baby count,"Maruchan, Maruchan Inc.","['maruchan', 'maruchan-inc']","['Meals', 'Soups']","['en:composite-foods', 'en:one-dish-meals']","['en:salt', 'en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:contains-less-than-1-of', 'en:e621', 'en:lactose', 'en:soy-sauce', 'en:sauce', 'en:e150a', 'en:spice', 'en:condiment', 'en:beef-fat', 'en:oil-and-fat', 'en:fat', 'en:animal-fat', 'en:yeast-extract', 'en:yeast', 'en:hydrolyzed-corn', 'en:wheat', 'en:cereal', 'en:soy-protein', 'en:protein', 'en:plant-protein', 'en:vegetable', 'en:natural-flavouring', 'en:flavouring', 'en:e631', 'en:e627', 'en:maltodextrin', 'en:soya-bean', 'en:legume', 'en:pulse', 'en:soya', 'en:onion', 'en:root-vegetable', 'en:onion-family-vegetable', 'en:garlic', 'en:chives']","salt, sugar, contains less than 1% of: maltodextrin, monosodium glutamate, lactose, dehydrated soy sauce (wheat, soybeans, salt), caramel color, spices, beef fat,yeast extract, hydrolyzed corn, wheat and soy protein, dehydrated vegetables (onion, garlic, chive), natural flavor, disodium inosinate, disodium guanylate.","{'calcium': 0.047, 'calcium_100g': 0.047, 'calcium_serving': 0.0202, 'calcium_unit': 'mg', 'calcium_value': 47, 'carbohydrates': 62.790697674419, 'carbohydrates_100g': 62.790697674419, 'carbohydrates_serving': 27, 'carbohydrates_unit': 'g', 'carbohydrates_value': 62.790697674419, 'cholesterol': 0, 'cholesterol_100g': 0, 'cholesterol_serving': 0, 'cholesterol_unit': 'mg', 'cholesterol_value': 0, 'energy': 1849, 'energy-kcal': 441.86046511628, 'energy-kcal_100g': 441.86046511628, 'energy-kcal_serving': 190, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 441.86046511628, 'energy-kcal_value_computed': 439.534883720933, 'energy_100g': 1849, 'energy_serving': 795, 'energy_unit': 'kcal', 'energy_value': 441.86046511628, 'fat': 16.279069767442, 'fat_100g': 16.279069767442, 'fat_serving': 7, 'fat_unit': 'g', 'fat_value': 16.279069767442, 'fiber': 2.3255813953488, 'fiber_100g': 2.3255813953488, 'fiber_serving': 1, 'fiber_unit': 'g', 'fiber_value': 2.3255813953488, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 1.453488372093, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 1.453488372093, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 1.453488372093, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 1.453488372093, 'iron': 0.00335, 'iron_100g': 0.00335, 'iron_serving': 0.00144, 'iron_unit': 'mg', 'iron_value': 3.35, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 21, 'nutrition-score-fr_100g': 21, 'proteins': 9.3023255813953, 'proteins_100g': 9.3023255813953, 'proteins_serving': 4, 'proteins_unit': 'g', 'proteins_value': 9.3023255813953, 'salt': 4.186046511628, 'salt_100g': 4.186046511628, 'salt_serving': 1.8, 'salt_unit': 'g', 'salt_value': 4.186046511628, 'saturated-fat': 8.1395348837209, 'saturated-fat_100g': 8.1395348837209, 'saturated-fat_serving': 3.5, 'saturated-fat_unit': 'g', 'saturated-fat_value': 8.1395348837209, 'sodium': 1.6744186046512, 'sodium_100g': 1.6744186046512, 'sodium_serving': 0.72, 'sodium_unit': 'g', 'sodium_value': 1.6744186046512, 'sugars': 2.3255813953488, 'sugars_100g': 2.3255813953488, 'sugars_serving': 1, 'sugars_unit': 'g', 'sugars_value': 2.3255813953488, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-a': 6.99e-05, 'vitamin-a_100g': 6.99e-05, 'vitamin-a_serving': 3.01e-05, 'vitamin-a_unit': 'IU', 'vitamin-a_value': 233, 'vitamin-c': 0, 'vitamin-c_100g': 0, 'vitamin-c_serving': 0, 'vitamin-c_unit': 'mg', 'vitamin-c_value': 0}",,Maruchan instant lunch beef ramen noodle baby count,0,,,0,4,None,0,[],[],FALSE,no,single,,[],[],[],,"270&Maruchan instant lunch beef ramen noodle baby count&Maruchan, Maruchan Inc.",4
272,%031142523850%,Parmesan Cheese,Belgioioso,['Belgioioso'],"['Dairies', 'Fermented foods', 'Fermented milk products', 'Cheeses', 'Italian cheeses', 'Parmigiano-Reggiano']","['en:milk-and-dairy-products', 'en:cheese']","['en:soured-milk', 'en:dairy', 'en:enzyme', 'en:salt']","en:soured-milk, en:dairy, en:enzyme, en:salt","{'added-sugars': 0, 'added-sugars_100g': 0, 'added-sugars_serving': 0, 'added-sugars_unit': 'g', 'added-sugars_value': 0, 'calcium': 0.2, 'calcium_100g': 0.714, 'calcium_serving': 0.2, 'calcium_unit': '% DV', 'calcium_value': 20, 'carbohydrates': '1', 'carbohydrates_100g': 3.57, 'carbohydrates_serving': 1, 'carbohydrates_unit': 'g', 'carbohydrates_value': 1, 'cholesterol': 0.025, 'cholesterol_100g': 0.0893, 'cholesterol_serving': 0.025, 'cholesterol_unit': 'mg', 'cholesterol_value': 25, 'energy': 460, 'energy-kcal': 110, 'energy-kcal_100g': 393, 'energy-kcal_serving': 110, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 110, 'energy-kcal_value_computed': 103, 'energy_100g': 1640, 'energy_serving': 460, 'energy_unit': 'kcal', 'energy_value': 110, 'fat': 7, 'fat_100g': 25, 'fat_serving': 7, 'fat_unit': 'g', 'fat_value': 7, 'fiber': 0, 'fiber_100g': 0, 'fiber_serving': 0, 'fiber_unit': 'g', 'fiber_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'iron': 0, 'iron_100g': 0, 'iron_serving': 0, 'iron_unit': '% DV', 'iron_value': 0, 'nova-group': 3, 'nova-group_100g': 3, 'nova-group_serving': 3, 'nutrition-score-fr': 18, 'nutrition-score-fr_100g': 18, 'potassium': 0, 'potassium_100g': 0, 'potassium_label': 'Potassium', 'potassium_serving': 0, 'potassium_unit': '% DV', 'potassium_value': 0, 'proteins': '9', 'proteins_100g': 32.1, 'proteins_serving': 9, 'proteins_unit': 'g', 'proteins_value': 9, 'salt': 0.625, 'salt_100g': 2.23, 'salt_serving': 0.625, 'salt_unit': 'mg', 'salt_value': 625, 'saturated-fat': 5, 'saturated-fat_100g': 17.9, 'saturated-fat_serving': 5, 'saturated-fat_unit': 'g', 'saturated-fat_value': 5, 'sodium': '0.25', 'sodium_100g': 0.893, 'sodium_serving': 0.25, 'sodium_unit': 'mg', 'sodium_value': 250, 'sugars': '0', 'sugars_100g': 0, 'sugars_serving': 0, 'sugars_unit': 'g', 'sugars_value': 0, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-d': 0, 'vitamin-d_100g': 0, 'vitamin-d_serving': 0, 'vitamin-d_unit': '% DV', 'vitamin-d_value': 0, 'serving': '', 'calories': '', 'fats': '', 'fibers': '', 'serving_unit': '', 'calories_unit': None, 'fats_unit': '', 'fibers_unit': ''}",None,Parmesan Cheese,0,None,8 oz,5.42,273,None,0,[],[],FALSE,no,single,,[],[],[],,272&Parmesan Cheese&Belgioioso,1
273,%078742132280%,Potato Salad,,[],['Salted snacks'],[],"['en:potato', 'en:vegetable', 'en:root-vegetable', 'en:tuber', 'en:mayonnaise', 'en:sauce', 'en:water', 'en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:celery', 'en:stalk-vegetable', 'en:sweet-pickle-relish', 'en:onion', 'en:onion-family-vegetable', 'en:red-bell-pepper', 'en:fruit-vegetable', 'en:bell-pepper', 'en:mustard', 'en:salt', 'en:vinegar', 'en:modified-corn-starch', 'en:starch', 'en:corn-starch', 'en:modified-starch', 'en:soya-oil', 'en:oil-and-fat', 'en:vegetable-oil-and-fat', 'en:vegetable-oil', 'en:black-pepper', 'en:seed', 'en:pepper', 'en:e202', 'en:e211', 'en:white-pepper', 'en:e415', 'en:parsley', 'en:herb', 'en:leaf-vegetable', 'en:egg-yolk', 'en:egg', 'en:cucumber', 'en:mustard-seed', 'en:condiment', 'en:spice', 'en:celery-seed', 'en:e509', 'en:natural-flavouring', 'en:flavouring', 'en:turmeric', 'en:dehydrated-onion', 'en:paprika', 'en:e160b', 'en:garlic', 'en:e385', 'en:e330', 'en:preservative', 'en:colour']","Potatoes, mayonnaise (soybean oil, water, egg yolks, vinegar, salt), water, sugar, celery, sweet pickle relish (cucumber, sugar, vinegar, salt, mustard seed, xanthan gum, celery seed, dehydrated red bell pepper, calcium chloride, natural flavoring, turmeric, dehydrated onion), onions, red bell peppers, mustard (water, vinegar, mustard seed, salt, sugar, soybean oil, turmeric, paprika, annatto extract [color], garlic, spices, xanthan gum, calcium disodium edta [preservative], natural flavor, citric acid), salt, vinegar, modified corn starch, soybean oil, black pepper, potassium sorbate (preservative), sodium benzoate (preservative), white pepper, xanthan gum, dried parsley.","{'calcium': 0, 'calcium_100g': 0, 'calcium_serving': 0, 'calcium_unit': 'mg', 'calcium_value': 0, 'carbohydrates': 20, 'carbohydrates_100g': 20, 'carbohydrates_serving': 28, 'carbohydrates_unit': 'g', 'carbohydrates_value': 20, 'cholesterol': 0.004, 'cholesterol_100g': 0.004, 'cholesterol_serving': 0.0056, 'cholesterol_unit': 'mg', 'cholesterol_value': 4, 'energy': 598, 'energy-kcal': 142.86, 'energy-kcal_100g': 142.86, 'energy-kcal_serving': 200, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 142.86, 'energy-kcal_value_computed': 150.83, 'energy_100g': 598, 'energy_serving': 837, 'energy_unit': 'kcal', 'energy_value': 142.86, 'fat': 6.43, 'fat_100g': 6.43, 'fat_serving': 9, 'fat_unit': 'g', 'fat_value': 6.43, 'fiber': 2.2, 'fiber_100g': 2.2, 'fiber_serving': 3.08, 'fiber_unit': 'g', 'fiber_value': 2.2, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 6.96849194978413, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 6.96849194978413, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 6.96849194978413, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 6.96849194978413, 'iron': 0.00103, 'iron_100g': 0.00103, 'iron_serving': 0.00144, 'iron_unit': 'mg', 'iron_value': 1.03, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 4, 'nutrition-score-fr_100g': 4, 'proteins': 2.14, 'proteins_100g': 2.14, 'proteins_serving': 3, 'proteins_unit': 'g', 'proteins_value': 2.14, 'salt': 0.9253, 'salt_100g': 0.9253, 'salt_serving': 1.3, 'salt_unit': 'g', 'salt_value': 0.9253, 'saturated-fat': 1.11, 'saturated-fat_100g': 1.11, 'saturated-fat_serving': 1.55, 'saturated-fat_unit': 'g', 'saturated-fat_value': 1.11, 'sodium': 0.37012, 'sodium_100g': 0.37012, 'sodium_serving': 0.518, 'sodium_unit': 'g', 'sodium_value': 0.37012, 'sugars': 5.19, 'sugars_100g': 5.19, 'sugars_serving': 7.27, 'sugars_unit': 'g', 'sugars_value': 5.19, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-a': 0, 'vitamin-a_100g': 0, 'vitamin-a_serving': 0, 'vitamin-a_unit': 'IU', 'vitamin-a_value': 0, 'vitamin-c': 0.0067, 'vitamin-c_100g': 0.0067, 'vitamin-c_serving': 0.00938, 'vitamin-c_unit': 'mg', 'vitamin-c_value': 6.7}",,Potato Salad,0,,32 oz,0,274,None,0,[],[],FALSE,no,single,,[],[],[],,273&Potato Salad&None,1
274,%017082013477%,Beef Steaks Original,jack-links,['jack-links'],[''],[''],"['en:beef', 'en:animal', 'en:water', 'en:salt', 'en:contains-2-and-less-of-flavors', 'en:brown-sugar', 'en:added-sugar', 'en:disaccharide', 'en:sugar', 'en:spice', 'en:condiment', 'en:e621', 'en:e250']","en:beef, en:animal, en:water, en:salt, en:contains-2-and-less-of-flavors, en:brown-sugar, en:added-sugar, en:disaccharide, en:sugar, en:spice, en:condiment, en:e621, en:e250","{'added-sugars': 1, 'added-sugars_100g': 4.35, 'added-sugars_serving': 1, 'added-sugars_unit': 'g', 'added-sugars_value': 1, 'calcium': 0.01, 'calcium_100g': 0.0435, 'calcium_serving': 0.01, 'calcium_unit': 'g', 'calcium_value': 0.01, 'carbohydrates': '1', 'carbohydrates_100g': 4.35, 'carbohydrates_serving': 1, 'carbohydrates_unit': 'g', 'carbohydrates_value': 1, 'cholesterol': 0.025, 'cholesterol_100g': 0.109, 'cholesterol_serving': 0.025, 'cholesterol_unit': 'g', 'cholesterol_value': 0.025, 'energy': 209, 'energy-kcal': 50, 'energy-kcal_100g': 217, 'energy-kcal_serving': 50, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 50, 'energy-kcal_value_computed': 53.5, 'energy_100g': 909, 'energy_serving': 209, 'energy_unit': 'kcal', 'energy_value': 50, 'fat': 1.5, 'fat_100g': 6.52, 'fat_serving': 1.5, 'fat_unit': 'g', 'fat_value': 1.5, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0, 'iron': 0.0008, 'iron_100g': 0.00348, 'iron_serving': 0.0008, 'iron_unit': 'g', 'iron_value': 0.0008, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'potassium': 0.12, 'potassium_100g': 0.522, 'potassium_serving': 0.12, 'potassium_unit': 'g', 'potassium_value': 0.12, 'proteins': '9', 'proteins_100g': 39.1, 'proteins_serving': 9, 'proteins_unit': 'g', 'proteins_value': 9, 'salt': 1.225, 'salt_100g': 5.33, 'salt_serving': 1.225, 'salt_unit': 'g', 'salt_value': 1.225, 'sodium': '0.49', 'sodium_100g': 2.13, 'sodium_serving': 0.49, 'sodium_unit': 'g', 'sodium_value': 0.49, 'sugars': '1', 'sugars_100g': 4.35, 'sugars_serving': 1, 'sugars_unit': 'g', 'sugars_value': 1, 'serving': '', 'calories': '', 'fats': '', 'fibers': '', 'serving_unit': '', 'calories_unit': None, 'fats_unit': '', 'fibers_unit': ''}",None,Beef Steaks Original,0,Box,None,6.98,275,3,0,[],[],FALSE,no,single,FOOD,[],[],[],,"jack-links&&&en:beef, en:animal, en:water, en:salt, en:contains-2-and-less-of-flavors, en:brown-sugar, en:added-sugar, en:disaccharide, en:sugar, en:spice, en:condiment, en:e621, en:e250&Beef Steaks Original",2
@ -293,7 +293,7 @@ ROSEMARY EXTRACT AS PRESERVATVES. "DRIED","{'calcium': 0, 'calcium_serving'
324,%q6ZO3H%,test_item,,[],[],[],[],,{},,,0,None,,0,327,0,0,[],[],FALSE,no,single,,[],[],[],,324&test_item&None,1
326,%092644690921%,test234,,[],[],[],[],,{},,,0,,,0,329,0,0,[],[],FALSE,no,single,,[],[],[],,326&test234&None,1
327,%1528952%,Penut MnM's,,[],[],[],[],,{},,,0,Box,,0,330,0,0,[],[],FALSE,no,single,,[],[],[],,327&Penut MnM's&None,1
328,%test12345678%,testitemtwo,,[],[],[],[],,{},,,0,None,,,331,0,0,[],[],FALSE,no,single,,[],[],[],,328&testitemtwo&None,5
328,%test12345678%,testitemtwo,,[],[],[],[],,{},,,0,None,,0,331,0,0,[],[],FALSE,no,single,,[],[],[],,328&testitemtwo&None,5
329,%649632001087%,"Reichel, Dippin' Stix, Sliced Apple & Caramel",Reichel Foods Inc.,['reichel-foods-inc'],"['Plant-based foods and beverages', 'Plant-based foods', 'Fruits and vegetables based foods']",['en:fruits-and-vegetables'],"['en:apples-with-calcium-ascorbate', 'en:e330', 'en:e509', 'en:caramel-dip', 'en:sweetened-condensed-skimmed-milk', 'en:dairy', 'en:milk', 'en:condensed-milk', 'en:sweetened-condensed-milk', 'en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:corn-syrup', 'en:butter', 'en:contains-2-and-less-of-water', 'en:disodium-phospahte', 'en:salt', 'en:e440a', 'en:potassium-sorbate-as-a-preservative', 'en:artificial-flavouring', 'en:flavouring', 'en:e471', 'en:e415', 'en:high-fructose-corn-syrup', 'en:monosaccharide', 'en:fructose', 'en:glucose', 'en:glucose-fructose-syrup', 'en:skimmed-milk', 'en:cream', 'en:vegetable']","Apples with calcium ascorbate, citric acid and calcium chloride. caramel dip: high fructose corn syrup, sweetened condensed skim milk (skim milk, sugar, corn syrup), sugar, corn syrup, butter (cream, salt), contains 2% or less of water, disodium phospahte, salt, pectin, potassium sorbate as a preservative, artificial flavors, mono & diglycerides (vegetable), calcium chloride, xanthan gum.","{'calcium': 0.026, 'calcium_100g': 0.026, 'calcium_serving': 0.0203, 'calcium_unit': 'mg', 'calcium_value': 26, 'carbohydrates': 29.49, 'carbohydrates_100g': 29.49, 'carbohydrates_serving': 23, 'carbohydrates_unit': 'g', 'carbohydrates_value': 29.49, 'cholesterol': 0, 'cholesterol_100g': 0, 'cholesterol_serving': 0, 'cholesterol_unit': 'mg', 'cholesterol_value': 0, 'energy': 536, 'energy-kcal': 128, 'energy-kcal_100g': 128, 'energy-kcal_serving': 99.8, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 128, 'energy-kcal_value_computed': 137.2, 'energy_100g': 536, 'energy_serving': 418, 'energy_unit': 'kcal', 'energy_value': 128, 'fat': 1.28, 'fat_100g': 1.28, 'fat_serving': 0.998, 'fat_unit': 'g', 'fat_value': 1.28, 'fiber': 1.3, 'fiber_100g': 1.3, 'fiber_serving': 1.01, 'fiber_unit': 'g', 'fiber_value': 1.3, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 0.00287224264705799, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 0.00287224264705799, 'iron': 0, 'iron_100g': 0, 'iron_serving': 0, 'iron_unit': 'mg', 'iron_value': 0, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 5, 'nutrition-score-fr_100g': 5, 'proteins': 1.28, 'proteins_100g': 1.28, 'proteins_serving': 0.998, 'proteins_unit': 'g', 'proteins_value': 1.28, 'salt': 0.1125, 'salt_100g': 0.1125, 'salt_serving': 0.0878, 'salt_unit': 'mg', 'salt_value': 112.5, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_serving': 0, 'saturated-fat_unit': 'g', 'saturated-fat_value': 0, 'sodium': 0.045, 'sodium_100g': 0.045, 'sodium_serving': 0.0351, 'sodium_unit': 'mg', 'sodium_value': 45, 'sugars': 25.64, 'sugars_100g': 25.64, 'sugars_serving': 20, 'sugars_unit': 'g', 'sugars_value': 25.64, 'trans-fat': 0, 'trans-fat_100g': 0, 'trans-fat_serving': 0, 'trans-fat_unit': 'g', 'trans-fat_value': 0, 'vitamin-a': 0, 'vitamin-a_100g': 0, 'vitamin-a_serving': 0, 'vitamin-a_unit': 'IU', 'vitamin-a_value': 0, 'vitamin-c': 0.0031, 'vitamin-c_100g': 0.0031, 'vitamin-c_serving': 0.00242, 'vitamin-c_unit': 'mg', 'vitamin-c_value': 3.1}",,"Reichel, Dippin' Stix, Sliced Apple & Caramel",0,5-Pack,,5.97,332,0,0,[],[],FALSE,no,single,None,[],[],[],,"329&Reichel, Dippin' Stix, Sliced Apple & Caramel&Reichel Foods Inc.",0
330,%850031700277%,Rest in Peach iced tea,liquid-death,['liquid-death'],"['Beverages', 'Tea-based beverages', 'Iced teas', 'Peach flavored iced teas']","['en:beverages', 'en:unsweetened-beverages']","['en:water', 'en:agave-syrup', 'en:added-sugar', 'en:disaccharide', 'en:black-tea', 'en:plant', 'en:tea', 'en:e330', 'en:natural-flavouring', 'en:flavouring', 'en:pyridoxine-hydrochloride', 'en:vitamins', 'en:vitamin-b6', 'en:cyanocobalamin', 'en:vitamin-b12', 'en:peach', 'en:fruit', 'en:prunus-species-fruit', 'en:pear', 'en:apricot']","en:water, en:agave-syrup, en:added-sugar, en:disaccharide, en:black-tea, en:plant, en:tea, en:e330, en:natural-flavouring, en:flavouring, en:pyridoxine-hydrochloride, en:vitamins, en:vitamin-b6, en:cyanocobalamin, en:vitamin-b12, en:peach, en:fruit, en:prunus-species-fruit, en:pear, en:apricot","{'carbohydrates': '7', 'carbohydrates_100g': 1.23, 'carbohydrates_serving': 7, 'carbohydrates_unit': 'g', 'carbohydrates_value': 7, 'energy': 22, 'energy-kcal': 5.2816901408451, 'energy-kcal_100g': 0.93, 'energy-kcal_serving': 5.2816901408451, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 5.2816901408451, 'energy-kcal_value_computed': 28, 'energy_100g': 3.87, 'energy_serving': 22, 'energy_unit': 'kcal', 'energy_value': 5.2816901408451, 'fat': 0, 'fat_100g': 0, 'fat_serving': 0, 'fat_unit': 'g', 'fat_value': 0, 'fiber': 0, 'fiber_100g': 0, 'fiber_serving': 0, 'fiber_unit': 'g', 'fiber_value': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 2.5, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 2.5, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 2.5, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 2.5, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'nutrition-score-fr': 2, 'nutrition-score-fr_100g': 2, 'proteins': '0', 'proteins_100g': 0, 'proteins_serving': 0, 'proteins_unit': 'g', 'proteins_value': 0, 'salt': 0.0381, 'salt_100g': 0.00671, 'salt_serving': 0.0381, 'salt_unit': 'mg', 'salt_value': 38.1, 'saturated-fat': 0, 'saturated-fat_100g': 0, 'saturated-fat_serving': 0, 'saturated-fat_unit': 'g', 'saturated-fat_value': 0, 'sodium': '0.01524', 'sodium_100g': 0.00268, 'sodium_serving': 0.01524, 'sodium_unit': 'mg', 'sodium_value': 15.24, 'sugars': '6', 'sugars_100g': 1.06, 'sugars_serving': 6, 'sugars_unit': 'g', 'sugars_value': 6, 'serving': '', 'calories': '', 'fats': '', 'fibers': '', 'serving_unit': '', 'calories_unit': None, 'fats_unit': '', 'fibers_unit': ''}",Aluminium,Rest in Peach iced tea,0,None,None,0,333,None,0,[],[],FALSE,no,single,FOOD,[],[],[],,330&Rest in Peach iced tea&liquid-death,0
331,%040000588924%,Peanut Butter M&M Minis,Mars,['mars'],[],[],"['en:milk-chocolate', 'en:chocolate', 'en:sugar', 'en:added-sugar', 'en:disaccharide', 'en:peanut-paste', 'en:nut', 'en:peanut', 'en:palm-oil', 'en:oil-and-fat', 'en:vegetable-oil-and-fat', 'en:palm-oil-and-fat', 'en:sunflower-vegetable-oil-oils', 'en:hydrogenated-palm-kernel-oil', 'en:palm-kernel-oil-and-fat', 'en:palm-kernel-oil', 'en:milk', 'en:dairy', 'en:lactose', 'en:milkfat', 'en:fat', 'en:soya-lecithin', 'en:e322', 'en:e322i', 'en:salt', 'en:natural-flavouring', 'en:flavouring', 'en:partially-defatted-peanues', 'en:co-butter']","milk chocolate (sugar: co butter, chocolate, milk, lactose, peanuts, milkfat, soy lecithin, salt, natural flavor), sugar, peanut butter (partially defatted peanues, palm oil), vegetable oil palm and sunflower oils) and/or hydrogenated palm kernel oil","{'added-sugars': 14, 'added-sugars_100g': 45.2, 'added-sugars_serving': 14, 'added-sugars_unit': 'g', 'added-sugars_value': 14, 'carbohydrates': 17, 'carbohydrates_100g': 54.8, 'carbohydrates_serving': 17, 'carbohydrates_unit': 'g', 'carbohydrates_value': 17, 'energy': 669, 'energy-kcal': 160, 'energy-kcal_100g': 516, 'energy-kcal_serving': 160, 'energy-kcal_unit': 'kcal', 'energy-kcal_value': 160, 'energy-kcal_value_computed': 163, 'energy_100g': 2160, 'energy_serving': 669, 'energy_unit': 'kcal', 'energy_value': 160, 'fat': 9, 'fat_100g': 29, 'fat_serving': 9, 'fat_unit': 'g', 'fat_value': 9, 'fiber': 1, 'fiber_100g': 3.23, 'fiber_serving': 1, 'fiber_unit': 'g', 'fiber_value': 1, 'fruits-vegetables-legumes-estimate-from-ingredients_100g': 0, 'fruits-vegetables-legumes-estimate-from-ingredients_serving': 0, 'fruits-vegetables-nuts-estimate-from-ingredients_100g': 12.181712962963, 'fruits-vegetables-nuts-estimate-from-ingredients_serving': 12.181712962963, 'iron': 0.0004, 'iron_100g': 0.00129, 'iron_serving': 0.0004, 'iron_unit': 'g', 'iron_value': 0.0004, 'nova-group': 4, 'nova-group_100g': 4, 'nova-group_serving': 4, 'potassium': 0.1, 'potassium_100g': 0.323, 'potassium_serving': 0.1, 'potassium_unit': 'g', 'potassium_value': 0.1, 'proteins': 3, 'proteins_100g': 9.68, 'proteins_serving': 3, 'proteins_unit': 'g', 'proteins_value': 3, 'salt': 0.1625, 'salt_100g': 0.524, 'salt_serving': 0.1625, 'salt_unit': 'g', 'salt_value': 0.1625, 'saturated-fat': 4.5, 'saturated-fat_100g': 14.5, 'saturated-fat_serving': 4.5, 'saturated-fat_unit': 'g', 'saturated-fat_value': 4.5, 'sodium': 0.065, 'sodium_100g': 0.21, 'sodium_serving': 0.065, 'sodium_unit': 'g', 'sodium_value': 0.065, 'sugars': 15, 'sugars_100g': 48.4, 'sugars_serving': 15, 'sugars_unit': 'g', 'sugars_value': 15, 'vitamin-a': 0, 'vitamin-a_100g': 0, 'vitamin-a_serving': 0, 'vitamin-a_unit': 'g', 'vitamin-a_value': 0, 'vitamin-d': 0, 'vitamin-d_100g': 0, 'vitamin-d_serving': 0, 'vitamin-d_unit': 'g', 'vitamin-d_value': 0}",,Peanut Butter M&M Minis,0,,,0,334,None,0,[],[],FALSE,no,single,,[],[],[],,331&Peanut Butter M&M Minis&Mars,0

Can't render this file because it is too large.

19
MyDataclasses,py Normal file
View File

@ -0,0 +1,19 @@
from dataclasses import dataclass, field
import json
from database import lst2pgarr
@dataclass
class LogisticsInfoPayload:
barcode: str
primary_location: str
auto_issue_location: str
dynamic_locations: dict = field(default_factory=dict)
location_data: dict = field(default_factory=dict)
quantity_on_hand: float = 0.0
def payload(self):
if self.barcode or self.primary_location or self.auto_issue == None:
raise Exception("have to set values")
return (self.barcode, self.primary_location, self.auto_issue_location,
json.dumps(self.dynamic_locations), json.dumps(self.location_data),
self.quantity_on_hand)

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@ password = test
port = 5432
[manage]
sites = Backpack,main
sites = main
first_setup = False
signup_enabled = False

474
database.py Normal file
View File

@ -0,0 +1,474 @@
class DatabaseError(Exception):
def __init__(self, message, payload=[], sql=""):
super().__init__(message)
self.payload = payload
self.message = message
self.sql = sql
def __str__(self):
return f"DatabaseError(message='{self.message}', payload={self.payload}, sql='{self.sql}')"
def tupleDictionaryFactory(columns, row):
columns = [desc[0] for desc in columns]
return dict(zip(columns, row))
def lst2pgarr(alist):
return '{' + ','.join(alist) + '}'
# -------------------------
# Insert Database Functions
# -------------------------
def insertLoginsTuple(conn, payload, convert=False):
"""Inserts payload into logins table
Args:
conn (_T_connector@connect): Postgresql Connector
payload (tuple): (username[str], password[str], email[str])
convert (bool, optional): deteremines if to return tuple as dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted login
"""
login = ()
with open(f"sql/INSERT/insertLoginsTuple.sql", "r+") as file:
sql = file.read()
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
login = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
login = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return login
def insertGroupsTuple(conn, site, payload, convert=False):
"""insert into groups table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (stre):
payload (tuple): (name[str], description[str], included_items[lst2pgarr], group_type[str])
convert (bool, optional): Determines if to return tuple as a dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
group = ()
with open(f"sql/INSERT/insertGroupsTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
group = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
group = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return group
def insertLogisticsInfoTuple(conn, site, payload, convert=False):
"""insert payload into logistics_info table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (barcode[str], primary_location[str], auto_issue_location[str], dynamic_locations[jsonb],
location_data[jsonb], quantity_on_hand[float])
convert (bool, optional): Determines if to return tuple as dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
logistics_info = ()
with open(f"sql/INSERT/insertLogisticsInfoTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
logistics_info = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
logistics_info = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return logistics_info
def insertItemInfoTuple(conn, site, payload, convert=False):
"""inserts payload into the item_info table of site
Args:
conn (_T_connector@connect): Postgresql Connector
site_name (str):
payload (tuple): (barcode[str], linked_items[lst2pgarr], shopping_lists[lst2pgarr], recipes[lst2pgarr], groups[lst2pgarr],
packaging[str], uom[str], cost[float], safety_stock[float], lead_time_days[float], ai_pick[bool])
convert (bool optional): Determines if to return tuple as dictionary. DEFAULTS to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
item_info = ()
with open(f"sql/INSERT/insertItemInfoTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
item_info = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
item_info = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return item_info
def insertFoodInfoTuple(conn, site, payload, convert=False):
"""insert payload into food_info table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (_type_): (ingrediants[lst2pgarr], food_groups[lst2pgarr], nutrients[jsonstr], expires[bool])
convert (bool, optional): Determines if to return tuple as dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
food_info = ()
with open(f"sql/INSERT/insertFoodInfoTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
food_info = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
food_info = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return food_info
def insertBrandsTuple(conn, site, payload, convert=False):
"""insert payload into brands table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (brand_name[str], )
convert (bool, optional): Determines if the tuple is returned as a dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
brand = ()
with open(f"sql/INSERT/insertBrandsTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
brand = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
brand = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return brand
def insertItemTuple(conn, site, payload, convert=False):
"""insert payload into items table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (barcode[str], item_name[str], brand[int], description[str],
tags[lst2pgarr], links[jsonb], item_info_id[int], logistics_info_id[int],
food_info_id[int], row_type[str], item_type[str], search_string[str])
convert (bool, optional): Determines if to return tuple as a dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
item = ()
with open(f"sql/INSERT/insertItemTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
item = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
item = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return item
def insertItemLocationsTuple(conn, site, payload, convert=False):
"""insert payload into item_locations table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (part_id[int], location_id[int], quantity_on_hand[float], cost_layers[lst2pgarr])
convert (bool, optional): Determines if to return tuple as dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
location = ()
with open(f"sql/INSERT/insertItemLocationsTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
location = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
location = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return location
def insertCostLayersTuple(conn, site, payload, convert=False):
"""insert payload into cost_layers table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (aquisition_date[timestamp], quantity[float], cost[float], currency_type[str], expires[timestamp/None], vendor[int])
convert (bool, optional): Determines if tuple is returned as a dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
cost_layer = ()
with open(f"sql/INSERT/insertCostLayersTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
cost_layer = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
cost_layer = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return cost_layer
def insertTransactionsTuple(conn, site, payload, convert=False):
"""insert payload into transactions table for site
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (timestamp[timestamp], logistics_info_id[int], barcode[str], name[str],
transaction_type[str], quantity[float], description[str], user_id[int], data[jsonb])
convert (bool, optional): Determines if to return tuple as dictionary. Defaults to False.
Raises:
DatabaseError:
Returns:
tuple or dict: inserted tuple
"""
transaction = ()
with open(f"sql/INSERT/insertTransactionsTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows and convert:
transaction = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
transaction = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return transaction
# -------------------------
# Update Database Functions
# -------------------------
def updateItemLocation(conn, site, payload):
item_location = ()
with open(f"sql/updateItemLocation.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows:
item_location = rows
except Exception as error:
return error
return item_location
def updateCostLayersTuple(conn, site, payload):
"""_summary_
Args:
conn (_type_): _description_
site (_type_): _description_
payload (_type_): _description_
Returns:
_type_: _description_
"""
cost_layer = ()
with open(f"sql/updateCostLayersTuple.sql", "r+") as file:
sql = file.read().replace("%%site_name%%", site)
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows:
cost_layer = rows
except Exception as error:
return error
return cost_layer
# -------------------------
# Delete Database Functions
# -------------------------
def deleteCostLayersTuple(conn, site_name, payload):
"""deletes tuple from cost_layers table for site_name
Args:
conn (_T_connector@connect): Postgresql Connector
site (str):
payload (tuple): (cost_layer_id, )
Raises:
DatabaseError: returns all database errors and encompasses payload and sql info.
Returns:
tuple: deleted row returned as a tuple
"""
cost_layer = ()
sql = f"WITH deleted_row AS (DELETE FROM {site_name}_cost_layers WHERE id=%s RETURNING *) SELECT * FROM deleted_row;"
try:
with conn.cursor() as cur:
cur.execute(sql, payload)
rows = cur.fetchone()
if rows:
cost_layer = rows
except Exception as error:
raise DatabaseError(error, payload, sql)
return cost_layer
# -------------------------
# Select Database Functions
# -------------------------
def selectItemLocationsTuple(conn, site_name, payload, convert=False):
"""select a single tuple from ItemLocations table for site_name
Args:
conn (_T_connector@connect):
site_name (str):
payload (tuple): [item_id, location_id]
convert (bool): defaults to False, used to determine return of tuple/dict
Returns:
tuple: the row that was returned from the table
"""
item_locations = ()
select_item_location_sql = f"SELECT * FROM {site_name}_item_locations WHERE part_id = %s AND location_id = %s;"
try:
with conn.cursor() as cur:
cur.execute(select_item_location_sql, payload)
rows = cur.fetchone()
if rows and convert:
item_locations = tupleDictionaryFactory(cur.description, rows)
elif rows and not convert:
item_locations = rows
except Exception as error:
return error
return item_locations
def selectCostLayersTuple(conn, site_name, payload, convert=False):
"""select a single or series of cost layers from the database for site_name
Args:
conn (_T_connector@connect):
site_name (str):
payload (tuple): (item_locations_id, )
convert (bool): defaults to False, used for determining return as tuple/dict
Returns:
list: list of tuples/dict from the cost_layers table for site_name
"""
cost_layers = ()
select_cost_layers_sql = f"SELECT cl.* FROM {site_name}_item_locations il JOIN {site_name}_cost_layers cl ON cl.id = ANY(il.cost_layers) where il.id=%s;"
try:
with conn.cursor() as cur:
cur.execute(select_cost_layers_sql, payload)
rows = cur.fetchall()
if rows and convert:
cost_layers = rows
cost_layers = [tupleDictionaryFactory(cur.description, layer) for layer in rows]
elif rows and not convert:
cost_layers = rows
except Exception as error:
return error
return cost_layers
# -------------------------
# Custom Database Functions
# -------------------------
def getItemLocation(conn, site_name, payload):
"""This functions returns the bundled ItemLocation of item_id and location_id, with the cost_layers pulled from the database as tuples.
Args:
conn (_T_connector@connect):
site_name (str):
payload (tuple): [item_id, location_id]
Returns:
list: list of the itemLocation with cost_layers selected
"""
item_location = list(selectItemLocationsTuple(conn, site_name, payload))
print(item_location)
item_location[4] = selectCostLayersTuple(conn, site_name, (item_location[0], ))
return item_location

View File

@ -400,6 +400,7 @@ def delete_site(site_name):
drop_table(f'sites/{site_name}/sql/drop/item_info.sql')
drop_table(f'sites/{site_name}/sql/drop/items.sql')
drop_table(f'sites/{site_name}/sql/drop/groups.sql')
drop_table(f'sites/{site_name}/sql/drop/cost_layers.sql')
drop_table(f'sites/{site_name}/sql/drop/linked_items.sql')
drop_table(f'sites/{site_name}/sql/drop/transactions.sql')
drop_table(f'sites/{site_name}/sql/drop/brands.sql')
@ -421,6 +422,7 @@ def create_site(site_name, admin_user: tuple, default_zone, default_primary, def
create_table(f"sites/{site_name}/sql/create/roles.sql")
create_table(f'sites/{site_name}/sql/create/groups.sql')
create_table(f'sites/{site_name}/sql/create/cost_layers.sql')
create_table(f'sites/{site_name}/sql/create/linked_items.sql')
create_table(f'sites/{site_name}/sql/create/brands.sql')
create_table(f'sites/{site_name}/sql/create/food_info.sql')

View File

@ -1,25 +1,250 @@
from config import config
import psycopg2, requests
import main, datetime, json
import psycopg2, requests, database
import main, datetime, json, csv
from main import lst2pgarr
headers = []
test = []
with open("2024-10-02-Pantry.csv", "r+", encoding="utf-8") as file:
csv_reader = csv.DictReader(file)
for row in csv_reader:
try:
if row['id'] == "430":
test = row
except:
pass
# print(test)
# order_of_operations
# create_logistics
# create_item_info
# create_food_info
# create_brand_info
# return id of each and save, check to make sure you have id for each else drop out and do not commit
site_name = "main"
defaults = config(filename=f"sites/{site_name}/site.ini", section="defaults")
uuid = f"{defaults["default_zone"]}@{defaults["default_primary_location"]}"
logistics_info_payload = [
test['barcode'],
uuid,
uuid,
json.dumps({}), # dynamic_locations
json.dumps({}), # location_data
0.0 # quantity_on_hand
]
item_info_payload = [
test['barcode'],
lst2pgarr([]), # linked_items
lst2pgarr([]), # shopping_lists
lst2pgarr([]), # recipes
lst2pgarr([]), # groups
test['packaging'], # packaging
test['product_quantity_unit'], # uom
test['cost'], # cost
test['safety_stock'], # safety_stock
test['lead_time'], # lead_time_days
False # ai_pick
]
# Food Info
t = ['serving', 'serving_unit', 'calories', 'calories_unit', 'proteins',
'proteins_unit', 'fats', 'fats_unit', 'carbohydrates', 'carbohydrates_unit', 'sugars', 'sugars_unit', 'sodium', 'sodium_unit',
'fibers', 'fibers_unit']
other_tags = [
'serving',
'serving_unit',
'calories',
'calories_unit',
'proteins_serving',
'proteins_unit',
'fat_serving',
'fat_unit',
'carbohydrates_serving',
'carbohydrates_unit',
'sugars_serving',
'sugars_unit',
'sodium_serving',
'sodium_unit',
'fiber_serving',
'fiber_unit',
]
nutriments = test['nutriments'].replace("'", '"')
nutriments = nutriments.replace("{", "").replace("}", "")
key_values = nutriments.split(", ")
nutriments = {}
if key_values != ['']:
for s in key_values:
s= s.split(": ")
k = s[0].replace('"', "")
v = s[1].replace('"', "")
nutriments[k] = v
nutrients = {}
for i in range(len(other_tags)):
if other_tags[i] in nutriments.keys():
nutrients[t[i]] = nutriments[other_tags[i]]
else:
nutrients[t[i]] = ''
food_groups = test['food_groups_tags']
food_groups = food_groups.replace('[', "").replace("]", "")
food_groups = food_groups.replace("'", "")
food_groups = food_groups.split(", ")
ingrediants = test['ingredients_hierarchy']
ingrediants = ingrediants.replace('[', "").replace("]", "")
ingrediants = ingrediants.replace("'", "")
ingrediants = ingrediants.split(", ")
food_info_payload = [
lst2pgarr(food_groups), # food_groups
lst2pgarr(ingrediants), # ingrediants
json.dumps(nutrients),
False # expires
]
brand_payload = [test['brands'],]
logistics_info_id = 0
item_info_id = 0
food_info_id = 0
brand_id = 0
database_config = config()
with psycopg2.connect(**database_config) as conn:
logistics_info = database.insertLogisticsInfoTuple(conn, "main", logistics_info_payload)
item_info = database.insertItemInfoTuple(conn, "main", item_info_payload)
food_info = database.insertFoodInfoTuple(conn, "main", food_info_payload)
brand = database.insertBrandsTuple(conn, "main", brand_payload)
# update user with site_id and admin role.
sqlfile = open('sites/main/sql/unique/shopping_lists_safetystock_uncalculated.sql', "r+")
sql = sqlfile.readlines()
sql = "\n".join(sql)
sqlfile.close()
try:
with conn.cursor() as cur:
cur.execute(sql, (1, ))
x = cur.fetchall()
for _ in x:
print(_)
print("Logistics:", logistics_info)
print("item_info:", item_info)
print("food_info:", food_info)
print("brand:", brand)
except (Exception, psycopg2.DatabaseError) as error:
print(error)
conn.rollback()
name = test['name']
name = name.replace("'", "@&apostraphe&")
description = ""
tags = lst2pgarr([])
links = json.dumps({})
search_string = f"{test['barcode']}&{name}"
item_payload = [
test['barcode'],
test['name'],
brand[0],
description,
tags,
links,
item_info[0],
logistics_info[0],
food_info[0],
"single",
test["sub_type"],
search_string
]
print("Item:", item_payload)
item = database.insertItemTuple(conn, "main", item_payload)
print(item)
with conn.cursor() as cur:
cur.execute(f"SELECT id FROM {site_name}_locations WHERE uuid=%s;", (uuid, ))
location_id = cur.fetchone()[0]
print("Location ID:", location_id)
item_location_payload = [
item[0],
location_id,
0.0,
main.lst2pgarr([])
]
location = database.insertItemLocationsTuple(conn, site_name, item_location_payload)
print("Item location:", location)
creation_payload = [
datetime.datetime.now(),
logistics_info[0],
test['barcode'],
name,
"SYSTEM",
0.0,
"Item Added to System!",
1,
json.dumps({'location': uuid})
]
transaction = database.insertTransactionsTuple(conn, site_name, creation_payload)
print("transaction:", transaction)
qoh = float(test['qty_on_hand'])
print(qoh, type(qoh))
if qoh != 0.0:
if qoh >= 0.0:
trans_type = "Adjust In"
else:
trans_type = "Adjust Out"
adjustment_payload = [
datetime.datetime.now(),
logistics_info[0],
test['barcode'],
name,
trans_type,
qoh,
"",
1,
json.dumps({'location': uuid, 'cost': item_info[8]})
]
transaction = database.insertTransactionsTuple(conn, site_name, adjustment_payload)
print("transaction:", transaction)
cost_layer_payload = [
datetime.datetime.now(),
float(qoh),
float(test['cost']),
'USD',
None,
0
]
print(cost_layer_payload)
cost_layer = database.insertCostLayersTuple(conn, site_name, cost_layer_payload)
print("cost_layer:", cost_layer)
layer_payload = [
cost_layer[0],
float(location[3]) + float(qoh),
location_id, # location_id
item[0] # part_id
]
print(layer_payload)
location = database.updateItemLocation(conn, site_name, layer_payload)
print(location)
print("\n")
conn.commit()
# need to insert into Item_Locations, part_id and location id
qoh = float(test['qty_on_hand'])
# transact qoh into the system

View File

@ -1,9 +0,0 @@
[site]
site_name=Backpack
site_owner=jadowyne
email=
[defaults]
default_zone=MAIN
default_primary_location=POUCH A
default_auto_issue_location=POUCH A

View File

@ -1,4 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_brands (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);

View File

@ -1,7 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_food_info (
id SERIAL PRIMARY KEY,
food_groups TEXT [],
ingrediants TEXT [],
nutrients JSONB,
expires BOOLEAN
);

View File

@ -1,8 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_groups(
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
included_items INTEGER [],
group_type VARCHAR(255),
UNIQUE (name)
);

View File

@ -1,32 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_items(
id SERIAL PRIMARY KEY,
barcode VARCHAR(255) NOT NULL,
item_name VARCHAR(255) NOT NULL,
brand INTEGER,
description TEXT,
tags TEXT [],
links JSONB,
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 Backpack_item_info(id)
ON DELETE CASCADE,
CONSTRAINT fk_food_info
FOREIGN KEY(food_info_id)
REFERENCES Backpack_food_info(id)
ON DELETE CASCADE,
CONSTRAINT fk_brand
FOREIGN KEY(brand)
REFERENCES Backpack_brands(id)
ON DELETE CASCADE,
CONSTRAINT fk_logistics_info
FOREIGN KEY(logistics_info_id)
REFERENCES Backpack_logistics_info(id)
ON DELETE CASCADE
);

View File

@ -1,15 +0,0 @@
CREATE TABLE IF NOt EXISTS Backpack_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)
);

View File

@ -1,23 +0,0 @@
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'cost_layer') THEN
CREATE TYPE cost_layer AS (qty FLOAT8, cost FLOAT8);
END IF;
END $$;
CREATE TABLE IF NOT EXISTS Backpack_item_locations(
id SERIAL PRIMARY KEY,
part_id INTEGER NOT NULL,
location_id INTEGER NOT NULL,
quantity_on_hand FLOAT8 NOT NULL,
cost_layers cost_layer[],
UNIQUE(part_id, location_id),
CONSTRAINT fk_part_id
FOREIGN KEY(part_id)
REFERENCES Backpack_items(id)
ON DELETE CASCADE,
CONSTRAINT fk_location_id
FOREIGN KEY(location_id)
REFERENCES Backpack_locations(id)
ON DELETE CASCADE
);

View File

@ -1,8 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_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)
);

View File

@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_locations(
id SERIAL PRIMARY KEY,
uuid VARCHAR(255) NOT NULL,
name VARCHAR(32) NOT NULL,
zone_id INTEGER NOT NULL,
items JSONB,
UNIQUE(uuid),
CONSTRAINT fk_zone
FOREIGN KEY(zone_id)
REFERENCES Backpack_zones(id)
);

View File

@ -1,22 +0,0 @@
CREATE TABLE IF NOT EXISTS logins(
id SERIAL PRIMARY KEY,
username VARCHAR(255),
password VARCHAR(255),
email VARCHAR(255) UNIQUE NOT NULL,
favorites JSONB DEFAULT '{}',
unseen_pantry_items INTEGER [] DEFAULT '{}',
unseen_groups INTEGER [] DEFAULT '{}',
unseen_shopping_lists INTEGER [] DEFAULT '{}',
unseen_recipes INTEGER [] DEFAULT '{}',
seen_pantry_items INTEGER [] DEFAULT '{}',
seen_groups INTEGER[] DEFAULT '{}',
seen_shopping_lists INTEGER [] DEFAULT '{}',
seen_recipes INTEGER [] DEFAULT '{}',
sites INTEGER [] DEFAULT '{}',
site_roles INTEGER [] DEFAULT '{}',
system_admin BOOLEAN DEFAULT FALSE,
flags JSONB DEFAULT '{}',
UNIQUE(username),
CHECK (email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')
);

View File

@ -1,10 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_logistics_info(
id SERIAL PRIMARY KEY,
barcode VARCHAR(255) NOT NULL,
primary_location VARCHAR(64),
auto_issue_location VARCHAR(64),
dynamic_locations JSONB,
location_data JSONB,
quantity_on_hand FLOAT8 NOT NULL,
UNIQUE(barcode)
);

View File

@ -1,13 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_receipt_items (
id SERIAL PRIMARY KEY,
type VARCHAR(255) NOT NULL,
receipt_id INTEGER NOT NULL,
barcode VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
qty FLOAT8 NOT NULL,
data JSONB,
status VARCHAR (64),
CONSTRAINT fk_receipt
FOREIGN KEY(receipt_id)
REFERENCES Backpack_receipts(id)
);

View File

@ -1,13 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_receipts (
id SERIAL PRIMARY KEY,
receipt_id VARCHAR (32) NOT NULL,
receipt_status VARCHAR (64) NOT NULL,
date_submitted TIMESTAMP NOT NULL,
submitted_by INTEGER NOT NULL,
vendor_id INTEGER,
files JSONB,
UNIQUE(receipt_id),
CONSTRAINT fk_vendor
FOREIGN KEY(vendor_id)
REFERENCES Backpack_vendors(id)
);

View File

@ -1,12 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_recipes (
id SERIAL PRIMARY KEY,
name VARCHAR,
author INTEGER,
description TEXT,
creation_date TIMESTAMP,
custom_items JSONB,
pantry_items JSONB,
group_items JSONB,
instructions TEXT [],
picture_path TEXT
);

View File

@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS roles(
id SERIAL PRIMARY KEY,
role_name VARCHAR(255) NOT NULL,
role_description TEXT,
site_id INTEGER NOT NULL,
flags JSONB DEFAULT '{}',
UNIQUE(role_name, site_id),
CONSTRAINT fk_site
FOREIGN KEY(site_id)
REFERENCES sites(id)
);

View File

@ -1,14 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_shopping_lists (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
pantry_items INTEGER [],
custom_items JSONB,
recipes INTEGER [],
groups INTEGER [],
quantities JSONB,
author INTEGER,
creation_date TIMESTAMP,
type VARCHAR(64),
UNIQUE(name)
);

View File

@ -1,15 +0,0 @@
CREATE TABLE IF NOT EXISTS sites (
id SERIAL PRIMARY KEY,
site_name VARCHAR(120),
site_description TEXT,
creation_date TIMESTAMP,
site_owner_id INTEGER NOT NULL,
flags JSONB,
default_zone VARCHAR(32),
default_auto_issue_location VARCHAR(32),
default_primary_location VARCHAR(32),
UNIQUE(site_name),
CONSTRAINT fk_site_owner
FOREIGN KEY(site_owner_id)
REFERENCES logins(id)
);

View File

@ -1,15 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_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 Backpack_logistics_info(id)
);

View File

@ -1,8 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_vendors (
id SERIAL PRIMARY KEY,
vendor_name VARCHAR(255) NOT NULL,
vendor_address VARCHAR(255),
creation_date TIMESTAMP NOT NULL,
created_by INTEGER NOT NULL,
phone_number VARCHAR(32)
);

View File

@ -1,5 +0,0 @@
CREATE TABLE IF NOT EXISTS Backpack_zones(
id SERIAL PRIMARY KEY,
name VARCHAR(32) NOT NULL,
UNIQUE(name)
);

View File

@ -1 +0,0 @@
DROP TABLE Backpack_brands CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_food_info CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_groups CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_item_info CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_item_locations CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_items CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_itemlinks CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_locations CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_logistics_info CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_receipt_items CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_receipts CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_recipes CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_shopping_lists CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_transactions CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_vendors CASCADE;

View File

@ -1 +0,0 @@
DROP TABLE Backpack_zones CASCADE;

View File

@ -1,3 +0,0 @@
UPDATE Backpack_logistics_info
SET quantity_on_hand = %s, location_data = %s
WHERE id = %s;

View File

@ -1,45 +0,0 @@
SELECT * FROM Backpack_items
LEFT JOIN Backpack_logistics_info ON Backpack_items.logistics_info_id = Backpack_logistics_info.id
LEFT JOIN Backpack_item_info ON Backpack_items.item_info_id = Backpack_item_info.id
LEFT JOIN Backpack_food_info ON Backpack_items.food_info_id = Backpack_food_info.id
WHERE Backpack_items.id=%s;
/*
00 - item_id
01 - barcode
02 - item_name
03 - brand (id)
04 - description
05 - tags
06 - links
07 - item_info_id
08 - logistics_info_id
09 - food_info_id
10 - row_type
11 - item_type
12 - search_string
13 - logistics_info_id
14 - barcode
15 - primary_location
16 - auto_issue_location
17 - dynamic_locations
18 - location_data
19 - quantity_on_hand
20 - item_info_id
21 - barcode
22 - linked_items
23 - shopping_lists
24 - recipes
25 - groups
26 - packaging
27 - uom
28 - cost
29 - safety_stock
30 - lead_time_days
31 - ai_pick
32 - food_info_id
33 - food_groups
34 - ingrediants
35 - nutrients
36 - expires
*/

View File

@ -1,45 +0,0 @@
SELECT * FROM Backpack_items
LEFT JOIN Backpack_logistics_info ON Backpack_items.logistics_info_id = Backpack_logistics_info.id
LEFT JOIN Backpack_item_info ON Backpack_items.item_info_id = Backpack_item_info.id
LEFT JOIN Backpack_food_info ON Backpack_items.food_info_id = Backpack_food_info.id
WHERE Backpack_items.barcode=%s;
/*
00 - item_id
01 - barcode
02 - item_name
03 - brand (id)
04 - description
05 - tags
06 - links
07 - item_info_id
08 - logistics_info_id
09 - food_info_id
10 - row_type
11 - item_type
12 - search_string
13 - logistics_info_id
14 - barcode
15 - primary_location
16 - auto_issue_location
17 - dynamic_locations
18 - location_data
19 - quantity_on_hand
20 - item_info_id
21 - barcode
22 - linked_items
23 - shopping_lists
24 - recipes
25 - groups
26 - packaging
27 - uom
28 - cost
29 - safety_stock
30 - lead_time_days
31 - ai_pick
32 - food_info_id
33 - food_groups
34 - ingrediants
35 - nutrients
36 - expires
*/

View File

@ -1,3 +0,0 @@
UPDATE Backpack_locations
SET items = %s
WHERE id = %s;

View File

@ -1,43 +0,0 @@
WITH sum_cte AS (
SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum
FROM Backpack_item_locations mil
JOIN Backpack_items mi ON mil.part_id = mi.id
GROUP BY mi.id
)
SELECT *
FROM Backpack_items
LEFT JOIN Backpack_item_info ON Backpack_items.item_info_id = Backpack_item_info.id
LEFT JOIN sum_cte ON Backpack_items.id = sum_cte.id
WHERE Backpack_item_info.safety_stock > COALESCE(sum_cte.total_sum, 0)
AND Backpack_item_info.shopping_lists @> ARRAY[%s];
/*
00 - item_id
01 - barcode
02 - item_name
03 - brand (id)
04 - description
05 - tags
06 - links
07 - item_info_id
08 - logistics_info_id
09 - food_info_id
10 - row_type
11 - item_type
12 - search_string
13 - item_info_id
14 - barcode
15 - linked_items
16 - shopping_lists
17 - recipes
18 - groups
19 - packaging
20 - uom
21 - cost
22 - safety_stock
23 - lead_time_days
24 - ai_pick
25 - sum_cte_id
26 - total_sum/QOH
*/

View File

@ -1,12 +0,0 @@
WITH sum_cte AS (
SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum
FROM Backpack_item_locations mil
JOIN Backpack_items mi ON mil.part_id = mi.id
GROUP BY mi.id
)
SELECT COUNT(*)
FROM Backpack_items
LEFT JOIN Backpack_item_info ON Backpack_items.item_info_id = Backpack_item_info.id
LEFT JOIN sum_cte ON Backpack_items.id = sum_cte.id
WHERE Backpack_item_info.safety_stock > COALESCE(sum_cte.total_sum, 0)
AND Backpack_item_info.shopping_lists @> ARRAY[%s];

View File

@ -1,11 +0,0 @@
WITH sum_cte AS (
SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum
FROM Backpack_item_locations mil
JOIN Backpack_items mi ON mil.part_id = mi.id
GROUP BY mi.id
)
SELECT *
FROM Backpack_items
LEFT JOIN Backpack_item_info ON Backpack_items.item_info_id = Backpack_item_info.id
LEFT JOIN sum_cte ON Backpack_items.id = sum_cte.id
WHERE Backpack_item_info.shopping_lists @> ARRAY[%s];

View File

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS %sitename%_cost_layers (
id SERIAL PRIMARY KEY,
aquisition_date TIMESTAMP NOT NULL,
quantity FLOAT8 NOT NULL,
cost FLOAT8 NOT NULL,
currency_type VARCHAR(16) NOT NULL,
expires TIMESTAMP,
vendor INTEGER DEFAULT 0
);

View File

@ -1,16 +1,9 @@
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'cost_layer') THEN
CREATE TYPE cost_layer AS (qty FLOAT8, cost FLOAT8);
END IF;
END $$;
CREATE TABLE IF NOT EXISTS %sitename%_item_locations(
id SERIAL PRIMARY KEY,
part_id INTEGER NOT NULL,
location_id INTEGER NOT NULL,
quantity_on_hand FLOAT8 NOT NULL,
cost_layers cost_layer[],
cost_layers INTEGER[] DEFAULT '{}',
UNIQUE(part_id, location_id),
CONSTRAINT fk_part_id
FOREIGN KEY(part_id)

View File

@ -0,0 +1 @@
DROP TABLE %sitename%_cost_layers CASCADE;

View File

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS main_cost_layers (
id SERIAL PRIMARY KEY,
aquisition_date TIMESTAMP NOT NULL,
quantity FLOAT8 NOT NULL,
cost FLOAT8 NOT NULL,
currency_type VARCHAR(16) NOT NULL,
expires TIMESTAMP,
vendor INTEGER DEFAULT 0
);

View File

@ -1,16 +1,9 @@
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'cost_layer') THEN
CREATE TYPE cost_layer AS (qty FLOAT8, cost FLOAT8);
END IF;
END $$;
CREATE TABLE IF NOT EXISTS main_item_locations(
id SERIAL PRIMARY KEY,
part_id INTEGER NOT NULL,
location_id INTEGER NOT NULL,
quantity_on_hand FLOAT8 NOT NULL,
cost_layers cost_layer[],
cost_layers INTEGER[] DEFAULT '{}',
UNIQUE(part_id, location_id),
CONSTRAINT fk_part_id
FOREIGN KEY(part_id)

View File

@ -0,0 +1 @@
DROP TABLE main_cost_layers CASCADE;

View File

@ -10,3 +10,34 @@ LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id
LEFT JOIN sum_cte ON main_items.id = sum_cte.id
WHERE main_item_info.safety_stock > COALESCE(sum_cte.total_sum, 0)
AND main_item_info.shopping_lists @> ARRAY[%s];
/*
00 - item_id
01 - barcode
02 - item_name
03 - brand (id)
04 - description
05 - tags
06 - links
07 - item_info_id
08 - logistics_info_id
09 - food_info_id
10 - row_type
11 - item_type
12 - search_string
13 - item_info_id
14 - barcode
15 - linked_items
16 - shopping_lists
17 - recipes
18 - groups
19 - packaging
20 - uom
21 - cost
22 - safety_stock
23 - lead_time_days
24 - ai_pick
25 - sum_cte_id
26 - total_sum/QOH
*/

View File

@ -0,0 +1,4 @@
INSERT INTO %%site_name%%_brands
(name)
VALUES (%s)
RETURNING *;

View File

@ -0,0 +1,4 @@
INSERT INTO %%site_name%%_cost_layers
(aquisition_date, quantity, cost, currency_type, expires, vendor)
VALUES (%s, %s, %s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,4 @@
INSERT INTO %%site_name%%_food_info
(ingrediants, food_groups, nutrients, expires)
VALUES (%s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,4 @@
INSERT INTO %%site_name%%_groups
(name, description, included_items, group_type)
VALUES (%s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,5 @@
INSERT INTO %%site_name%%_item_info
(barcode, linked_items, shopping_lists, recipes, groups,
packaging, uom, cost, safety_stock, lead_time_days, ai_pick)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,4 @@
INSERT INTO %%site_name%%_item_locations
(part_id, location_id, quantity_on_hand, cost_layers)
VALUES (%s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,5 @@
INSERT INTO %%site_name%%_items
(barcode, item_name, brand, description, tags, links, item_info_id, logistics_info_id,
food_info_id, row_type, item_type, search_string)
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,4 @@
INSERT INTO logins
(username, password, email)
VALUES (%s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,5 @@
INSERT INTO %%site_name%%_logistics_info
(barcode, primary_location, auto_issue_location, dynamic_locations,
location_data, quantity_on_hand)
VALUES (%s, %s, %s, %s, %s, %s)
RETURNING *;

View File

@ -1,3 +1,5 @@
INSERT INTO Backpack_transactions
(timestamp, logistics_info_id, barcode, name, transaction_type, quantity, description, user_id, data)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s);
INSERT INTO main_transactions
(timestamp, logistics_info_id, barcode, name, transaction_type,
quantity, description, user_id, data)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
RETURNING *;

View File

@ -0,0 +1,4 @@
UPDATE %%site_name%%_item_locations
SET cost_layers = array_append(cost_layers, %s), quantity_on_hand = %s
WHERE location_id=%s AND part_id=%s
RETURNING *;

View File

@ -37,27 +37,33 @@
}
</style>
<!-- NAVBAR -->
<div class="navbar-fixed">
<nav class="purple lighten-4 text-black z-depth-0">
<div class="nav-wrapper">
<ul id="nav-mobile" class="left hide-on-med-and-down black-text">
<li><a class="dropdown-trigger black-text" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><a href="/items" class="black-text">Site Items</a></li>
<li class="active"><a href="/groups" class="black-text">Site Groups</a></li>
<li><a href="/shopping-lists" class="black-text">Site Shopping Lists</a></li>
<li><a href="/receipts" class="black-text">Site Receipts</a></li>
</ul>
<ul class="right">
<li><a class="dropdown-trigger hide-on-med-and-down black-text" data-target="username_dropdown">{{username}}<i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
</div>
<ul id='dropdown1' class='dropdown-content'>
{% for site in sites %}
<li><button class="btn transparent black-text z-depth-0" onclick="changeSite('{{ site }}')">{{site}}</button></li>
{% endfor %}
</ul>
<ul id="slide-out" class="sidenav sidenav-fixed purple lighten-4" style="width: 250px;">
<li>
<div class="user-view">
<!-- <div class="background">
<img src="images/office.jpg">
</div> -->
<!-- <a href="#user"><img class="circle" src="images/yuna.jpg"></a> -->
<a href="#name"><span class="black-text name">John Doe</span></a>
<a href="#email"><span class="black-text email">jdoe@example.com</span></a>
</div>
</li>
<li><a class="dropdown-trigger" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><div class="divider grey darken-1" style="margin-left: 5px; margin-right: 10px;"></div></li>
<li><a href="/items">Site Items</a></li>
<li><a href="/groups">Site Groups</a></li>
<li><a href="/shopping-lists">Site Shopping Lists</a></li>
<ul id='username_dropdown' class='dropdown-content'>
<li><a href="/profile" class="hide-on-med-and-down black-text">Profile</a></li>
{% if system_admin == True %}
<li><a href="/admin" class="hide-on-med-and-down black-text">Administration</a></li>
{% endif %}
<li><a href="/logout" class="hide-on-med-and-down black-text">Logout</a></li>
</ul>
<body>
<div class="container section" style="padding-bottom: 72px;">

View File

@ -36,28 +36,33 @@
opacity: 0.5; /* or your desired degree of transparency */
}
</style>
<div class="navbar-fixed">
<nav class="blue lighten-4 text-black z-depth-0">
<div class="nav-wrapper">
<ul id="nav-mobile" class="left hide-on-med-and-down black-text">
<li><a class="dropdown-trigger black-text" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><a href="/items" class="black-text">Site Items</a></li>
<li><a href="/groups" class="black-text">Site Groups</a></li>
<li><a href="/shopping-lists" class="black-text">Site Shopping Lists</a></li>
<li class="active"><a href="/receipts" class="black-text">Site Receipts</a></li>
</ul>
<ul class="right">
<li><a class="dropdown-trigger hide-on-med-and-down black-text" data-target="username_dropdown">{{username}}<i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
</div>
<ul id='dropdown1' class='dropdown-content'>
{% for site in sites %}
<li><button class="btn transparent black-text z-depth-0" onclick="changeSite('{{ site }}')">{{site}}</button></li>
{% endfor %}
</ul>
<ul id="slide-out" class="sidenav sidenav-fixed green lighten-4" style="width: 250px;">
<li>
<div class="user-view">
<!-- <div class="background">
<img src="images/office.jpg">
</div> -->
<!-- <a href="#user"><img class="circle" src="images/yuna.jpg"></a> -->
<a href="#name"><span class="black-text name">John Doe</span></a>
<a href="#email"><span class="black-text email">jdoe@example.com</span></a>
</div>
</li>
<li><a class="dropdown-trigger" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><div class="divider grey darken-1" style="margin-left: 5px; margin-right: 10px;"></div></li>
<li class="active"><a href="/items">Site Items</a></li>
<li><a href="/groups">Site Groups</a></li>
<li><a href="/shopping-lists">Site Shopping Lists</a></li>
<li><a href="/receipts">Site Receipts</a></li>
<ul id='username_dropdown' class='dropdown-content'>
<li><a href="/profile" class="hide-on-med-and-down black-text">Profile</a></li>
{% if system_admin == True %}
<li><a href="/admin" class="hide-on-med-and-down black-text">Administration</a></li>
{% endif %}
<li><a href="/logout" class="hide-on-med-and-down black-text">Logout</a></li>
</ul>
<body>
<div class="container section">
@ -66,11 +71,11 @@
</div>
<div class="col s12 center" id="pagination_list">
<ul class="pagination">
<li id="first" class="waves-effect hand-pointer"><a class="green lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">first_page</i></a></li>
<li id="back" class="waves-effect hand-pointer" ><a class="green lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">chevron_left</i></a></li>
<li id="first" class="waves-effect hand-pointer"><a class="blue lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">first_page</i></a></li>
<li id="back" class="waves-effect hand-pointer" ><a class="blue lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">chevron_left</i></a></li>
<li id="current_page" style="padding-top: 7px; padding-left: 5px; padding-right: 5px; font-size: 18px;">page_number</li>
<li id="forward" class="waves-effect hand-pointer"><a class="green lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">chevron_right</i></a></li>
<li id="last" class="waves-effect hand-pointer"><a class="green lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">last_page</i></a></li>
<li id="forward" class="waves-effect hand-pointer"><a class="blue lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">chevron_right</i></a></li>
<li id="last" class="waves-effect hand-pointer"><a class="blue lighten-3" style="display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;"><i class="material-icons">last_page</i></a></li>
</ul>
</div>
</div>

View File

@ -37,27 +37,33 @@
}
</style>
<div class="navbar-fixed">
<nav class="orange lighten-4 text-black z-depth-0">
<div class="nav-wrapper">
<ul id="nav-mobile" class="left hide-on-med-and-down black-text">
<li><a class="dropdown-trigger black-text" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><a href="/items" class="black-text">Site Items</a></li>
<li><a href="/groups" class="black-text">Site Groups</a></li>
<li class="active"><a href="/shopping-lists" class="black-text">Site Shopping Lists</a></li>
<li><a href="/receipts" class="black-text">Site Receipts</a></li>
</ul>
<ul class="right">
<li><a class="dropdown-trigger hide-on-med-and-down black-text" data-target="username_dropdown">{{username}}<i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
</div>
<ul id='dropdown1' class='dropdown-content'>
{% for site in sites %}
<li><button class="btn transparent black-text z-depth-0" onclick="changeSite('{{ site }}')">{{site}}</button></li>
{% endfor %}
</ul>
<ul id="slide-out" class="sidenav sidenav-fixed orange lighten-4" style="width: 250px;">
<li>
<div class="user-view">
<!-- <div class="background">
<img src="images/office.jpg">
</div> -->
<!-- <a href="#user"><img class="circle" src="images/yuna.jpg"></a> -->
<a href="#name"><span class="black-text name">John Doe</span></a>
<a href="#email"><span class="black-text email">jdoe@example.com</span></a>
</div>
</li>
<li><a class="dropdown-trigger" data-target="dropdown1">Current Site > {{current_site}}<i class="material-icons right">arrow_drop_down</i></a></li>
<li><div class="divider grey darken-1" style="margin-left: 5px; margin-right: 10px;"></div></li>
<li><a href="/items">Site Items</a></li>
<li><a href="/groups">Site Groups</a></li>
<li><a href="/shopping-lists">Site Shopping Lists</a></li>
<ul id='username_dropdown' class='dropdown-content'>
<li><a href="/profile" class="hide-on-med-and-down black-text">Profile</a></li>
{% if system_admin == True %}
<li><a href="/admin" class="hide-on-med-and-down black-text">Administration</a></li>
{% endif %}
<li><a href="/logout" class="hide-on-med-and-down black-text">Logout</a></li>
</ul>
<body>
<div class="container section" style="padding-bottom: 72px;">

12
test.py Normal file
View File

@ -0,0 +1,12 @@
from config import config
import psycopg2, ast, database, datetime, json, MyDataclasses
database_config = config()
with psycopg2.connect(**database_config) as conn:
now = datetime.datetime.now()
try:
print(MyDataclasses.LogisticsInfoPayload.payload())
except database.DatabaseError as error:
print(error)
#conn.rollback()