Reply to topic  [ 4 posts ] 
Help with data model 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Hi All,

I'm struggling to work out the best way of modelling some data and thought I'd ask here.

My app contains a survey of a number of questions (55 at the moment). The survey is split into 4 clusters, each cluster has 2 or 3 sectors and each sector has 4 or 5 questions.

i.e. [Cluster] <--->> [Sector] <--->> [Question].

(<--->> = "one-to-many" relation)

The questions are the same for everyone.

Now I need to store users' answers.

This is how I was thinking of modelling it...

[User] <--->> [UserMap] <--->> [QuestionScore].

The UserMap will hold the date created and mapID etc...
The QuestionScore will hold the questionID and the given value for the answer.

However, I was uncertain whether it was a good idea to keep the question content (i.e. the first part of the model) separate from the storage of the answers (i.e. the second part of the model).

Should I have some relation between the two? Or should I integrate them so that the UserMap then stores the Clusters, Sectors and Questions (along with the scores)?

This would mean a lot of duplicated storage though?!

Any input welcome!

Thanks!

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Sun Aug 22, 2010 4:20 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5159
Location: /dev/tty0
Reply with quote
I would add some relation otherwise when you pull out an answer you may not be able to be 100% certain what question it was answering (some data structures don't need to output in the same order they were input, I can't remember which ones do or don't atm).


Sun Aug 22, 2010 4:32 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
My thought would be

Table 1
List of the questions showing the cluster and sector for each inc a unique ID

Table 2
If needed a list of user details and a unique ID

Table 3
time date stamp, user ID, Question ID , answer

From that you can recreate just about anything.

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Sun Aug 22, 2010 4:35 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Thanks both!

Helped a lot in clearing up what I was doing!

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon Aug 23, 2010 11:07 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.