How to automatically generate rich codebooks from study metadata