feat: add Edamam food provider integrations#1100
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates the Edamam Food Database API, adding search and barcode lookup capabilities along with necessary frontend configurations and database migrations. It also updates the FatSecret integration to support localized nutrient parsing and introduces a new database query for daily nutrition summaries. Review feedback focuses on implementing proper pagination for Edamam, adding timeouts to external API requests, and addressing the fragility of the positional parsing logic in the FatSecret service. Additionally, the unused getDailyNutritionByCategory function should be removed or properly integrated.
|
When I try to add Edamam as a food provider there is no text input for app id or key. |
|
I think I fixed it—the fields were there when I added them, but not when I edited them, so I added them |
|
When I run
You also have a failing server test in It now lets me add the provider fine but when I search for a food through the web it gives me a error box "common.error" "Provider not supported". There's nothing in console log or server log about it. |
modified: .gitignore
…corrected api exports from backup
- edamamService: add page/from/to pagination params to searchEdamamByQuery - edamamService: add AbortController 10s timeout to both fetch calls - fatsecretService: parse search nutrients by label with positional fallback - foodIntegrationService: pass page to searchEdamamByQuery, use data.count and _links.next for real pagination - foodEntry: remove unused getDailyNutritionByCategory export Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
aea7041 to
dd3556b
Compare
|
Due to the latest changes with switching everything to typescript and esm this would need a good amount of work. Edamam seems to be paid, so it's hard to test the integration |
|
Edamam is free for up to a few thousand requests, but app tokens are issued with a delay of several hours I'm not sure how well this works, since the number of changes, my workload, and the fact that I didn't initially split it into a separate PR—plus my lack of experience with PRs—made it difficult to implement the improvements "easily." Everything is working pretty well in my fork on the main branch right now |
Oh okay thats great, I didn't see it. Have you rebased the latest changes? There are some conflicts now. |
I just merged the latest changes from the project and incorporated all my updates. |
it still shows conflicts and there are .js file like SparkyFitnessServer/routes/garminRoutes.js in the pr. |
I didn't do this for a separate PR or branch.
And perhaps most importantly, interacting with the application via Telegram as a simple AI bot. My menu and goals (which I entered via the existing user context functionality) are passed into its context, plus the last 7 days of sports activities and food consumption are dynamically pulled in, along with the current time and date, which allows the AI to respond very intelligently. It accepts incoming data as text, voice, video, and photos, which removes any friction or emotional difficulty of manual data entry that would exist in a classic library-style interface. I am ready to participate in getting all this functionality into the community, but unfortunately, I am not ready to implement it from scratch in small steps, considering I would have to race against other community changes and the fact that my features overlap, making them not so easy to separate. You can simply see the working code on main (in my fork). We could also work on the integration personally in a separate branch, a chat, or some other way. Perhaps you could share your CI/CD on your end so I can run it, or something else to make it productive. If this is too much for you, no worries; we can leave it as is. Your project is wonderful and evolving. I'm glad I found it and grateful that I can use it as a core for my own purposes (keeping a diary via messenger). |
More providers are always a good idea and we should probably integrate that into the codebase. Regarding MyFitnessPal, I am hesitant. I also don't see a clear use case for a continuous sync. We already provide multiple reliable ways to retrieve nutrition data (OpenFoodFacts, USDA, FatSecret, Nutritionix). What is missing in Sparky that pervents you from switching? |
|
My goal was to synchronize with Garmin (which also does not have an open API) |
We have a garmin sync. The only difference is that we rely on a python package to interact with garmin which reduces the maintainence. In the end @CodeWithCJ should decide If this should get integrated |
|
I saw and use it, there were problems with authorization, I got the tokens in a different way and wrote them to the database directly but the problem is that you only download activities (which is very good, but more could be done) Through my fitnesspal, Garmin learns about the balance of calories consumed (there is no other way) And I modified it so that the water balance was loaded into Garmin from Sparky, and the goal from the water balance was taken from Garmin (it is dynamic there, and is adjusted depending on physical activity) I'm talking about the fact that some PRs have difficulties, but it seems to me that they are very useful functions. |
|
I am afraid people choosing selfhosted version is mainly because they don't want to trust their data with MyFitnessPal or other cloud providers. The PR is currently not ready to be merged as there are several files having conflict with main branch. And we didn't even start code review yet properly. So not sure what other issues could be there. This is exactly the reason we want contributors to first raise issue in github, disucss with us about the approach so we can align on the implementation. Currently I am overseas and don't have bandwidth to troubleshoot this PR and merge. @Sim-sat also busy with other items. If you are able to cleanup the PR and re-submit again, happy to merge. |
I missed key point from @Sim-sat . If the code within SparkyFitness is scrapping, that could be stopper for SparkyFitness integration. Because we don't want to maintain that code base in future. Thats the exact reason I choosen python-garmin-connect library as it takes care heavy lifting on downloading the data and integrating with Garmin. If there is existing library for MyFitnessPal, use that. BUt we don't want to directly scrap from them. |
|
Garmin partners with myfitnesspal and Garmin does not support a calorie diary internally, only with a combination with my fitness, but you can download activity from Garmin (and it works great for you, the only thing I could improve is better categorization of activities on the sparky side) |
Any changes are welcome, it can certainly be improved. If you don't have the time, create a feature request and i'll look at it since I use garmin myself and can test it |
|
Technically, I have already implemented everything I wanted for myself in the open access, I went through a lot yesterday (more than 200 test errors) after the merge with the main branch updates) I will be glad if some piece of code or approaches or ideas will be interesting, for me the most valuable thing is the ability to interact with Telegram. I just thought at the very beginning to make small faxes for myself personally, and receive quite a large-scale and several, so I did not allocate them in a separate pr and now the difficulties ( If necessary, I can conduct any express demonstration |
|
Hi Looks like only meal planner API is free with Edaman and food database needs $14 subscription. I am afraid I won't be able to try to implement as they doesn't seem to offer free API. |

Tip
Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run
pnpm run validateto check for any errors.PRs that include tests and clear screenshots are highly preferred!
Note: AI-generated descriptions must be manually edited for conciseness. Do not paste raw AI summaries.
Description
What problem does this PR solve?
Adds Edamam as a food search and barcode lookup provider, and improves FatSecret barcode support, giving users more options for food data sources.
How did you implement the solution?
Added
edamamService.tswith food search and barcode lookup via the Edamam Nutrition API. ExtendedfatsecretService.tswith improved barcode support. Added theedamamprovider type to the barcode lookup chain infoodCoreService.ts(between USDA and the OpenFoodFacts fallback). ExtendedfoodIntegrationService.tsandfoodRoutes.ts(v2) to route requests to the correct provider. Added a migration to register theedamamprovider type. Added Edamam/FatSecret credential fields to the settings UI.Linked Issue: #1100 (This is just something I decided to do on my own—there’s no specific task for it—so I’m linking to my own page to keep the validator from complaining :))
How to Test
app_idandapp_keyPR Type
Checklist
All PRs:
New features only:
Frontend changes (
SparkyFitnessFrontend/orsrc/):pnpm run validateand it passes.en) translation file.Backend changes (
SparkyFitnessServer/):rls_policies.sqlfor the newedamamprovider type entry.UI changes (components, screens, pages):
Screenshots
Click to expand
Before
After
Notes for Reviewers