Refine all foreign keys
Add API for questionnaire