Hey guys,

This is a mind jogger rather than a question. I have a rails site, and
this site has users, there users do things like vote, give opinions
etc. Now I want to collect this data and display it, possibly using
flot, to show the break down of users by age, sex, location, etc etc.
I was initial going to hit the database for each query I want to have,
but that seems like too many database hits and too much
redundancy.....any one know of a smarter way to do this?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Dave Aronson at Jan 18, 2012 at 5:52 pm

    On Wed, Jan 18, 2012 at 09:42, bertly_the_coder wrote:

    users do things like vote, give opinions
    etc. Now I want to collect this data and display it, possibly using
    flot, to show the break down of users by age, sex, location, etc etc.
    I was initial going to hit the database for each query I want to have,
    but that seems like too many database hits and too much
    redundancy.....any one know of a smarter way to do this?
    How many users do you have, what demographic data do you need, how
    many choices are there on each, how many different ways to vote were
    there, how are you recording the votes, how often do you expect it to
    be queried, and how? Any way you recorded the votes, you can probably
    extract a fairly well rolled-up version, and serve up more specific
    rollups from there. If worst comes to worst you could use memcache or
    some similar thing to reduce database traffic.

    For instance, suppose you were polling on the favorite season, and you
    want to break it down by age, sex, race, educational level, income
    bracket, employment status, marital status, shoe size, hair color,
    handedness, and location (defined as nearest integer latitude and
    longitude), etc. etc. etc. You could store them in a table with
    season, each demographic factor (extracted from the user record or
    input at voting time), and a count of how many such people voted for
    that season. (Do NOT store just vote and user ID, to extract the
    demographic data later on demand, if the users might ever care about
    the votes being secret! Store who voted, *separately*.) Then it
    should be easy to pull out a breakdown by each demographic sector, or
    even a combination. (Just be aware that with a small enough sample
    size, it may thus be possible to extract how certain individuals
    voted, or reveal other private data.)

    -Dave

    --
    Dave Aronson, President, Dave Aronson Software Engineering and Training
    Ruby on Rails Freelancing (Northern Virginia, Washington DC, or Remote)
    DaveAronson.com, Codosaur.us, Dare2XL.com, & RecruitingRants.com (NEW!)
    Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (me)

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 18, '12 at 2:42p
activeJan 18, '12 at 5:52p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Dave Aronson: 1 post Bertly_the_coder: 1 post

People

Translate

site design / logo © 2021 Grokbase