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

generating "downloads badges" for repos? #5

Closed
cboettig opened this issue Apr 23, 2015 · 33 comments
Closed

generating "downloads badges" for repos? #5

cboettig opened this issue Apr 23, 2015 · 33 comments

Comments

@cboettig
Copy link

Hi Gabor,

Would you consider having this app also generate svg badges for the number of downloads, in addition to the json summaries? Several of us were discussing this idea over at ropensci-archive/wishlist#14

Thanks for considering!

Carl

@gaborcsardi
Copy link
Contributor

Hi Carl, great idea! It is really a pity that we only have data about one server.

Sure, I can do that. Should we use shields.io? If I understand it correctly, we would download the SVGs, and then serve them from cranlogs, with the appropriate numbers included. Right?

So what kind of badges do we want?

  • x total
  • x/day
  • x/week
  • x/month
  • different colors?
  • flat?
  • plastic?
  • flat-squared?

We probably want to abbreviate large numbers: xK or xM.

How should we calculate x/day, x/week, etc. Only (say) for the last year?

@cboettig
Copy link
Author

@gaborcsardi good questions!

Yeah, that's the workflow I envisioned. (Though I'm not sure if it will be easiest to actually ping and download from shields.io each time vs just have the app write out an svg templated off of the one shields.io creates but with the download stat stuck in the right place)

For kind of badge, my intuition is just to go simple, e.g. total downloads. This is the kind of thing people will probably just glance at, and may compare across R packages, so it might get confusing if different users are reporting different intervals and people don't read the text carefully enough to see that one is x/week and one x/month or something. Wish I had a sense of what was most common to report.

Likewise not sure what aesthetics would be best. My intuition is to just pick something and hope you get feedback from the community one way or another.

I suppose in a fancy implementation of this, the badge could link to a little summary page with more information (e.g. day, week, month totals, go crazy and add a graph over time, and have some credits linking back here for where the stats come from).

@gaborcsardi
Copy link
Contributor

Yeah, that's the workflow I envisioned. (Though I'm not sure if it will be easiest to actually ping and download from shields.io each time vs just have the app write out an svg templated off of the one shields.io creates but with the download stat stuck in the right place)

I would just use the template. It is unlikely to change anytime soon.

For kind of badge, my intuition is just to go simple, e.g. total downloads. This is the kind of thing people will probably just glance at, and may compare across R packages, so it might get confusing if different users are reporting different intervals and people don't read the text carefully enough to see that one is x/week and one x/month or something. Wish I had a sense of what was most common to report.

I guess total downloads is fine. Of course you cannot compare an old and a new package that way, but never mind.

Likewise not sure what aesthetics would be best. My intuition is to just pick something and hope you get feedback from the community one way or another.

I liked the blue ones in the linked issue, so I'll go with those. What should the label be? "rstudio mirror downloads" looks a bit too verbose.

I suppose in a fancy implementation of this, the badge could link to a little summary page with more information (e.g. day, week, month totals, go crazy and add a graph over time, and have some credits linking back here for where the stats come from).

Yeah, that's for later. :)

@cboettig
Copy link
Author

Great, sounds like a plan! Awesome that you are doing this.

I'd just go with 'downloads' and for now just link the button back to this repo or somewhere that explains that these are total downloads but from only the R mirror, and file an issue if you have ideas/opinions about how to present this badge differently.

it's awesome that you're doing this!

@sckott
Copy link

sckott commented Apr 23, 2015

🚀

Nodes badges https://nodei.co/ - These are obviously more complicated than we need, but present some options to think about down the road

@karthik
Copy link

karthik commented Apr 23, 2015

For kind of badge, my intuition is just to go simple, e.g. total downloads.

I'd agree. I also think it's not a good idea to change colors. People will mentally start looking for the badge and it doesn't make sense to confuse them.

@karthik
Copy link

karthik commented Apr 23, 2015

Of course you cannot compare an old and a new package that way, but never mind.

@gaborcsardi I was thinking the same earlier today too as I was fixing our status page. I know the relative age of packages, but a naive user wont. This metric cannot be computed on the fly, but it would be good to run weekly on the whole index. Package x is in top % of downloads compared to packages of similar age. Something like that.

@gaborcsardi
Copy link
Contributor

OK, how about these?




http://cranlogs-dev.r-pkg.org/badges/git2r etc.

If it is OK, then I'll push it to the "production" server (drop the -dev).

@karthik
Copy link

karthik commented Apr 23, 2015

amazing!

gaborcsardi added a commit that referenced this issue Apr 23, 2015
@gaborcsardi
Copy link
Contributor

:)

@karthik Top x% of downloads sounds very good, but I would rather go with downloads/month for the last 12 months, so then it would be something like "Top 5% downloads this year".

OK, pushed to the production server. We can still change it of course. If it looks good, I'll add it to the README.

The difficulties are

  • the fonts, what if they are not available, then font sizes might be wrong
  • the size of the badge is fixed, so when we reach 100M downloads for something, I need to make the badge bigger. :)

@karthik
Copy link

karthik commented Apr 23, 2015

the size of the badge is fixed, so when we reach 100M downloads for something, I need to make the badge bigger. :)

Sounds like a good problem to have!

Top x% of downloads sounds very good, but I would rather go with downloads/month for the last 12 months, so then it would be something like "Top 5% downloads this year".

I like this approach especially since we don't have data going back too far (Nov 2012 if I recall correctly). This metric is more useful since I'd like to see what's been popular in the last 12 months than something more cumulative.

@gaborcsardi
Copy link
Contributor

I like this approach especially since we don't have data going back too far (Nov 2012 if I recall correctly). This metric is more useful since I'd like to see what's been popular in the last 12 months than something more cumulative.

OK, I can make another badge for this, in a different color (orange?), the only question is what to show if the package is not in the top 50%.

Otherwise I would have 50%, 25%, 10%, 5%, 2% 1% I guess.

@karthik
Copy link

karthik commented Apr 23, 2015

OK, I can make another badge for this, in a different color (orange?), the only question is what to show if the package is not in the top 50%.

What about returning a SVG version of a transparent image? So nothing shows up for those folks.

Unrelated question, GitHub tends to cache images that are referenced in READMEs (just click on the badges here for e.g.). I wonder if it does check to see if there is an update before caching again? Otherwise the download count would be stuck at first load.

@gaborcsardi
Copy link
Contributor

What about returning a SVG version of a transparent image? So nothing shows up for those folks

That works. I am just a little worried that we embarrass all package developers that get the transparent image.

Unrelated question, GitHub tends to cache images that are referenced in READMEs (just click on the badges here for e.g.). I wonder if it does check to see if there is an update before caching again? Otherwise the download count would be stuck at first load

Yes, it is caching it, and a reload does not hit my server. I can try to add an Expires header, to see if that helps.

@sckott
Copy link

sckott commented Apr 23, 2015

Expires header seems right. In the travis-ci header they have

< Expires: Thu, 23 Apr 2015 13:32:06 GMT

the request was made at the same time essentially

@gaborcsardi
Copy link
Contributor

@sckott @karthik OK, I added an Expires header, hope this helps.

Not sure how to invalidate the Github cache, though. :(

@gaborcsardi
Copy link
Contributor

Related smaller issues: #6 #7 #8

I think these cover everything we discussed here, so I'll close this one now. You are welcome to reopen it if I missed something, or just open another one, of course.

@cboettig
Copy link
Author

awesome work, very nice!

@karthik
Copy link

karthik commented Apr 23, 2015

Not sure how to invalidate the Github cache, though. :(

Yeah, this isn't happening yet.

@gaborcsardi
Copy link
Contributor

Yeah, this isn't happening yet.

Rstudio only provides the logs at the end of the day, so this is not real time. It will only be updated tomorrow, anyway.

Adding monthly, etc. stuff now. When it is done, then you can use a new URL, and that won't be cached. You'll see tomorrow, if it has changed, and if not, you can use the new URL.

@karthik
Copy link

karthik commented Apr 23, 2015

Rstudio only provides the logs at the end of the day, so this is not real time. It will only be updated tomorrow, anyway.

I mean't from yesterday to today. Badge shows 73. Current badge retrieved from your site shows 93 (for rdrop2 which is a < 7 days old). That's what I mean by GitHub not invalidating the cached file.

@gaborcsardi
Copy link
Contributor

You can try a URL with a dot after the hostname, this is the proper form, but nobody uses it. If the cache engine is not too smart, then it will consider it as a different URL:
http://cranlogs.r-pkg.org./badges/rdrop2

@gaborcsardi
Copy link
Contributor

OK, so how about switching to per month by default? Examples:

  • Default is per month: http://cranlogs.r-pkg.org/badges/pingr
  • You can do per week: http://cranlogs.r-pkg.org/badges/last-week/pingr
  • Per day: http://cranlogs.r-pkg.org/badges/last-day/pingr
  • Or the grand total: http://cranlogs.r-pkg.org/badges/grand-total/pingr

@karthik
Copy link

karthik commented Apr 24, 2015

Sounds fantastic! 💯

@cboettig
Copy link
Author

🏆

@sckott
Copy link

sckott commented Apr 24, 2015

@gaborcsardi
Copy link
Contributor

OK, I'll push this in a sec. Done.

@scott please drop the -dev from the URL, as this is for the dev server, and that is often broken. I'll update the URLs in the comment as well.

@sckott
Copy link

sckott commented Apr 24, 2015

@gaborcsardi okay, will do

@brendan-r
Copy link

Just a note on the caching thing - the header to set seems to be Cache-Control: no-cache.

@karthik
Copy link

karthik commented Apr 29, 2015

@brendan-r By design, so badges don't get stuck on a the first day of install's download count.

@gaborcsardi
Copy link
Contributor

@brendan-r Cool, thanks, I'll add it in a sec.

@gaborcsardi
Copy link
Contributor

@brendan-r OK, added.

I hope that Expires worked, too, because I don't want to invalidate all my cached badges by hand.

@brendan-r
Copy link

Working like a charm now, thanks for all your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants