Factor out csv parsing & fix namespaces.

Copy and paste for now. Need to remove code from k.h.a.entities and k.h.a.profiles after rebasing on @annapawlicka's changes.