fixed and improvements to property editor

This commit is contained in:
vabene1111
2023-12-02 20:14:12 +01:00
parent 0c381ed46c
commit f3e11e6358
5 changed files with 308 additions and 57 deletions

View File

@ -0,0 +1,19 @@
import json
def get_all_nutrient_types():
f = open('') # <--- download the foundation food or any other dataset and retrieve all nutrition ID's from it https://fdc.nal.usda.gov/download-datasets.html
json_data = json.loads(f.read())
nutrients = {}
for food in json_data['FoundationFoods']:
for entry in food['foodNutrients']:
nutrients[entry['nutrient']['id']] = entry['nutrient']['name']
nutrient_ids = list(nutrients.keys())
nutrient_ids.sort()
for nid in nutrient_ids:
print('{', f'value: {nid}, text: "{nutrients[nid]} ({nid})"', '},')
get_all_nutrient_types()