Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for CSV's from term_data and community_tags #5268

Closed
skilfullycurled opened this issue Mar 26, 2019 · 9 comments
Closed

Request for CSV's from term_data and community_tags #5268

skilfullycurled opened this issue Mar 26, 2019 · 9 comments
Labels
break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration enhancement explains that the issue is to improve upon one of our existing features fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute
Milestone

Comments

@skilfullycurled
Copy link
Contributor

This might be able to be merged with tag visualization of all tags or planning for expanded community stats system.

I'm looking to update the tag graph I created a while back. While we do have an API now for the top 250 tags, for reasons I'll not get into (unless you'd like me to) recreating the graph will require the data as I originally had it which was a csv of the term_data and community_tags tables.

Would it be possible to provide me with a csv of those tables? Maybe in the future it can also be a part of the new stats downloads. The nice thing about the full tables is that you can merge them with the node table to find the tags for the different types of content.

Thanks for your help!

@grvsachdeva grvsachdeva added enhancement explains that the issue is to improve upon one of our existing features help wanted requires help by anyone willing to contribute labels Mar 27, 2019
@skilfullycurled
Copy link
Contributor Author

Hey all,

Just checking in. Would it be possible to have the csv's without it being implemented in the stats download page? I didn't mean to imply that it'd be an enhancement although I think it will be a good one in the end.

I promise to make something cool out of it that you won't soon forget. And by "soon" I mean definitely not for at least the next ten minutes after you look at it.

I'll take a look at the code for the stats. I don't program in Ruby but maybe I can make out the pattern.

Benjamin

@jywarren
Copy link
Member

jywarren commented Apr 8, 2019

Oh sorry @skilfullycurled i didn't see this. A few thoughts that may help move it along:

  1. We should link to the outputs of the new stats downloads from https://publiclab.org/api
  2. I wonder if this is as simple as making a new route/action in this controller:

def comments
data = Comment.where(status: 1, timestamp: start.to_i...fin.to_i).all
format(data, 'comment')
end

But for the tables you're looking for: term_data and community_tags --

  def tag
    data = Tag.select(:tid, :name, :parent, :count).all
    format(data, 'tag')
  end

  def node_tag
    data = NodeTag.select(:tid, :nid, :uid).where(date: start.to_i...fin.to_i).all
    format(data, 'node_tag')
  end

Then, adding routes to match; something like these for comments:

plots2/config/routes.rb

Lines 252 to 253 in 4c6ecb2

get 'stats/comments' => 'stats#comments'
get 'stats/comments/:start/:end' => 'stats#comments'

And a link on this page to display it:

<li>
<%= link_to "Notes", stats_notes_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>
<li>
<%= link_to "Wikis", stats_wikis_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>
<li>
<%= link_to "Comments", stats_comments_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>
<li>
<li>
<%= link_to "Users", stats_users_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>
<li>
<%= link_to "Questions Asked", stats_questions_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>
<li>
<%= link_to "Questions Answered", stats_answers_path(format: 'csv', start: params[:start], end: params[:end]) %>
</li>

(although the Tag model has not timestamps, so we'd just note there that it's ALL tags)

Benjamin, this would be a pretty easy first-timers-only issue to add, i think; does this look good to you? If so, we can build an FTO from it. Thanks!

@jywarren jywarren added break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet labels Apr 8, 2019
@skilfullycurled
Copy link
Contributor Author

Yes! May I try to be the first timer...?

@jywarren
Copy link
Member

jywarren commented Apr 8, 2019

And if so, you could chime in on the Weekly Check-In to see if anyone's interested in picking this up!

publiclab/leaflet-environmental-layers#164

Oh, certainly! So, ill make it now.

@skilfullycurled
Copy link
Contributor Author

Was the leaflet part an accident?

@jywarren
Copy link
Member

jywarren commented Apr 8, 2019

no, actually, we have a rotating community check-in that moves from project to project, to build cross-repo cohesion! 😄

@skilfullycurled
Copy link
Contributor Author

Ohhhhhhh...that's the link to the check in. Sorry, wasn't immediately clear from the URL. Okay. Gotcha. Working on adding some info to a different issue from some things I've learned data wise, so I'll check in on the check in soon.

@skilfullycurled
Copy link
Contributor Author

I mean, right after.

@jywarren
Copy link
Member

jywarren commented Apr 8, 2019

If you want to claim this yourself, you can go ahead -- i've reserved it for you: #5412

I opened another PR with the follow-up changes, but that's a nice one to try out as a first-timers-only issue. We can close this then to move over there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
break-me-up break up for cleaner code separation, discrete tests, and, easier and iterative collaboration enhancement explains that the issue is to improve upon one of our existing features fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet help wanted requires help by anyone willing to contribute
Projects
None yet
Development

No branches or pull requests

4 participants