publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
958 stars 1.83k forks source link

Ability to set timeframe for /tag/____ pages #2439

Open jywarren opened 6 years ago

jywarren commented 6 years ago

We have these great pages to show activity on a topic:

https://publiclab.org/tag/data-logging

image

However, sometimes we want to be able to see this for a given time period, to understand community growth in that timeframe, kind of like on GitHub Pulse:

https://github.com/publiclab/plots2/pulse/monthly vs.

https://github.com/publiclab/plots2/pulse/weekly

That looks like this (so we may need to set an interface, but for now let's just focus on the pages)

screen shot 2018-03-07 at 10 17 08 am

We have these great stats pages where you can set a range: https://publiclab.org/stats/range/10-05-2015/10-05-2016/

The code for that (for example) is:

https://github.com/publiclab/plots2/blob/efc315d3d7bcc08d167c9f6db7816efd805e66f4/app/controllers/stats_controller.rb#L11-L32

Next steps

This could be solved in a few steps, and the first might be to create a new Tag controller action like:

rishabhptr commented 6 years ago

@jywarren Can I try this?

jywarren commented 6 years ago

Please do! This would be great and @ebarry would like it too.

On Wed, Mar 7, 2018 at 10:47 AM, Rishabh Singh notifications@github.com wrote:

@jywarren https://github.com/jywarren Can I try this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/2439#issuecomment-371181854, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJzxzDtNLRE8pZ86DIQWcXGdRSq1Wks5tcAEagaJpZM4Sgqyl .

ebarry commented 6 years ago

This will assist with metrics and evaluation, thank you!

jywarren commented 6 years ago

Hi @rishabhptr how is this coming? Thanks!

rishabhptr commented 6 years ago

Hey, I will make a pr with initial implementation for time ranges in a day or two for you to review. Thanks!

rishabhptr commented 6 years ago

Hey, as mentioned in the issue we need to create a new action for this instead of using optional parameters for dates in the original show action for tag. So what would be the response for the example request, the show page which resources filtered within the range or any new page with more descriptive information just like the stats page. Thanks :smile:

jywarren commented 6 years ago

I think we can re-use the show template but add a line that displays the date range specified. Make sense? Thank you! This is exciting!

jywarren commented 6 years ago

And I wonder if we can add an optional filter to the ActiveRecord queries in the same action, rather than making a new action? We could add it after this line, and the matching one from the wildcard section above it:

https://github.com/publiclab/plots2/blob/2f35d8734139a35b524af0c29305122b19bcbffb/app/controllers/tag_controller.rb#L96

We'd want to limit range based on, i guess, node creation date?

rishabhptr commented 6 years ago

Yes, that was exactly my thought, instead of new action we can use the same action with optional start and end parameters. Already the show method is quite detailed and good in finding different nodes for a tag and so it would avoid redundancy of the code and layout. So I think I can go ahead with changes in the controller and then we can add the interface from which user can select and view data for a specific date range. Thanks for the help clarifying the issue! :smile:

jywarren commented 6 years ago

super, that sounds great!

On Thu, Apr 12, 2018 at 10:08 AM, Rishabh Singh notifications@github.com wrote:

Yes, that was exactly my thought, instead of new action we can use the same action with optional start and end parameters. Already the show method is quite detailed and good in finding different nodes for a tag and so it would avoid redundancy of the code and layout. So I think I can go ahead with changes in the controller and then we can add the interface from which user can select and view data for a specific date range. Thanks for the help clarifying the issue! 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/2439#issuecomment-380839353, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJy-zgug_xCuSRQoU6caM9O7UISHAks5tn23_gaJpZM4Sgqyl .

jywarren commented 6 years ago

We should also plan ahead to make the graph reflect the period of time shown. Looking good!!

rishabhptr commented 6 years ago

Yes, it makes sense to update the chart also maybe we can have the graph update while choosing a range from the interface much like we are doing nodes through start and end values. :smile:

jywarren commented 6 years ago

I've updated this with a checklist of sub-parts that could be broken out and solved individually. Thanks!!!

ViditChitkara commented 6 years ago

This one seems interesting, @rishabhptr are you working on it?

jywarren commented 6 years ago

https://github.com/publiclab/plots2/pull/2618 added this nicely -- see:

But we need a few more things here --

@ViditChitkara what do you think?

ViditChitkara commented 6 years ago

@jywarren Great checklist!! Would be happy to implement this step by step!! Thanks!

jywarren commented 6 years ago

That'd be amazing, Vidit. Thanks!

jywarren commented 6 years ago

Adding a new FTO for the range buttons! https://github.com/publiclab/plots2/issues/3298

And the others here could make good FTOs as well 👍

jywarren commented 3 years ago

Right now we have this in menu items for "past month" and "past year" -- let's expand on this with more of a full date picker within the same menu!

image

Manasa2850 commented 3 years ago

@jywarren I'm not able to produce this page locally. How do I go about this?

jywarren commented 3 years ago

Hi @Manasa2850 do you mean you can't access for example: http://localhost:3000/tag/spectrometry?start=07-01-2018&end=08-01-2018 ?

jywarren commented 3 years ago

We may be able to look at #9256 for a quick and standard way to insert dates.