nutritionix / nutrition-label

Create a FDA-style nutrition label with any nutrition data source (even the Nutritionix API - http://www.nutritionix.com/api)
http://www.nutritionix.com/
MIT License
176 stars 66 forks source link

Possible incorrect recommended daily intake values #71

Closed JCapriotti closed 7 years ago

JCapriotti commented 7 years ago

I am looking to use this plug-in and am learning the ins and outs of it.

If I understand how it works, I think the dailyValueVitaminD value of 400 is incorrect. I believe the 400 is coming from this or a similar source.

However, 400 IU is equal to 10 mcg, according to this. And I think since the plug-in defaults to mcg, the default should also be in mcg.

I can submit a PR just wanted to make sure this is a valid issue.

majin22 commented 7 years ago

noted and I will forward this to our nutritionist. thanks

JCapriotti commented 7 years ago

@majin22 thanks. I didn't check other values but there could be similar issues with other vitamins/minerals that use IU for the FDA daily values.

PaigeEinstein commented 7 years ago

@JCapriotti I'm the director of nutrition and am trying to look into this for you but need a bit more information. All of our Vitamin D values are in/based on IU - where are you seeing a default to mcg?

majin22 commented 7 years ago

@JCapriotti what @PaigeEinstein is asking is more explanation on why you think the current default values are incorrect (based on your first comment) so if needed, we can adjust the values.

thanks

JCapriotti commented 7 years ago

Hi @PaigeEinstein Another way to look at it is the problem might be that the unitVitaminD_base is mcg, not IU (since, as you mentioned, the default value is in IU). It is a little hard to explain, but I can walk through what I'm seeing...

If I'm understanding the widget correctly, it expects the Vitamin D value passed in to be a % Daily Value (say, 1.22 from your example).

The widget also shows the actual amount in mcg, which is calculated here: https://github.com/nutritionix/nutrition-label/blob/master/nutritionLabel.js#L1530

Putting numbers in, I think it looks like this: (1.22 / 100) * 400

Which comes out to 4.88 (rounded up to 5 mcg in the demo).

Since the 400 value is in IU, then I think the code I pointed out is actually returnning 4.88 IU, not mcg.

So, the way I'm interpreting it, either:

  1. the dailyValueVitaminD should be 10, since the unitVitaminD_base of the widget is mcg
  2. or, the unitVitaminD_base should be IU since the dailyValueVitaminD is 400 (IU)
PaigeEinstein commented 7 years ago

@JCapriotti thank you for that detailed information! And thank you for bringing this issue to our attention. @majin22 we need to change the vitamin D unit of measure to IU, not mcg, in the widget. Percent daily value for Vitamin D is 400 IU, so corresponding values should be in IU. Thanks!