You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.7 KiB

  1. import json
  2. data_format_prod = {
  3. 'Prod_Name': None, 'BBD': None, 'Nutrients': [], 'Calories': 0, 'Allergens': [],
  4. 'Problematic': False, 'Process': None, 'ED': None
  5. }
  6. data_format_proc = {
  7. 'Harvested': {'Date': '', 'Location': '', 'Product': '','Problematic':False},
  8. 'Transport1': {'Duration': 0, 'Moved to,from': '-', 'Condition': True, 'Stopped': False,'Problematic':False},
  9. 'Process': {'Location': '', 'Processes': '','Problematic':False},
  10. 'Transport2': {'Duration': 0, 'Moved to,from': '-', 'Condition': 0, 'Stopped': False,'Problematic':False},
  11. 'Packaging': {'Location': '', 'Material': '', 'Cancerogen': True,'Problematic':False}
  12. }
  13. data_1_prod = {
  14. 'Prod_Name': "Milk", 'BBD': "24.08.2018", 'Nutrients': ['Protein', 'Fat', 'Lactose', 'Glucose'],
  15. 'Calories': 120, 'Cooked': False, 'Allergens': ['Lactose'], 'Problematic': False,
  16. 'Process': 'Pastorized'
  17. }
  18. data_2_prod = {
  19. 'Prod_Name': "Chocolate", 'BBD': "28.01.2019", 'Nutrients': ['Lactose', 'Glucose', 'Cocoa'],
  20. 'Calories': 180, 'Cooked': False, 'Allergens': [""], 'Problematic': False, 'Process': ''
  21. }
  22. data_1_proc = {
  23. 'Harvested': {
  24. 'Date': '18.08.2018', 'Location': 'Larson Family',
  25. 'Product': 'Raw Milk'
  26. ,'Problematic':False
  27. },
  28. 'Transport1': {
  29. 'Duration': 9, 'Moved to,from': 'Larson Family-McCarty Family Farms', 'Condition': True,
  30. 'Stopped': True
  31. ,'Problematic':True
  32. }, 'Process': {
  33. 'Location': 'McCarty Family Farms',
  34. 'Processes': 'Reverse Osmosis,Nanofiltration,Ultrafiltration,Microfiltration'
  35. ,'Problematic':False
  36. },
  37. 'Transport2': {
  38. 'Duration': 13, 'Moved to,from': 'McCarty Family Farms-JJX Packaging', 'Condition': True,
  39. 'Stopped': True
  40. ,'Problematic':False
  41. },
  42. 'Packaging': {'Location': 'JJX Packaging', 'Material': 'Carton', 'Cancerogen': False,'Problematic':True}
  43. }
  44. data_2_proc = {
  45. 'Harvested': {
  46. 'Date': '27.01.2018', 'Location': 'India',
  47. 'Product': 'Cocoa','Problematic':True
  48. },
  49. 'Transport1': {'Duration': 71, 'Moved to,from': 'India-Nestle ', 'Condition': True, 'Stopped': True,'Problematic':False},
  50. 'Process': {'Location': 'Nestle', 'Processes': 'Roasting,Pulp,Conching,Moulding','Problematic':False},
  51. 'Transport2': {
  52. 'Duration': 4, 'Moved to,from': 'Nestle-Ulma Packaging', 'Condition': True,
  53. 'Stopped': False,'Problematic':False
  54. },
  55. 'Packaging': {'Location': 'Ulma Packaging', 'Material': 'Foil', 'Cancerogen': False,'Problematic':False}
  56. }
  57. Products = [data_1_prod, data_2_prod]
  58. Processes = [data_1_proc, data_2_proc]
  59. for i in range(len(Products)):
  60. with open('../database/content/Products/'+str(i+1) + '.json', 'w') as outfile:
  61. json.dump(Products[i], outfile)
  62. outfile.close()
  63. for i in range(len(Processes)):
  64. with open('../database/content/Processes/'+str(i+1) + '.json', 'w') as outfile:
  65. json.dump(Processes[i], outfile)
  66. outfile.close()