There is a whole field of research called Differential Privacy that deals with, basically, how much and what data you can release and what information can be deduced from that. It is fascinating and has many applications from advertising (FB demographics...) to medical research.