Challenge Overview
Challenge Objectives
-
Build a processor that will listen to kafka events and will modify aggregated statistics on a challenge in ElasticSearch.
Tech Stack
-
Node.js
-
Express.js
-
Swagger
-
DynamoDB
-
ElasticSearch
Project Background
In this series of challenges, we will build the version 5 (V5) of the challenge API.
Code Access
This is a new project.
Here is a similar processor as an example https://github.com/topcoder-platform/submission-processor-es
The code for our challenge API is hosted here:
Repo: https://github.com/topcoder-platform/challenge-api
Branch: develop
The code for our resources API (this is the API the processor will call) is hosted here:
Repo: https://github.com/topcoder-platform/resources-api
Branch: develop
Detailed requirements
1. Handle challenge resources
The processor must listen to the following topics:
-
challenge.action.resource.create
-
challenge.action.resource.delete
-
challenge.action.resource.update
When the processor receives an event from one of the above topics, it needs to:
-
Get the challengeId from the event payload.
-
Call the Resources API (v5) using an m2m token to get the resources for that challenge ID.
-
Update the numberOfRegistrants property and save the challenge in ElasticSearch.
2. Handle challenge submissions
The processor must listen to the following topics:
-
submission.notification.create
-
submission.notification.update
-
submission.notification.delete
When the processor receives an event from one of the above topics, it needs to:
-
Get the challengeId from the event payload.
-
Call the Submission API (V5) using an m2m token to fetch all submissions for that challenge ID.
-
Update the submissions, checkpoints, numberOfSubmissions and numberOfSubmitters properties and save the challenge in ElasticSearch. The submissions, as well as the checkpoints properties, will be arrays of objects, the difference will be based on the type property of each submission and each object will have the following format:
{
submitter: “thomaskranitsas”,
submitterId: 12345678,
submissions: [
{
submissionId: “use the id from the V5 submission API”,
submissionTime: “use the created field from the V5 submission API”
}
]
}
The numberOfSubmissions and numberOfSubmitters properties are self-explanatory.
You will probably need to call the Resources API as well to retrieve the challenge resources so you can populate the submitter properties as the V5 Submission API only includes the member’s ID and not the username/handle.
All topics must be configured and not hardcoded.
To generate a machine to machine (m2m) token, use the appirio-tech/tc-core-library-js.git#v2.6.2 module.
3. Unit testing
You need to cover this new processor with strong unit/e2e testing. Include both negative and positive tests.
Should you have any questions, feel free to ask on the challenge forum!
References
What to Submit
Submit your source code in a zip file including a README.md file with detailed instructions on how to set up, start and test the processor.