incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rauan Maemirov <ra...@maemirov.com>
Subject Data model for activity feed
Date Sat, 19 Feb 2011 14:07:56 GMT
Hi, with the help of twissandra example, I tried to create a scheme for
activity feed.

Activities cf stores all activities:

Activities: {
  '4d5fbfdf47878': {
    'user': 'larry',
    'activity_type': 'comment',
    ...
    activity info
  }
}

And userfeed cf stores each user's feed sorted by timestamp:

Userfeed: {
  'larry': {
    1298120671317982: '4d5fbfdf47878',
    1298120671392978: '4d5fbfdf5ff12',
    1298120671417977: '4d5fbfdf660b9',
    1298120671517972: '4d5fbfdf7e754',
    1298120671542971: '4d5fbfdf848fb'
  }
}

That was simple. Now I want to group all similar activities by some little
time period (like it works in facebook and so on). The idea is to find
latest activity from user by activity_type and move it to the new activity
(in other words, merge activities and update timestamp). So it will be
something like:

Userfeed: {
  'larry': {
    1298120671317982: '4d5fbfdf47878',
    1298120671417977: '["4d5fbfdf660b9", "4d5fbfdf5ff12"]', //json encoded
array of activities
    1298120671517972: '4d5fbfdf7e754',
    1298120671542971: '["4d5fbfdf848fb", "4d5fbfdfd3e74"]'
  }
}

Is it okay? Maybe somebody did this more elegant way.
Maybe I should one more intermediate cf for grouped events?

The other problem is that here I can say that "Larry commented item1, item2
and item3", but how can be done "Larry, Curly and Hermes commented item1"?

Mime
View raw message