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.

71 lines
2.4 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': ''},
  8. 'Transport1': {'Duration': 0, 'Moved to,from': '-', 'Condition': True, 'Stopped': False},
  9. 'Process': {'Location': '', 'Processes': ''},
  10. 'Transport2': {'Duration': 0, 'Moved to,from': '-', 'Condition': 0, 'Stopped': False},
  11. 'Packaging': {'Location': '', 'Material': '', 'Cancerogen': True}
  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. },
  27. 'Transport1': {
  28. 'Duration': 9, 'Moved to,from': 'Larson Family-McCarty Family Farms', 'Condition': True,
  29. 'Stopped': True
  30. }, 'Process': {
  31. 'Location': 'McCarty Family Farms',
  32. 'Processes': 'Reverse Osmosis,Nanofiltration,Ultrafiltration,Microfiltration'
  33. },
  34. 'Transport2': {
  35. 'Duration': 13, 'Moved to,from': 'McCarty Family Farms-JJX Packaging', 'Condition': True,
  36. 'Stopped': True
  37. },
  38. 'Packaging': {'Location': 'JJX Packaging', 'Material': 'Carton', 'Cancerogen': False}
  39. }
  40. data_2_proc = {
  41. 'Harvested': {
  42. 'Date': '27.01.2018', 'Location': 'India',
  43. 'Product': 'Cocoa'
  44. },
  45. 'Transport1': {'Duration': 71, 'Moved to,from': 'India-Nestle ', 'Condition': True, 'Stopped': True},
  46. 'Process': {'Location': 'Nestle', 'Processes': 'Roasting,Pulp,Conching,Moulding'},
  47. 'Transport2': {
  48. 'Duration': 4, 'Moved to,from': 'Nestle-Ulma Packaging', 'Condition': True,
  49. 'Stopped': False
  50. },
  51. 'Packaging': {'Location': 'Ulma Packaging', 'Material': 'Foil', 'Cancerogen': False}
  52. }
  53. Products = [data_1_prod, data_2_prod]
  54. Processes = [data_1_proc, data_2_proc]
  55. for i in range(len(Products)):
  56. with open('../database/content/Products/'+str(i+1) + '.json', 'w') as outfile:
  57. json.dump(Products[i], outfile)
  58. outfile.close()
  59. for i in range(len(Processes)):
  60. with open('../database/content/Processes/'+str(i+1) + '.json', 'w') as outfile:
  61. json.dump(Processes[i], outfile)
  62. outfile.close()