Analyze My Food

Welcome to ANALYZE MY RECIPES!

  • This is a proof of concept site. The real work and power reside in the algorithms being developed to analyze food and recipes in real time.
  • If you are an experienced developer who cooks and has an interest in human nutrition:
    • See development log/comments below. I add comments periodically, if not routinely.
    • If you would like to talk tech, just ping me.
  • If you get here and have suggestions or find bugs, feel free to email at: The Programming Chef. (analyzemyrecipe@gmail.com)

  • Development environment: Visual Studio 2013 Premium, SQL-Server 2012, ASP.NET 4, Telerik RadControls for AJAX, The Object Guy's Logger, C#, LINQ, FogBugz, Kiln
  • Hosted at GoDaddy. Hosted databases are SQL-Server 2012.
  • Tested on latest versions of IE, Safari, Firefox and Chrome.
  • Current supported databases:
    • USDA Food and Nutrient Database for Dietary Studies, Releases 23/25/26/27
    • USDA Food and Nutrient Database for Dietary Studies, Releases 4.1/5/2011-2012
    • USDA Child Nutrition Database Releases 14/16/17/18
    • Application Instance Tracking
    • Recipes, as entered by users
    • Commercial products entered by users from their nutrition labels
    • Security
    • Food log entries entered by users
    • Julia's proxy memory, which touches everything...
  • "Search Foods": Basic search of the registered nutrition databases.
  • "Load Saved Recipes": Load recipes saved by users and their nutrition information.
  • "Analyze and Save Recipes": One click generation of nutrition label from a recipe.
  • "Add Items From Label": Add foodItems from their nutrition label to the database.
  • "Food Log": Log your daily food intake and see nutrition information for days and meals.

Stay hungry, my friends!

  • Sunday, November 2, 2014:
    • Myriad bugs and adjustments.
    • Updated with SR27, CN18, and FNFDDS 2011-2012; this adds 4900+ items from the USDA databases.
  • Sunday, April 6, 2014:
    • Added a report tab for logged food. One must log in for this to enable.
    • Pie chart displays percentage energy from each energy source, plus calories.
    • Stacked bar chart displays daily consumption over time.
    • Options for today only, end time series on today, skip days under a threshold, and start and end dates.
    • Options auto-save to preferances and are in effect on subsequent visits.
    • Added an admin tab, just for me.
  • Sunday, March 29, 2014:
    • Fixed some annoying bugs in the diet logger (I am using it to lose weight).
  • Sunday, January 12, 2014:
    • I have decided to keep this sandbox active for a few more months in order to:
      • Implement an HTTP web service using ASP.NET Web API and Json
      • Start re-implementing functionality for GeeksWhoCook using MVC
      • Implement reasonable authentication/authorization
      • Open the API to those who might find it useful, especially cooking apps on mobile devices
    • Bottom line, this looks like fun.
    • Stay tuned!
  • Sunday, January 5, 2014:
    • Added some location path="." inheritInChildApplications="false" tags to accommodate downstream sites.
    • Implemented an instance of blogengine.net to experiment with. It may still be running at geekshocook.net.
    • Redid the table SQL scripts for all the data bases to preserve structure, keys, constraints and indexes.
    • If a fog person reads this, ping me. It would be interesting.
  • Sunday, December 29, 2013:
    • We celebrate the birth of Kahless, on this most Klingon Khristmas! Qapla'!
    • The nutrition label now has information decoupled from flow on extended nutrition information.
    • I added Vitamin D. About time!
    • The extended nutrition label can optionally skip any N/A values, and auto size.
    • Duplicates from USDA databases are removed. Specifically, CN has many duplicated from SR.
    • All things being equal, food searches sort with most complete data nutrition information first.
    • Created admin routines to regenerate the search cache. Useful for deprecations and updates.
    • Worked on admin routines used to update databases and references to databases as updates from outside occur.
    • Julia's associative memory is more specific. Duplicates with base references eliminated.
    • Search results are now cached. The second time a phrase is analyzed, the results can be retrieved directly.
    • The food logger now saves alias strings, to aid in admin functions and recovery.
    • Fixed a LINQ to SQL Optimistic Concurrency problem when deleting recipes in production.
  • Wednesday, November 27, 2013:
    • This site will NOT move to Azure after all!
    • I implemented a full copy of this site and its data in Azure.
    • I tested across free, shared, standard, and even 2-processor sized sites.
    • Azure was always slower by at least a factor of three, and often much, much more.
    • Often, identical back to back runs had significantly different times (all slower) for no reason.
    • Holy moly! Who would have thunk!
  • Sunday, November 24, 2013:
    • Many changes are coming!
    • This site will migrate by late January.
    • The new sites, GeeksWhoCook and GeeksWhoEat, will replace this development site.
    • These sites will emphasize cooking skills, weight loss and maintenance, and meeting others.
    • Hosting will migrate to Azure, with a test site extant later today.
    • All USDA databases (SR, CN, FNDDS) are now consolidated.
    • Various admin tools have been implemented to allow me to update USDA and other databases as regular updates of them are released.
  • Sunday, October 27, 2013:
    • Julia has undergone some surgery.
    • Julia associative memory wipe/regenration implemented.
    • Administrator can now edit and resave any recipe.
    • Loaded recipes can be re-analyzed.
    • If they send back a Terminator from the future to shut down SkeyChef and Julia...
    • ... it will look like Chef Ramsay.
  • Sunday, October 13, 2013:
    • Today is the day the artificial intelligence Julia has gone live.
    • This was the last major brain section for the food analysis AI.
    • This is the part that learns patterns from users who save and edit recipes.
    • The more people analyze and refine food choices, the smarter Julia gets at choosing her matches.
    • Queue the SkeyChef Terminator jokes...
  • Saturday, September 28, 2013:
    • Many new heuristic additions.
    • Nut Butter Dude, ping me if you see this....
  • Sunday, September 22, 2013:
    • Converted all varchar to nvarchar in databases.
    • Duh.
  • Friday, September 13, 2013:
    • Spooky day...
    • Recipe measurements now round to nearest 1/8, 1/4, or 1/3, in keeping with common kitchen measurements.
    • Number rounding and string conversion is now more regular.
    • Updated help info on analyzer tab.
    • Added item to "No Matches" message.
    • Fixed "Do NOT Copy Food Name" issues.
  • Wednesday, September 11, 2013:
    • Bug! Edge case!
    • When a database supplies a measure in grams with Amount greater than 1, the converter got crazy.
    • Amount and weight are now normalized around one in ParsePortionLoadedFromDatabase().
    • One pound of basmati rice no longer weighs 22680 grams!
  • Monday, August 12, 2013:
    • Noticed that micro-nutrient percentages were displaying incorrectly on the long label. Fixed.
    • Holy crap! I forgot to re-initilaize HA objects on some search list regeneration! Fixed!
  • Sunday, July 21, 2013:
    • Working on better structured exception handling.
    • Errors email directly to me.
  • Wednesday, July 17, 2013:
    • A bunch of clean-up entering food items from their nutrition labels.
  • Saturday, July 13, 2013:
    • Recipes and foods entered from labels can be deleted by their owners. (or me!)
    • Recipes or foods entered from labels are deleted smart: if referenced by a log or another recipe, they are deprecated, else they are removed.
    • Recipe analyzer matching lists are now ajaxified with search. Hoo ya!
    • Recipes can now "lock" user text. A food typed by a user can prevent the description from the backing database item from replacing that text.
    • As always, numerous bug and display fixes.
  • Sunday, June 30, 2013:
    • Food logger fixes. I had become too clever by half. Better now.
    • Food, recipe, label, and food logger databases tuned for performance (indexes added or fixed).
    • Various layout and bug fixes.
  • Sunday, June 16, 2013:
    • A lot of work on the recipe analyzer has been done.
    • Many errors corrected, two factor analyzer moved into the object, portions works as it should, etc.
    • A user brought to light problems, so I dove in all the way on the recipe analyzer.
  • Sunday, June 2, 2013:
    • Added favorites to food logger.
    • Still needs deletes and some debugging, but still kind of cool.
  • Tuesday, May 28, 2013:
    • Whoa! Food Label addition was screwed up.
    • Hopefully fixed now...
  • Sunday, May 26, 2013:
    • Lots of work cleaning up and robustifying Food Log.
    • Food Log may be ready for prime time!
    • Have begun cleaning up the overall de-modeling creep: Moving inappropriate functionality to model from controller and view.
  • Sunday, May 19, 2013:
    • Un-oops, sigh of relief. Primary keys were set incorrectly in the production database. Silly me.
    • OOOPS... Cannot add a new foodItem. Well, I'll be fixing... Odd, it works in the local test environment.
    • You may now log your food habits.
    • There may be bugs, but a LOT of work is finished!
    • WOO DAMN HOO!
  • Saturday, May 18, 2013:
    • More work on the food logger...
    • If the hot dog guy from the Farmers Market reads this, please email me.
    • I will be cooking some duck breasts tonight.
  • Sunday, May 12, 2013:
    • Login required for food logger.
    • Food logger persists selection across tab changes.
    • Other food logger controls persist states.
    • Login pops back to page you logged in from.
    • I will next finish entry of food log foodItems and their persistence.
  • Saturday, May 11, 2013:
    • Telerik update.
    • More food logger work...
    • I have been to Yosemite. It was grand.
  • Monday, Thursday 28, 2013:
    • Fixed nasty little exception in recipe analyzer.
    • Playing with on demand combo box in food logger.
  • Monday, March 25, 2013:
    • Monkeyed around with food logger...
  • Sunday, March 3, 2013:
    • Improved drag and drop on the food logger.
    • Drag and drop on the food logger should now work as advertised.
    • Slow cooking two kinds of pork ribs this afternoon.
  • Saturday, February 23, 2013:
    • Resumed work on logging one's food consumption. See the "Food Log" tab.
    • AJAX-ified the nutrition label and data grid.
    • Wired up the nutrition label to the current meal in context.
    • Making a goat cheese, chard, and herb pie in a phyllo crust tonight.
  • Monday, February 18, 2013:
    • Added synonyms. This came as a result of "oe" plurals, like tomatoes and potatoes. Very gnarly.
    • BTW, Dan Quayle was treated unfairly over this.
    • Recipe analyzer now handles duplicates much better.
    • Recipe analyzer algorithm optimized. Only new foodItems are re-analyzed.
    • Better handling of updated recipe via the text box.
    • Better handling of updated recipe via the controls after an initial analysis.
    • Better resolutuion of contention when changes occur in both text and controls.
    • Better handling of wordy measures supplied by the databases.
    • Addition of a new RawRecipeCompare object, allowing fast and intelligent detection of differences between two text recipes.
  • Friday, January 25, 2013:
    • Added a ReaderWriterLock() to manage access to the treeview node map in BrowseFoods. This was needed because when a session adds a recipe or label, the first session to hit BrowseFoods performs an application wide update of the TreeNodes.
  • Thursday, January 24, 2013:
    • Happy Birthday to me! (Unlike Gandalf, I have not been on (middle) Earth for ~18,000 years.)
    • Fixed insidious timing/lock bug involving static initialization during the application start thread.
    • Fixed a number of little irregularities from my "C" level to do list:
      • Fixed RadTreeView to restore selection on return to browse food tab.
      • Made recipe and label treeview updates application global.
      • Moved buffered treeview structure creation to application start thread.
      • Sorted the recipe list.
      • Etc.
  • Wednesday, January 16, 2013:
    • Adding new databases is now completely independedent of the NutritionDataCollection dll. A custom configuration section in web.config now registers a database and allows deprecation and visiblity.
    • This had been bugging me for a while, so kudos to me for finally fixing this once and for all!
  • Monday, January 14, 2013:
    • Added FNDDS5.
    • Excluded old databases from recipe analysis.
    • Turned search threading back on.
  • Saturday, January 12, 2013:
    • Added SR25 and CN16 updated USDA databases.
    • Updated FNDDS5 tomorrow...
  • Wednesday, January 9, 2013:
    • The managed environment launches multiple instances of the application. Modified rolling log file to be on a per instance basis to ease debugging.
    • Fixed centering issue on nutritition label (only appeared on mobile devices).
    • Cooking a goat cheese/bacon omelette from local ingredients tonight.
  • Sunday, January 6, 2013:
    • Leptonica and Tesseract successfully compiled and run. I need to scan nutrition labels from products on store shelves for use in lookups.
    • Work on an Apple iOS app to facilitate this site has begun.
    • Food Log begun.
    • Cooked a very nice pork loin roast with a pomegranate and balsamic glaze last night.
  • Sunday, October 7, 2012:
    • Fixed issues around duplicate derived measures for food foodItems.
    • Fixed issues around deleting measure from raw recipe box on Analyze Recipes screen.
  • Saturday, October 6, 2012:
    • I spent the past week in the mountains kayaking, hiking and programming.
    • The AI has been completely refactored into a HeuristicAnalyzer object.
    • The new AI object is 750% faster at analyzing a recipe than previous to today.
    • Very much work was done on the heuristics used to select recipe ingredient matches. Hit rate is HUGELY improved.
      • The way saved recipes are used as ingredients is fixed. Searches only against title.
      • T and t common measurement usage fixed.
      • Many, many proprietary additions to the heuristic analyzer.
  • Saturday, August 11, 2012:
    • I am writing this from the outer banks of North Carolina. Sweet!
    • There have been many, many deploys since my last notes here.
    • Yes, I know I broke the recipe analyzer and label entry. FIXED!
    • Newest Telerik controls deployed, licensed version.
    • Label entry may be complete. Testers still testing.
    • Next foodItems to implement:
      • Personal Food Log.
      • Look and Feel: Working with designer to move from a developer sandbox to a functioning public site.
      • Look and Feel: Enable site wide skinning with control overrides as needed.
  • Monday, June 25, 2012:
    • Happy Birthday, Pam!
    • Input label on Add Items From Label tab way smarter!
    • Myriad refactors refactored and bugs de-bugged.
  • Sunday, June 10, 2012:
    • Much more done!
    • See the new label on the add foodItems from label tab.
    • Wow! Still almost there!
  • Sunday, April 22, 2012:
    • Lot's more done!
    • Save and load recipes complete.
    • Label ready for extended micro-nutrient values.
    • Various bug fixes and optimizations, of course.
    • Next foodItems to implement:
      • Add foodItems to database from the nutrition label on a purchased foodItem.
      • Enable use of recipes and purchased foodItems in a recipe.
      • Add "Format Recipe" with directions, picture, cooking time, etc. and a "Print" function.
      • Add personal food log with reports.
    • Wow! Almost there!
  • Sunday, April 1, 2012:
    • Much has been done, though I have not been consistent updating these comments. Apologies for that.
    • Recipe save database is in place.
    • "Load Saved Recipes" tab is almost complete, but controls are not yet "wired" up. Take a look.
    • Telerik controls updated and re-integrated with the development environment.
    • Various bug fixes and optimizations.
  • Tuesday, January 24, 2012:
    • Today is my birthday.
    • So many fixes, refactors, and AI tuning, I will not describe today.
  • Saturday, January 7, 2012:
    • Added heuristics to sort and search algorithms. Food matching greatly improved.
    • Bug fix when switching between browse and analyze tab.
    • Database and tables for recipe "Save" implemented.
  • Thursday, December 29, 2011:
    • ALL implementation specific dependencies removed from NutritionDataCollection dll in preparation for move to MVC3.
    • TreeView data intializer refactored (Browse food tab). LINQ queries optimized. 400% increase in performance!
  • Sunday, December 18, 2011:
    • LINQ optimizations on nutrition info query, as suggested by S.R. Nice catch!
    • Bug fixes to nutrition label adder. Fixes values in recipe analyzer tab.
    • Better maintenence of common measure on browse tab when changing foods.
  • Tuesday, December 13, 2011:
    • Build Recipes tab activated:
      • This will link with the anlayzer on the next tab.
      • Nutrition label to be included.
      • Formatted print to be implemented.
      • Keep checking, I am working....
  • Saturday, December 10, 2011:
    • Analyze Recipes portioning (slice, cookie, serving, etc.) and number of servings per recipe now works.
  • Wednesday, December 7, 2011:
    • Fixed default portion size to first non-derived portion.
    • Working on portioning in recipe analyzer...
  • Wednesday, December 7, 2011:
    • Working on portioning in recipe analyzer...
  • Sunday, Novenber 27, 2011:
    • The recipe anlayzer has been debugged and appears robust. Of course, testing will tell.
    • Analyzer threads off each line to a task.
    • Dynamic controls created and maintained against the "raw" recipe.
    • Scoring algorithm/AI continues to add heuristics.
  • Saturday, October 8, 2011:
    • I am back. A trip to France and a new contracting opportunity consumed time.
    • The full cut and paste recipe analyzer with AI ingredient analyzer is done in a thick client prototype. I will add this over the next several weeks.
    • The look and feel is being revised by a web designer here in NC. Stay tuned.
    • Conversion to WCF to expose service, operation and data contracts under way.
    • It's good to be back!
  • Sunday, July 17, 2011:
    • Paging now makes sure the top row is selected via PreRender and PageIndexChanged events, eliminating an exception.
    • The measure (oz, egg, piece, etc.) now resets properly when the selected food changes, eliminating an exception.
    • The measure (oz, egg, piece, etc.) now persists intelligently as food selections change.
  • Saturday, July 16, 2011:
    • Search Foods is now much, much clearer and cleaner
  • Wednesday, June 29, 2011:
    • Viewstate now persisted on server, increasing performance.
    • Appliccation and Session timeouts now handled with a re-direct to Home
    • Some Ajax update problems fixed