Scraping CW Top 500: Calculate Statistics
Description:

- The link to the codewars top 500 is a global variable
URL
- The number of 'active users' is in the solution setup if you wish to use it. ```if:ruby
*A quick guide to using Nokogiri can be found here. You can skip the part about installing Nokogiri/open-uri and you don't need to require
anything else.
```if:python
*Documentation for BeautifulSoup can be found <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">here</a>
In addition to getting their honor, rank and name, for the top ten users you will also be determining:
- Their honor/solved kata ratio
- Their kata creation-to-consumption ratio
- Their honor percentile (based on a fixed, somewhat arbitrary estimation of total active users)
Additionally, your Scraper class should also have methods which:
- Sort all users by name
- Sort the top ten by honor/solved ratio (descending)
- Sort the top ten by kata creation/completed ratio (descending)
Specifications
The above sorting methods should return lists of names sorted by specific properties; so the first 5 users sorted by total honor would be ["g964", "myjinxin2015", "Voile", "SteffanVogel", "smile67"], rather than a list of numbers."Honor/solved kata ratio" refers to the ratio between a user's honor score, and the number of kata they've completed.
"Kata creation-to-consumption" ratio should be expressed as a percent. Basically it answers the question "For every hundred kata a user solves, how many do they create?" As a result of how this question is phrased, this should exclude kata they have created from their 'total solved'.
The estimation of active users is pretty arbitrarily derived from looking at the total number of "Multiply" solves, and dividing by 20.* This should be expressed as a percent, rounded to two decimal places. This number, 40113, is supplied for you as @active_users
(active_users
in Python).
Example of how the scraper will be used:
```ruby Scraper.scrape #test will call your scrape function, which should populate its list.Scraper.list[0].name => 'g964' Scraper.list[2].level => '2 dan' Scraper.sort_by_creation_ratio[0] => 'myjinxin2015'
```python
Scraper.scrape() #test will call your scrape function, which should populate its list.
Scraper.list()[0].name => 'g964'
Scraper.list()[2].level => '2 dan'
Scraper.sort_by_creation_ratio()[0] => 'myjinxin2015'
Note that because multiple threads (using the Thread class in Ruby) don't appear to be supported on CodeWars (someone correct me if I'm wrong), this scraper's performance suffers considerably due to having to scrape multiple user pages. On some occasions it may time out. Just try again.
Translations (especially async JavaScript) are very welcome.
*If anyone's got a better source for active users, let me know (I thought I remembered seeing some stats on this site somewhere but couldn't find them again).
Similar Kata:
Stats:
Created | Jun 7, 2018 |
Warriors Trained | 38 |
Total Skips | 1 |
Total Code Submissions | 93 |
Total Times Completed | 5 |
Ruby Completions | 4 |
Python Completions | 2 |
Total Stars | 0 |
% of votes with a positive feedback rating | 63% of 4 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |