Challenge Overview

Challenge Objectives

  • Develop/implement the back-end API as described in the provided architecture and Swagger specification
  • Extract and generate application's initial data
  • Create Postman tests of APIs in scope

Project Background

Welcome to "ASoD Economic Calculator App - Swagger REST API Implementation #2". Application Security on Demand (ASoD) is a service that we offer to our customer and currently, we use a manual excel document as an “Economic calculator” to calculate the economic benefit to our customer. In this series of challenges, we convert the excel application to web application.

This challenge aims to implement the back-end API project that will support the 
ASoD Economic Calculator App.

In part #2 we are implementing the calculation logic of the application and finishing back-end specification.

Technology Stack

  • NodeJS
  • MongoDB
  • MongooseJS
  • Express
  • Swagger
  • Heroku

Code base

Winning submission from back-end #1 challenge will be provided in the forum.

Individual Requirements(all major)

Follow the existing code and implementation style as used by the codebase.
Refer to the architecture model(provided in the forum) and ask questions forum to clear issues found.

1. Implement missing models from the ERD/Swagger
  • Answer
  • Report
2. Extract and generate initial data for the application
  • We will use the src/init-data.js script to populate database initially. Therefore update it to:
  • Keep the 3 users created (admin/user/client)
  • Create 2 questionMaster records. 1st named - "User input" and 2nd named - "Master data"
  • Open the provided excel and extract all questions asked to the user ("Input Form" B3:C13 and E column) as question records and associate them to 1st named - "User input"  master set.
  • There is docs/example-question.json file that is the begin of the extraction. Refer to it as a starting point and help to understand what is expected.
  • All user questions should be properly extracted with all fields populated. Keep track of question's "calRef" and answer's "calRef" as we will need them later for calculation the model
  • Extract all master data to questions and associate them to 2nd named - "Master data" . To do so follow the principle: Extract all simple values not formulas needed for calculation.
  • There is  docs/example-masterquestion.json file that is the begin of the extraction. Refer to it as a starting point and help to understand what is expected. See how the last column(F26:F27) is omitted as it is a reference. Such references/formulas we will need to calculate if the "CalculatedReferences" model used by the /model/calculate endpoint described below.
  • The general idea is to give admins high flexibility to edit/modify user questions and master data. Also, add new questions at some later point.
  • For the review please make sure all data is correct with proper calRefs.
3. Implement Swagger specification
  • Complete/implement the missing APIs from the swagger spec.
  • Reports - used to create/update/get reports. Reports have states. Report is complete when there are answers from the user/client to all questions in  1st named - "User input" questionMaster otherwise it is an incomplete state.
  • POST /model/calculate - is the heart of the applucation and will ge called each time user/admin changes input.
  • POST /model/calculate - based on provided "answers" and saved questions/master data it will need to calculate both "CalculatedResult" and "CalculatedReferences" schemas. Use the excel file to extract the calculation formulas and link to the question/master data by "calcRef" fields.
  • For example: to calculate CalculatedReferences.Data:F2 app needs to check if there is an answer in the payload to the user question with calcRef="Input Form:C3". If yes then take its value for "Risk Factor" if there is not answer then equal 0.
  • Please, ask in forum if any calculation needs to be discussed.
4. Update documentation
  • README.md - describing the following sections: Prerequisites, Installation/Deployment(also on Heroku), Configuration, Starting, Developing
  • Validation.md - describing how to validate your submission


Review phase

This project has a faster review(24h) phase. Please, plan accordingly.

Final Submission Guidelines

  • Updated NodeJS project source code
  • Project documentation(no video required)

ELIGIBLE EVENTS:

Topcoder Open 2019

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30075751