Closed garethrees closed 8 years ago
RE: profiling, after a bit of experimentation in the console here's an initial sketch run over WDTK users:
ActiveRecord::Base.logger.level = 1
def user_type(data)
return :ghost if data.values.sum.zero?
return :single_request if data[:info_requests] == 1 && data.values.sum == 1
return :commenter if data[:comments] > data.dup.slice!(:comments).values.sum
return :requester if data[:info_requests] > data.dup.slice!(:info_requests).values.sum
return :classifier if data[:request_classifications] > data.dup.slice!(:request_classifications).values.sum
return :follower if data[:track_things] > data.dup.slice!(:track_things).values.sum
#
# Doesn't work yet because of missing association
# return :body_updater if data[:public_body_change_requests] > data.dup.slice!(:public_body_change_requests).values.sum
return :other
end
User.where(:ban_text => '').count
# => 97052
puts Time.zone.now
# => 2016-06-16 12:15:47 +0100
profiled_users = {}
User.where(:ban_text => '').find_each do |user|
data = {
:comments => user.comments.count,
:info_requests => user.info_requests.count,
:request_classifications => user.request_classifications.count,
# Doesn't work yet because of missing association
# :public_body_change_requests => user.public_body_change_requests.count
:track_things => user.track_things.count
}
profiled_users[user_type(data)] ||= 0
profiled_users[user_type(data)] += 1
end
puts Time.zone.now
# => 2016-06-16 12:51:37 +0100
profiled_users
# Manually sorted
# => { :single_request => 30306,
# :ghost => 25953,
# :requester => 20649,
# :follower => 11018,
# :other => 7046,
# :commenter => 1674,
# :classifier => 400 }
:other
, but it probably wouldn't affect the overall picture. An example of someone that we might want to class as a commenter, but is getting caught in :other
:data = {
:comments => 10,
:info_requests => 4,
:request_classifications => 4,
:track_things => 4
}
Results for AskTheEU:
User.where(:ban_text => '').count │irb(main):025:0*
# => 2176
profiled_users
# => { :ghost => 1101,
# :single_request => 399,
# :requester => 309,
# :follower => 281,
# :other => 67,
# :commenter => 14,
# :classifier => 5 }
Similar, except ~50% of users have done nothing at all, compared to ~30% on WDTK.
Same story for IPV:
User.where(:ban_text => '').count
# => 657
profiled_users
# => { :ghost => 234,
# :single_request => 226,
# :requester => 132,
# :follower => 30,
# :other => 28,
# :commenter => 4,
# :classifier => 3 }
Dumb table just for the sake of comparison.
Q: What are the different user personas that use Alaveteli?
We assume there are:
Measurement
Need to do a bit of thinking about this, but we want to be able to say something like "20% of users never make a request, but have more than one track".
Requirements
Requires https://github.com/mysociety/alaveteli/issues/3283 so that we can profile existing users.