-
-
Notifications
You must be signed in to change notification settings - Fork 582
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # docs/faq.md
- Loading branch information
Showing
38 changed files
with
5,115 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']] = {'name': entry['nutrient']['name'], 'unit': entry['nutrient']['unitName']} | ||
|
||
nutrient_ids = list(nutrients.keys()) | ||
nutrient_ids.sort() | ||
for nid in nutrient_ids: | ||
print('{', f'value: {nid}, text: "{nutrients[nid]["name"]} [{nutrients[nid]["unit"]}] ({nid})"', '},') | ||
|
||
|
||
get_all_nutrient_types() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
cookbook/migrations/0205_alter_food_fdc_id_alter_propertytype_fdc_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.7 on 2023-11-29 19:44 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cookbook', '0204_propertytype_fdc_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='food', | ||
name='fdc_id', | ||
field=models.IntegerField(blank=True, default=None, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='propertytype', | ||
name='fdc_id', | ||
field=models.IntegerField(blank=True, default=None, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{% extends "base.html" %} | ||
{% load render_bundle from webpack_loader %} | ||
{% load static %} | ||
{% load i18n %} | ||
{% load l10n %} | ||
|
||
{% block title %}{% trans 'Property Editor' %}{% endblock %} | ||
|
||
{% block content_fluid %} | ||
|
||
<div id="app"> | ||
<property-editor-view></property-editor-view> | ||
</div> | ||
|
||
|
||
{% endblock %} | ||
|
||
|
||
{% block script %} | ||
{% if debug %} | ||
<script src="{% url 'js_reverse' %}"></script> | ||
{% else %} | ||
<script src="{% static 'django_js_reverse/reverse.js' %}"></script> | ||
{% endif %} | ||
|
||
<script type="application/javascript"> | ||
window.RECIPE_ID = {{ recipe_id }} | ||
</script> | ||
|
||
{% render_bundle 'property_editor_view' %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.