This is my current attempt to convert the RAW data to how the image should look - Examples
I developed the code for this by first taking lots of shots of colour charts, building up a profile of how the RAW data responds across a wide range of values. I then attempted to turn the profile into a mathmatical model which can be used to calculate the colour in the sRGB colour space.
Currently, I've only profiled under strong sunlight, and haven't yet developed profiles for typical other white-balances or a general white-balance method. While I could simply start with the sunlight white balance and do a conventional temperature scale, that will not have good colour accuracy.
Currently, there are a number of flaws with the profile, and it's something I need to spend a lot of time on.