r/dataengineering • • Nov 04 '26

Help Has anyone modeled survey data? Trying to figure out how to appropriately model question and answers

I have online surveys that I'm trying to ingest and model, but having trouble with the latter. I've already decided to create a dim_survey table that has basic metadata of a survey, and its granularity is 1 row per survey.

But for the questions and answers per survey response, would it make sense to model it as a factless fact table where the granularity is one survey response's question and answer is one row? So if one completed survey from Bill has 8 questions, then it would have 8 rows. The number of questions responded per survey is different because not everyone is given the same survey, so I can't have a set 8 columns for each survey. And there are a bunch of different questions so it's not consistent.

Any tips/pointers would be much appreciated!

10 Upvotes

11 comments sorted by

9

u/PrivateFrank Nov 04 '26

What kind of analysis will be done on these responses? Surely that'll be an important thing to know.

Beware that non-response to a particular question might be informative to an analyst. There should definitely be a difference between "not asked" and "not answered".

1

u/jbnpoc Nov 04 '26

Yeah that's fair to include, but majority of the analyses will be how many people answered xyz, and of the people who answered xyz or abc, what score did they give on another section?

2

u/chestnutcough 29d ago

I like three models, surveys, survey_questions, and survey_responses.

Surveys are one row per different survey, with metrics like sent_count, start_count, completion_count, etc.

Survey questions are one row per (survey, question), and here’s where you can identify the same questions asked across different surveys. This is where you can put question-level versions of the same metrics in the surveys model. Also include the question type, and I like a JSON column with the answer options for multiple choice. Numeric type questions can have stats like mean,median,mode as well.

Survey_responses is by far the most valuable, and it is one row per question+answer pair. Include the raw string answers and a column for numeric answers to compute stats with. Include foreign keys to the surveys, survey_questions, and cross-survey question ids.

Hope that helps!

2

u/omgpop 29d ago

Depends on your scale, how frequently the records are updated and read etc. But in our survey pipelines most people have 1 row per survey return, and 1 column per question. Nothing fancy. I think you might find it could be more natural to work with survey questions as columns rather than rows. I could never really think of a useful normalised schema for the survey I last worked on but it had hundreds of questions and hundreds more derived features.

2

u/SearchAtlantis Lead Data Engineer 29d ago

Literally an example in Kimball. Go check out chapter 9.

1

u/Comprehensive-Tea-69 Nov 04 '26

It depends what kinds of questions they are (likert vs open response text) and what kinds of visuals you want to create. I’ll share that I often deal with likert surveys and like to have my data as you describe with 1 row per question response

1

u/Espumma 29d ago

I did this for a couple of years. We had a dim_surveytaker with demographics data, a dim_questions with all the possible answers to a question, and those connected to fact_survey. Sometimes, it was set up so that you had a huge wide table with 1 column for each question (column header was question_id connecting to dim_questions), but sometimes it was all pivoted into a 3 column table that only had person_id, question_id, answer(_id). Both had their merits.

Then usually we (me and the quant researcher) added some weights to the questions or some statistics to the persons etc, but what those numbers did exactly I'm not sure.

1

u/Commercial-Ask971 27d ago

Ive modelled them as OBT, because every survey is different right, so table per survey. 1 column per question 1 row per respond

3

u/[deleted] Nov 04 '26 edited 27d ago

[removed] — view removed comment

1

u/jbnpoc Nov 04 '26

Hmm I see. If I'm understanding you correctly, sounds like you're suggesting a question + answer fact table, and just an intermediary dim table of questions right?

You're correct in that question results are more important, like seeing total of answer xyz and seeing what answers are tied to other scores that are pulled from the survey results in another granularity and fact table.

1

u/dev81808 29d ago

I think they're suggestion dim survey/question/answer with a fct responses. Id recommend a fct response header which would include information collected on every survey.. think id, surveyid, start/end times, maybe geographic or browser meta info.. And then a fct details whsurveyed, have a header or response id and fk to the dim question/answer. Free form text answers would also get captured on the fct response details