Mike-Heneghan / ALISS

ALISS (A Local Information System for Scotland) is a service to help you find help and support close to you when you need it most.
https://aliss.org
0 stars 0 forks source link

Add new db queries for analytics. #114

Closed Mike-Heneghan closed 4 years ago

Mike-Heneghan commented 4 years ago

For user research, it would be useful to be able to have prewritten queries to find out the following:

Mike-Heneghan commented 4 years ago

Filter organisations and services created by an editor:

organisations_created_by_editor = Organisation.objects.filter(created_by__is_editor=True)
print("Number of organisations created by editor: " , len(organisations_created_by_editor))

services_created_by_editor = Service.objects.filter(created_by__is_editor=True)
print("Number of services created by editor: " , len(services_created_by_editor))
Mike-Heneghan commented 4 years ago

How many Editors have updated the information they add:

This seems like it could be challenging to figure out.

Could count the times were an organisation was last updated by its creator who is an editor? Then count the times where a service was last updated by its creator who was an editor. Then combine these data sets and only count the distinct instances of editors.

Work in progress:

organisations_created_by_editor = Organisation.objects.filter(created_by__is_editor=True)
organisations_last_updated_by_creator = organisations_created_by_editor.filter(created_by=F('last_updated'))
print("Number of organisations updated by their creator who was an editor: " , len(organisations_last_updated_by_creator))
Mike-Heneghan commented 4 years ago

Assuming that the proposed questions are regardless of whether the services and organisations are published or not.

That there is not a historical record of when updated occurred on an organisation and service, only who the last user to update was.

Hence if a user created a service, updated it and then someone else subsequently updated then this user would not be counted for the above.

Mike-Heneghan commented 4 years ago

Analytics queries ran on production data and result sent. Still, need to decide on the best place to keep the methods.

Mike-Heneghan commented 4 years ago

Split the user statistics from the location based reporting.

Mike-Heneghan commented 4 years ago

Merged into master