SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Columbia, Missouri
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Design ideas for a system handling form data

    Hello all, I am working on designing a system that basicly handles forms and I'm trying to come up with some new ideas.

    Lets say the system has a bunch of forms to choose from. A regular user will go in, choose a form, fill it out and submit it. Administrators can go in an change the questions on the form, the options available on multiple choice questions, etc. I'm stuck on how the system should save all the answers that the user enters into the form.

    We have a system in place that saves the answers in a table/column specified by the question. Therefore every time a new question gets added to a form a database administrator such as myself will have to ensure that there is a place in the database to save it. I want to get away from that.

    I was just reading an article on Entity-Attribute-Value Modeling which uses one big table to store all the answers. That may be a good solution for this system. Does anyone have any suggestions or experiences to share?

  2. #2
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Columbia, Missouri
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, by the way I posted this here because I'm implementing the system in Ruby on Rails.

  3. #3
    SitePoint Enthusiast ianpurton's Avatar
    Join Date
    Jul 2004
    Location
    Isle of Dogs
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's an article that talks more about the EAV model http://ycmi.med.yale.edu/nadkarni/eav_CR_contents.htm

    I'd be interested in looking at what you come up with if that's possible.

  4. #4
    SitePoint Enthusiast ianpurton's Avatar
    Join Date
    Jul 2004
    Location
    Isle of Dogs
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Columbia, Missouri
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help! I've read through them and it defnintely seems like this is the best solution for what I'm doing. I also found this on the Yale site: http://ycmi.med.yale.edu/nadkarni/In...%20systems.htm which conviced me this seemed right since what they are using it for is VERY similar to what I have to do.

    They put some source code up on their site ftp://custard.med.yale.edu/pub/Current_Release/ so I'm going to dig through that.

    This is also of interest: http://www.jamia.org/cgi/content/full/7/4/343.

    I'll be sure to let you know what I come up with.

  6. #6
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Eastbourne, UK
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recently created a survey application similar to what you describe. I did it by having a single table that stored the question response, a reference to the survey response (stores date/time of the survey completion and provides a reference to all question responses) and a reference to the question asked.

    From the reference to the question i can then determine the question type (i have a set number of question types, such as checkbox, radio, text, essay, etc) and treat the stored question response in the correct way.

    All question responses are saved in plain text, with questions that have multiple choices stored on multiple lines. The only variant to this was for a special type of question type that allowed data tables to be created, for these I found the best way of storing them was to use rubys data marshalling to store a copy of the raw hash object.

    Thats the basic principle anyway, it was complicated a bit by also having the possibility for questions to have an "other" response but thats not too hard to work out.

    I'd be interested in what you come up with if you care to share it.

    Kev


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •