Challenge Overview
Project Overview
TopCoder and the TopCoder community have worked hard to get the platform to its currently level of maturity, but we're far from done. It's time to take the platform to the next level. TopCoder is going to start taking some steps to open up the platform API to the outside and community developers so they could incorporate it in their websites, applications or build their own applications (web, mobile or desktop).
The ultimate goal is to open up and build an "API" that is targeting all different type of audiences - Software and Studio Competitors, SRM/MM competitors, Copilots, Admins and TopCoder partners - each audience will have different interests and usages of the API, so it will be a huge project and we need to make sure that we are in the right direction from the beginning.
This contest is going to update the Rating Distribution API.
Competition Task Overview
Currently, we have provided installation guide for different environments, like CentOS 6.x, Ubuntu, Mac OS and Windows. please check https://github.com/cloudspokes/tc-api/wiki
The updated code must still deploy and work on heroku - any submission which can't be deployed on heroku successfully will be failed in screening phase - primary reviewer must check this.
The implementation will base on the node.js version of TC platform API - https://github.com/cloudspokes/tc-api. Please follow the existing actionhero pattern for your development.
Rating Distribution API
The rating distribution uses query
SELECT (rating / 100)::INT * 100 AS rating , COUNT(rating) AS number FROM algo_rating WHERE algo_rating_type_id = 1 AND num_ratings > 0 GROUP BY 1 ORDER BY 1 ASC
there are couple issues, checking against the current /tc
1) should only include active users.
2) need to include range with 0 number
checking current query, we need to use the same logic (hard code range), which needs code change.
query_dd_algorithm_rating_distribution.txt
SELECT sum(case when rating between 0000 and 0099 then 1 else 0 end) as group01 ,sum(case when rating between 0100 and 0199 then 1 else 0 end) as group02 ,sum(case when rating between 0200 and 0299 then 1 else 0 end) as group03 ,sum(case when rating between 0300 and 0399 then 1 else 0 end) as group04 ,sum(case when rating between 0400 and 0499 then 1 else 0 end) as group05 ,sum(case when rating between 0500 and 0599 then 1 else 0 end) as group06 ,sum(case when rating between 0600 and 0699 then 1 else 0 end) as group07 ,sum(case when rating between 0700 and 0799 then 1 else 0 end) as group08 ,sum(case when rating between 0800 and 0899 then 1 else 0 end) as group09 ,sum(case when rating between 0900 and 0999 then 1 else 0 end) as group10 ,sum(case when rating between 1000 and 1099 then 1 else 0 end) as group11 ,sum(case when rating between 1100 and 1199 then 1 else 0 end) as group12 ,sum(case when rating between 1200 and 1299 then 1 else 0 end) as group13 ,sum(case when rating between 1300 and 1399 then 1 else 0 end) as group14 ,sum(case when rating between 1400 and 1499 then 1 else 0 end) as group15 ,sum(case when rating between 1500 and 1599 then 1 else 0 end) as group16 ,sum(case when rating between 1600 and 1699 then 1 else 0 end) as group17 ,sum(case when rating between 1700 and 1799 then 1 else 0 end) as group18 ,sum(case when rating between 1800 and 1899 then 1 else 0 end) as group19 ,sum(case when rating between 1900 and 1999 then 1 else 0 end) as group20 ,sum(case when rating between 2000 and 2099 then 1 else 0 end) as group21 ,sum(case when rating between 2100 and 2199 then 1 else 0 end) as group22 ,sum(case when rating between 2200 and 2299 then 1 else 0 end) as group23 ,sum(case when rating between 2300 and 2399 then 1 else 0 end) as group24 ,sum(case when rating between 2400 and 2499 then 1 else 0 end) as group25 ,sum(case when rating between 2500 and 2599 then 1 else 0 end) as group26 ,sum(case when rating between 2600 and 2699 then 1 else 0 end) as group27 ,sum(case when rating between 2700 and 2799 then 1 else 0 end) as group28 ,sum(case when rating between 2800 and 2899 then 1 else 0 end) as group29 ,sum(case when rating between 2900 and 2999 then 1 else 0 end) as group30 ,sum(case when rating between 3000 and 3099 then 1 else 0 end) as group31 ,sum(case when rating between 3100 and 3199 then 1 else 0 end) as group32 ,sum(case when rating between 3200 and 3299 then 1 else 0 end) as group33 ,sum(case when rating between 3300 and 3399 then 1 else 0 end) as group34 ,sum(case when rating between 3400 and 3499 then 1 else 0 end) as group35 ,sum(case when rating between 3500 and 3599 then 1 else 0 end) as group36 ,sum(case when rating between 3600 and 3699 then 1 else 0 end) as group37 ,sum(case when rating between 3700 and 3799 then 1 else 0 end) as group38 ,sum(case when rating between 3800 and 3899 then 1 else 0 end) as group39 ,sum(case when rating between 3900 and 3999 then 1 else 0 end) as group40 FROM coder c ,rating r WHERE c.coder_id = r.coder_id AND status = 'A' and r.num_ratings > 0
Update API Doc
the apiary.apib should be updated to describe the updated API.
Standarize Query Naming Convension
we like to use the underscore approach in all SQL queries under the queries directory, please follow same approach.
Notes, for the JSON data returned, we will use camelCase approach.
Testing
The API Framework supports tests. Use supertest with mocha. Don't install mocha globally.
you must use mocha BDD style (which is the default), within that, you can optionally use chai.
Please check Test Creation Guide page in wiki
Code Format
All code must pass jslint. You may use "nomen: true".
Winner Only
Winner will create pull request against the main github repo in final fix phase and help merge with master. The changed files should be unix style, you can use dos2unix command to convert it before commiting.
Virutal Machines (VMs)
VM specific information is found here: http://www.topcoder.com/wiki/display/docs/VM+Image+2.5
Upon registration as a submitter or reviewer you will need to request a VM based on the TopCoder systems image. The VM will be active through aggregation review, after which it will be terminated except for the winner's and the reviewers'. To request your image, please post in contest forum.
Before requesting your VM, you need to ensure that you have an SSH key created and in your member profile. Instructions to do so are here: http://www.topcoder.com/wiki/display/projects/Generate+SSH+Key, and instructions to connect afterwards are here: http://www.topcoder.com/wiki/display/projects/Connect+Using+SSH+Key.
Please realize that VMs are currently issued manually. We make every attempt to issue the VM as soon as it is requested, however, there may be delays of up to 12 hours depending on time of day when you request. We encourage everyone to request a VM as soon as possible to minimize any such delays.
Final Submission Guidelines
N/A