Archives for: April 2007
Food Equalizer
April 27th, 2007 , by adminSpent the last two weeks in feverish rewrites of The Genotype Diet. The results appear to be a manuscript that is tighter, better organized and much less 'difficult' to decipher for the average layperson. Very readable, in fact. Something that my new masters at Random House care (not unexpectedly) very much about.
A lot of credit for this must go to Rachel Kranz, who has come in at the eleventh hour and really polished up the work. Rachel has done a lot of good writing (The Chemistry of Joy and the The Fat Resistance Diet are two books that many people are aware of. So now the manuscript is back at Random House editorial offices and I'm hard at work at finalizing the prescriptive parts of the book.
To do that, I wrote a program to help me sort out the myriad factors that are associated with the food values in the Genotype Diet. How different are things from the of Eat Right For Your Type days, where things were just kept in notebooks! For this book, I condensed huge amounts of information into massive data files. These include, to name a few, the mammoth USDA SR19 Nutrient Database and most of it's adjuncts (such as the proanthrocyanidin, isoflavone, flavone and choline metabolites); all of the Lecster lectin database; all of the BTD values, all available data on food contamination, allergens, chitinase, pesticides, carbohydrate breakdown values, etc.
Putting the data together was just part of the job. A lot of this I could do with judicious use of textfiles, databases and spreadsheet editors. After that I still had to write a program, essentially de novo, that could scan that data and derive conclusions that I was interested in. This I did with the D'Adamo Diet Equalizer a tool that allows me to zoom in on specific nutrients and filter them in and out of my equations.
The idea came from working in my home office and listening to iTunes a lot. Every once in a while a song comes up that just requires a little tweaking to get it to sound right. Normally you do this with a device called an equalizer; a series of sliders that filter out parts of the audio spectrum. At one point I was adjusting the built in equalizer in iTunes for the song listed above (a very good approximation of pre-ambient Brian Eno, if truth be told) when it occurred to me that it might just be a cool idea to write a program that used the equalizer interface to filter my data for The Genotype Diets. Thus the D'Adamo Diet Equalizer:
The stuff on the top are switches that filter specific choices; i.e 'restrict all foods which are avoids for blood type AB non secretors and have a high glycemic index" or 'include all grains which don't contain gluten or gliandin which are neutral or beneficial for type O secretors'. That kind of stuff is simple enough to do in Perl and HTML. However, developing the next series of filters, the slider channels, was more difficult, since browsers and HTML don't have a provision for slider-type input. However, I did find a nice Java applet that solved the problem. This part of the software works by allowing me to move the slider up or down and then letting it adjust the choices based upon falls within that range. For example, if I move the sider up it might include all foods with creatine content above 4 mg per 1 cup serving, or restrict all foods which have greater than 350 mg sodium per cup if I move it down. Problem here is that food values vary considerablly between foods. If I make the top of the slider full value the highest value in the database things can get screwy. For example, the highest value for sodium in the database is (perhaps no surprise) salt. It has something like 35000 mg of sodium per cup. Second place is not even removely close. Thus if the top slider number (+50) was just the highest value (salt), all the other values for normal foods would probably lie between 0 and 1. Although this is how a lot of the online nutritional databases present the data, in this form it is not very useful. Fortunately I was able to use a few log functions to spread out the data till it was silky smooth.
It's a cool tool and like any craftsman, I take some pride in the quality of the presentation as well. Actually perhaps too much pride since I eventually have to stop playing with the thing and go to work. The DDE turns out to be very useful in the Clinic, especially when I have to do a quick tweak on a patient who is already following the basic SWAMI program.
Hopefully by IfHI 2007 I'll be in a position to let the folks there tinker with it.
As for the readers of the GTD, they'll see nothing of this. Just a beautiful stretch of road where the gorgeous scenery just seems to go on forever.