Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 766019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:58:42+00:00 2026-05-14T16:58:42+00:00

Background I’m designing a Rails app to record research data. Most of it can

  • 0

Background

I’m designing a Rails app to record research data. Most of it can be conceptualized as being “survey” (or “questionnaire”) data.

We already have several Access databases and CSV files that hold this data. The existing design is that each survey has its own table with one column per question. Many of these tables have 100+ columns.

I just got a report of how many columns there are for all the surveys in total. The count is 18,683. Yes, 18,683 columns — a lot more than I was expecting. (I think there are more columns than rows, in total. Some tables may be vestigial, but I know that several are very important.)

To reduce the complexity of the problem, I’ve been thinking that I would make some models like:

  • Survey
  • Question
  • Response

This strategy would reduce the number of columns from thousands to just a handful. However, I’m not sure how to approach it through Rails because:

  • We need nice views (better than autogenerating forms) for several of the surveys.
  • We need validation (some surveys are simple, but others are quite complex).
  • We need to link the data to other records and report it. My bosses would expect each survey’s results to be pivoted (e.g. one column per question) so they can analyze it. Is there an elegant solution for this?
  • Storing responses seems more difficult than with the wide tables (unless there’s a good strategy for a “polymorphic column”).
  • …and other cases where I’d probably want to treat each survey as an ActiveRecord model.

Question

How can I simplify this “question1, question2, …, question143” monstrosity? Although I’m sure there’s not a completely elegant solution, what’s the best choice?

I’d be interested in alternative databases if they would make things easier. I’m not very familiar with document databases (like mongodb or couchdb), but from what I know, they might be helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:58:43+00:00Added an answer on May 14, 2026 at 4:58 pm

    I think that MongoDB would be good solution for this; it’d definitely be worth your time to familiarize yourself with it. The schemalessness would ease things quite a bit. For instance, you could store each survey in a document looking something like this:

    survey = {:title => "Thoughts on X",
              :questions => [
                {:text => "What year were you born?",
                 :type => "Fill in the blank",
                },
                {:text => "Pick an option:",
                 :type => "multiple_choice",
                 :choices => ["a", "b", "c", "d"]
                }
               ]
              }
    

    You could then write code capable of interpreting these survey documents and presenting them on the web. You could certainly include special validation information in each document, etc.

    A separate collection could contain user responses. You could use MongoDB’s map-reduce for aggregations.

    Just some initial thoughts. Jump on the MongoDB user list if you decide to explore this direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: We're building an application that allows our customers to supply data in a
Background So, with iOS 6 an UITextView can take an attributedString, which could be
[background below] I've got my data modelled out in SQLObject in Python on the
Background I am developing a social web app for poets and writers, allowing them
Background To replace invalid zip codes. Sample Data Consider the following data set: Typo
Background: I am developing an app which sends an SMS to users after registration
Background I had [HandleError] in place in my MVC web app for exception handling
Background Given that 'most' developers are Business application developers, the features of our favorite
BACKGROUND: Right now, in our company we have a PHP based app to automate
Background: I am trying to add data to a SQL DB with C#. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.