webOS Nation Forums >  Homebrew >  webOS homebrew apps > Nutrition Facts - nutritional info search tool
Nutrition Facts - nutritional info search tool

  Reply
 
LinkBack Thread Tools Display Modes
Old 08/23/2009, 05:47 PM   #1 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Thumbs up Nutrition Facts - Nutritional Info Search Tool

Nutrition Facts is a nutritional info search tool that generates "Nutrition Facts" labels like the kind you see on the backs of boxes at the supermarket. Imagine having a simple, easy-to-read label for a McDonald's burger. Well, now it's doable.

I hope you like it. The API that I hooked into (FatSecret) was difficult to port so I had to perform a couple of work-arounds. Additionally, I'm admittedly not the greatest fan of their searching algorythms (which I have no control over). Nevertheless, it's a fully functional app that does just one thing, and happens to do it particularly well. Enjoy!

Any feedback would be greatly appreciated. Some things I can change and somethings are built into the API. However, I'll do what I can. :-)

You will be able to find it at:
http://www.precentral.net/homebrew-apps/nutrition-facts

TODO:
"pretty up" the search results

Last edited by alans17; 08/23/2009 at 07:23 PM. Reason: Attached screenshots
alans17 is offline   Reply With Quote
Thanked By: Brianzedge
Old 08/23/2009, 06:11 PM   #2 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Is there some sort of trick to adding attachments? I'm having the dardest time...
alans17 is offline   Reply With Quote
Old 08/23/2009, 06:24 PM   #3 (permalink)
Member
 
romanmb's Avatar
 
Join Date: Jun 2009
Posts: 145
Likes Received: 0
Thanks: 18
Thanked 25 Times in 16 Posts
Default

Nope, the problem isn't on your end. It takes time after you submit the app for it to get approved and for the link to work. After, it should appear on filecoaster and on the homebrew apps gallery here on the site.


Thanks for this btw, can't wait to try it!
romanmb is offline   Reply With Quote
Old 08/23/2009, 06:58 PM   #4 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Screen shots are now attached...

I hope you like it too, though! I'm open to suggestions and any offers to help improve it. It's closed source for now, but I would considering opening it up under the right circumstances.

Last edited by alans17; 08/23/2009 at 07:00 PM. Reason: New screenshots attached
alans17 is offline   Reply With Quote
Old 08/24/2009, 07:02 AM   #5 (permalink)
Member
 
Join Date: Aug 2006
Posts: 144
Likes Received: 0
Thanks: 73
Thanked 4 Times in 4 Posts
Default

I open the program, click ok and get a white screen. Nothing is loading. Help please?
remmysmom is offline   Reply With Quote
Old 08/24/2009, 07:11 AM   #6 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Quote:
Originally Posted by remmysmom View Post
I open the program, click ok and get a white screen. Nothing is loading. Help please?
It doesn't work offline. It's highly online-dependent. The search screen won't even appear if you can't get a network connection. I would give it a moment to let it load. Perhaps I should implement some sort of wait status or something. It's one of the unfortunate caveats of the API. There's no offline mode.
alans17 is offline   Reply With Quote
Old 08/24/2009, 07:15 AM   #7 (permalink)
Member
 
Join Date: Aug 2006
Posts: 144
Likes Received: 0
Thanks: 73
Thanked 4 Times in 4 Posts
Default

I am online and have been waiting awhile, still just a white screen. Full bars and wifi....What is the trick to get this to open?
remmysmom is offline   Reply With Quote
Old 08/24/2009, 07:28 AM   #8 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

You're absolutely right after all. Even test HTML pages on my local machine that were working yesterday are now not doing anything. It's a problem of the API provider. There's a daily request limit, and I bet we already hit it. I will email them and ask them to raise the limit for me.
alans17 is offline   Reply With Quote
Old 08/24/2009, 07:55 AM   #9 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Upon further investigation, it looks like FatSecret (the people who wrote the API) have introduced a bug into their own system that is affecting me. Wonderful... I've already contacted them. We'll see what they say.
alans17 is offline   Reply With Quote
Old 08/24/2009, 08:27 AM   #10 (permalink)
Member
 
Join Date: May 2009
Location: Louisville, KY
Posts: 147
Likes Received: 0
Thanks: 10
Thanked 5 Times in 5 Posts
Default

Appreciate the effort. This will be a great app if you can pull it off.
f1nzup is offline   Reply With Quote
Old 08/24/2009, 08:38 AM   #11 (permalink)
Member
 
Join Date: Aug 2009
Posts: 2
Likes Received: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't Wait

This will be a great app once it's working properly. Thanks for your work on it.
webgrl is offline   Reply With Quote
Old 08/24/2009, 09:35 AM   #12 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

It's alive! It's noticeably sluggish, though. I'll see what I can do about that. Give it a little time to load the seach dialog, results, etc.

I'll work on speeding it up when I get home from work today.

EDIT: Did I say "noticeably sluggish"? I meant "freaking slow"... I need some sort of message to indicate it's working so people don't just close it and walk off.

Last edited by alans17; 08/24/2009 at 09:44 AM.
alans17 is offline   Reply With Quote
Old 08/24/2009, 09:50 AM   #13 (permalink)
Member
 
DanPLC's Avatar
 
Join Date: May 2009
Posts: 4,565
Likes Received: 134
Thanks: 277
Thanked 1,366 Times in 664 Posts
Default

I've been looking for an app like this. I was thinking about creating an app like this for myself, but the site I use for nutritional info is DailyPlate and they don't have an open API. I never even heard of FatSecret until now.

One thing I noticed while using the app is that the search parameters seem to be "OR" based, instead of "AND" based. For instance, if I search for "Red Robin Turkey" (to try to find Red Robin's turkey burger), it comes up with a bunch of turkey items.

I'm curious, are you using the Javascript or REST API?
DanPLC is online now   Reply With Quote
Thanked By: alans17
Old 08/24/2009, 10:09 AM   #14 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Quote:
Originally Posted by DanPLC View Post
One thing I noticed while using the app is that the search parameters seem to be "OR" based, instead of "AND" based. For instance, if I search for "Red Robin Turkey" (to try to find Red Robin's turkey burger), it comes up with a bunch of turkey items.

I'm curious, are you using the Javascript or REST API?
Yeah, I'm not a very big fan of their searching algorithm.

I'm using the Javascript API and trying to shoehorn it into an app. I'm not familiar with REST (yet). However, the REST API doesn't include the very convenient pre-formatting for the nutrition fact labels, and I don't know if FatSecret would be open to sharing it with me.

I can already dynamically look up labels by internal id, but using the Javascript API search feature steals away all my options. I may just build some sort of hybrid using REST search and Javascript results. I'll have to go that route if I intend to beautify the search results, anyway. Plus it would allow me the opportunity to build in a "return to results" feature by swiping back.

It's kind of "all or nothing" here. The REST API is completely granualar and the Javascript API is almost completely fixed.
alans17 is offline   Reply With Quote
Old 08/24/2009, 10:11 AM   #15 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

I just hope everyone realize's it's not even 1.0 software here. It's still a proof-of-concept in some ways. It works, and (as far as I know) is bug free, but that doesn't mean it's without fault.
alans17 is offline   Reply With Quote
Thanked By: andddlay
Old 08/24/2009, 11:45 AM   #16 (permalink)
Member
 
DanPLC's Avatar
 
Join Date: May 2009
Posts: 4,565
Likes Received: 134
Thanks: 277
Thanked 1,366 Times in 664 Posts
Default

Quote:
Originally Posted by alans17 View Post
Yeah, I'm not a very big fan of their searching algorithm.
If you search for "Red Robin Turkey" on their web site, it comes up with one entry (the Red Robin Turkey Burger), but in your app, it comes up with a bunch of non-related turkey items.

When you pass in the search expression, do you pass in exactly what the user types (with spaces), or do you replace the spaces with "+" signs? I noticed that when you search on their web page, the query string has "+" signs in between each word. I don't know if that's necessary or not with the API call.
DanPLC is online now   Reply With Quote
Old 08/24/2009, 11:52 AM   #17 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

Quote:
Originally Posted by DanPLC View Post
If you search for "Red Robin Turkey" on their web site, it comes up with one entry (the Red Robin Turkey Burger), but in your app, it comes up with a bunch of non-related turkey items.

When you pass in the search expression, do you pass in exactly what the user types (with spaces), or do you replace the spaces with "+" signs? I noticed that when you search on their web page, the query string has "+" signs in between each word. I don't know if that's necessary or not with the API call.
The javascript API steals away the ability for me to do anything about it. I have no way to know what's getting passed along. Great catch, though! You found (another) bug in their API. I verified it on their own example pages. I will bring it up to the API devs and see if it's a quick fix.

BTW, even the search button is rendered via the API. That's how all-inclusive it is. :-S
alans17 is offline   Reply With Quote
Old 08/24/2009, 12:02 PM   #18 (permalink)
Member
 
Join Date: Aug 2009
Posts: 53
Likes Received: 0
Thanks: 6
Thanked 6 Times in 4 Posts
Default

If I keep bugging these API devs, I'm gonna find my API key banned. :-)
alans17 is offline   Reply With Quote
Old 08/24/2009, 01:26 PM   #19 (permalink)
Member
 
TheMarco's Avatar
 
Join Date: Jun 2009
Location: Sunnyvale CA
Posts: 699
Likes Received: 6
Thanks: 19
Thanked 160 Times in 72 Posts
Default

Nice start but... please use the REST API. It returns raw XML which is perfect because you can then use that to render it in a gorgeous all-MOJO interface. You can fetch the XML, stick it in a DOM node and then walk the entire document to get the stuff you need from it and present it nicely.

Funny, I've been looking into this but with CalorieKing and they didn't seem to have a free to use API. I didn't know about FatSecret having a completely free one. Very cool!

Other idea I have for this:

Save searches into 'my foods' so you can have these readily available whenever you want without having to perform API calls. You then don't even need to be connected to the internet to use parts of the app.
__________________
My shiny new TouchPad apps: Scientific RPN Calculator HD - Screamager HD
TheMarco is offline   Reply With Quote
Old 08/24/2009, 01:34 PM   #20 (permalink)
Member
 
Audemars02's Avatar
 
Join Date: May 2009
Posts: 1,487
Likes Received: 13
Thanks: 252
Thanked 405 Times in 238 Posts
Default

Any chance of being able to search for a specific restaurant and pulling up all items from that restaurant? Or going into a submenu to then be able to search for items within that restaruant?
Audemars02 is offline   Reply With Quote
Reply

 

Tags
fatsecret, food, nutrition, reference, search

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0