Key Information

Register
Submit
The challenge is finished.

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.

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.

Referral Leaderboard API

API Specificaition: http://docs.tcapi.apiary.io/#get-%2Fv2%2Fplatform%2Fleaderboard

This is an end point for generic leaderboard api,

In this challenge, you just need to implement "referral" leaderboard api. (i.e. support type=referral)

API Response

The API should return an array of leaderboard entries. Entries do not need to be sorted as tc-leaderboard will do this automatically. Each leaderboard entry should consist of the following:

  • handle
  • score (this is the numeric score, points or dollar amount)
  • their associated member image (e.g, http://community.topcoder.com/i/m/iRabbit.jpeg)
  • member since - thier signup date
  • country
  • member rating (red, orange, etc.)

The API should also provide some metadata for each specific leaderboard:

  • description - a brief overview of the the methodology used the return the results (e.g., "The leaderbaord returns all non-appirio members that have referred at least one new member in the last 6 month") - this should be generated automaticlly based on the input parameters
  • score_type - money or points
  • score_label - signifies what "type" of value is used for score_type. So for the referral leaderbaord this would be "referrals", for top money winners this quarter it would be "money" and for HP challenge winners it would be "points".
  • entries - the number of total entries returned by the API

Returns ALL results, no pagination.

Adding specifics for the queries needed to support to 2 reports above.

select
u.handle as handle,
u.member_since,
u.utm_source as referring_member_handle,
(
    select "http://community.topcoder.com" || p.path || i.file_name as image_path
    from 
    informixoltp:coder_image_xref cix, informixoltp:image i, informixoltp:path p
    where 
    cix.coder_id = referring_member.user_id
    and cix.display_flag = 1
    and cix.image_id = i.image_id
    and i.image_type_id = 1
    and i.path_id = p.path_id
) as referring_member_picture,
u.first_name,
u.last_name,
e.address
from user u
INNER JOIN user referring_member ON referring_member.handle = u.utm_source
INNER JOIN email e ON e.user_id=u.user_id and e.email_type_id=1
WHERE
u.utm_campaign="ReferralProgram"
and u.status = 'A'
and ("@utm_medium@" = "__ALL__" or u.utm_medium="@utm_medium@")
ORDER BY u.create_date desc;

Params:

- utm_medium
- utm_campaign
- utm_source

All "utm" parameters are strings, and can be empty.

The above query is the very basic one. We can/should add country, rating, etc. to the output.

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

Software Guidelines 
Submission Deliverables?, Environment Setup Instructions?, Final Submission Guidelines? 
 

Submission Deliverables

Below is an overview of the deliverables:

  • Source Code, be sure to include the commit hash, that your submission based on
  • Deployment guide to configure and verify the application.

Final Submission

For each member, the final submission should be uploaded to the Online Review Tool.

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30044251