clinwiki-org / clinwiki

Crowd-source tool to annotate, rank and generally enhance the clarity and accuracy of clinical trial information.
https://www.clinwiki.org
MIT License
16 stars 16 forks source link

Track page views (STUDY VIEW LOGS) #672

Open williamhoos opened 3 years ago

williamhoos commented 3 years ago

Store every time a user views a study so we can show the total times a study has been viewed

Tasks:

Tonyynot14 commented 3 years ago

Allow limiting or grouping by time (ie if we want/need to limit to last week/month/year or show more granularity/trending). Are we saying grouping when the study was viewed in the index? Essentially having a count and some way of looking for more than 10 views in the last week?

williamhoos commented 3 years ago

Need to clarify how we are indexing or displaying. Is there a best practice for recording and indexing records like this?

Tonyynot14 commented 3 years ago

I would assume best practice for logging study_page_views would be just making the log contain very little information. This would include user_id and nct_id of the study the user viewed. Rails includes a updated at and created column as well. That part is straight forward. Indexing the study view-count would be straight forward as well. The issues arises when trying to groups them in some way and see the view count. I am not sure of the best way to do that to be honest. Will speak to Ramiro about the issue and see if he has any ideas.