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.
SRM Practice Problems API
This is a new API, the route will be like /:apiVersion/data/srm/practice/problems
Following are the general requirements for this API.
1. This api can be open to all members, but only logged in users can access the API;
2. Users can only see used problems, i.e. problems that have been used at least once in SRMs (status = used).
3. Following information need to be returned.
- Problem Id
- Problem Name
- Problem Type
- Points (The points value assigned to this problem in the last SRM in which it was used)
- Difficulty (Easy, Medium, Hard) - only Single Problem has this setting.
- Status (status of the problem as it pertains to the user)
-
New
-
The user has never opened this problem;
-
-
Viewed
-
User has opened but not solved the problem either during an SRM or using this problem practice feature;
-
-
Solved
-
User has opened and solved the problem passing system tests either during an SRM or using this problem practice feature
-
-
-
My Points
-
For problems the member has solved either during a SRM or using this problem practice feature, this represents the score attained by the member the first time the member solved the problem.
-
4. API needs to support filtering and searching by the fields mentioned above.
5. Standard paging conventions should be put in place.
Table References
The important part of this API is to build the queries, based on understanding, following tables will be used in this API (all under informixoltp database).
create table 'informix'.problem (
problem_id DECIMAL(10,0),
name VARCHAR(32) not null,
status_id DECIMAL(3,0),
problem_text TEXT,
modify_date DATETIME YEAR TO FRACTION default CURRENT YEAR TO FRACTION,
proposed_division_id DECIMAL(3,0),
problem_type_id DECIMAL(3,0),
proposed_difficulty_id DECIMAL(3,0),
create_date DATETIME YEAR TO FRACTION,
accept_submissions DECIMAL(1,0) default 1
)
create table 'informix'.problem_status_lu (
problem_status_id DECIMAL(3,0),
status_desc VARCHAR(100)
)
create table 'informix'.component (
component_id DECIMAL(10,0) not null,
problem_id DECIMAL(10,0) not null,
result_type_id DECIMAL(5,0) not null,
method_name VARCHAR(32) not null,
class_name VARCHAR(32) not null,
default_solution TEXT,
component_type_id DECIMAL(3,0),
component_text TEXT,
status_id DECIMAL(3,0),
modify_date DATETIME YEAR TO FRACTION
)
create table 'informix'.system_test_case (
test_case_id DECIMAL(10,0),
component_id DECIMAL(10,0) not null,
args BYTE,
expected_result BYTE,
modify_date DATETIME YEAR TO FRACTION default CURRENT YEAR TO FRACTION,
status DECIMAL(3,0),
example_flag DECIMAL(1,0),
system_flag DECIMAL(1,0) default 0 not null,
test_number DECIMAL(6,0) default 0
)
create table 'informix'.round_component (
round_id DECIMAL(10,0),
component_id DECIMAL(10,0),
submit_order DECIMAL(3,0) default 0,
division_id DECIMAL(3,0),
difficulty_id DECIMAL(2,0),
points DECIMAL(7,2),
open_order DECIMAL(3,0)
)
create table 'informix'.component_solution_xref (
component_id DECIMAL(10,0) not null,
solution_id DECIMAL(10,0) not null,
primary_solution DECIMAL(1,0)
)
Test Data
if you check 05_informixoltp_test_data.sql, in the last section, you see some sqls for setup SRM Problem and MM Problem, you can use that as your base to setup test data, and also you can playing with arena applet, so you can have more data and better understand the data relationship in database.
Update API Doc
the apiary.apib should be updated to describe the new 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)
To use the Arena VM, please follow http://apps.topcoder.com/wiki/display/docs/Competition+Engine+VM+Setup
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
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.