nutritionix / nutritionix-api-data-utilities

1 stars 0 forks source link

convert onyx nutritionLabel to full_nutrients array #8

Closed vgupta16 closed 5 years ago

vgupta16 commented 5 years ago

example onyx nutritionLabel: https://gist.github.com/vgupta16/7105fb3dc9db37ccce9b6618b609d124

subset of id mappings: { "127271": 204, "127272": 606, "132289": 605, "127275": 601, "127276": 307, "127278": 205, "127279": 291, "127282": 269, "127285": 203, "127277": 306, "Calorie.Calories": 208, "127273": 646, "127274": 645 }

I hope to have a full mapping for you soon, but at least we can get started with this. I can also send you more sample onyx nutritionLabel objects for testing purposes.

For the first iteration:

Later iteration:

Yurko-Fedoriv commented 5 years ago

@vgupta16 I have published https://github.com/nutritionix/nutritionix-api-data-utilities/tree/2.3.1 with convertOnyxToFullNutrientsArray method. Please let me know how it works for you.

Yurko-Fedoriv commented 5 years ago

note, I used Facts[x].Uom.Value as values. But those values are a bit strange in the example file. Is this because the file is just a demo, or am I doing something wrong?

vgupta16 commented 5 years ago

@Yurko-Fedoriv I believe the values should be taken from Facts[x].Quantity

The structure is a little strange. I believe the Uom.Value is referring to the id of that particular Uom.

Yurko-Fedoriv commented 5 years ago

@vgupta16 oh, I see. I've deployed https://github.com/nutritionix/nutritionix-api-data-utilities/tree/2.3.2 to address this

vgupta16 commented 5 years ago

Thanks. Will test it out today