You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Rauan Maemirov <ra...@maemirov.com> on 2011/02/19 15:07:56 UTC
Data model for activity feed
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"?
Re: Data model for activity feed
Posted by Rauan Maemirov <ra...@maemirov.com>.
Any advices? Maybe I should group events from application? Wouldn't it be to
much overhead?
2011/2/19 Rauan Maemirov <ra...@maemirov.com>
> 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"?
>
>