I know exactly the thing. There's a project on Wikimedia commons to document the substructure of characters in terms of other characters. I haven't spent much time with the data itself, so I can't tell you how complete it is, but it seems pretty good based on my experience with the Tatoeba character search tool that is based on the data. That tool allows you to "explode" characters into their components (e.g., 蝴 => 月虫...
) or search for all characters with a particular component (e.g., 隹 => 倠傕傩...
).
Another project to do something similar is Wenlin's database of characters in the Character Description Language. Here is Wenlin's page of resources on the CDL. I'm not really sure if you have to buy Wenlin in order to get at some data. Anyhow, it looks pretty awesome.
Best of luck in your endeavors! I've wanted to do something similar, but I've always been too busy. Make sure to tell us about the cool things you do with the data :-)