Challenge Overview

Challenge Objectives

  • Rewrite the backend api for an existing web app to support more features to be built in the coming months.

 

Project Background

  • The Scout web app, now available at scout.energy.gov, was developed over the past two years through a collaboration between BTO, the national labs, and Topcoder. The app improves the user-friendliness of several key Scout features; for example, it allows one to easily estimate the portion of U.S. building energy use and CO2 emissions that a candidate technology might affect; to rapidly create new Scout energy conservation measure (ECM) definitions and send them to BTO for review; and to interactively visualize energy use, cost, and CO2 emissions results for ECM portfolio simulation runs.

  • The app’s capabilities improve the accessibility of Scout data and results and might expand the base of users that wish to contribute new Scout ECM definitions or run custom Scout analyses. Looking ahead, further enhancements to the app will continue to improve the tool’s potential for broader impacts across the building simulation community.

  • In this round of Scout web app development, we have the following major objectives:

    • enable end-to-end Scout analyses within the web app,

    • add user accounts to support saving custom ECMs and analysis results,

    • update existing app components to reflect new Scout features, and

    • apply final fixes and performance improvements to existing features and app architecture.

 

Challenge Background

  • We built the current version of the Scout web app with a simple node.js based backend using sqlite as the datastore. It allows public access and doesn’t support user accounts, which is limiting what users can do with the web app.

  • In this challenge, we are re-writing the backend to provide full support of user accounts, different user roles and better control of user access to the api. You may still be able to reuse some of the code from the current implementation (provided in the forum), but it makes more sense to just start clean and create a new API based on the swagger documentation we provided in the forum.

  • We plan to run the API in docker, please keep that in mind and make all configurable parameters such as database connection strings easy to configure through environment variables.

 

Technology Stack

  • Node.js

  • Postgres

  • REST

  • SMTP

  • JSON

  • Docker

 

Detailed Requirements

We have provided a swagger documentation file in the challenge forum, all the endpoints defined in the swagger are in scope of this challenge, except for the following:

  • Work queue: please add a TODO comment in your code to the implementation of all the endpoints that involves a work queue

  • Scheduler job: scheduler job is out of scope and will be handled in the next challenge.

  • Google Captcha: we are not doing this for now, so make sure you don’t put any effort into this while implementing the API

  • Any implementation that will involve calling the external Python module is out of scope for now, please just add a //TODO note in the implementation.

  • For GET /ecm-market-affected-range, please return mock data for now, we’ll implement it in the next challenge.

 

To summarize, here’s the list of the endpoints, please cross check with swagger and make sure you cover all the endpoints unless otherwise specified:

  • Security

    • POST /login

    • POST /logout

    • GET /verify-email

    • POST /initiate-forgot-password

    • POST /change-forgot-password

    • POST /change-password

    • GET /auth/{socialType}

    • GET /auth/{socialType}/callback

  • User

    • GET /me

    • POST /users

    • GET /users

    • PUT /users

    • GET /users/{id}/statistics

    • PUT /users/{id}

    • DELETE /users/{id}

  • ECM

    • POST /ecms

    • GET /ecms

    • PUT /ecms

    • POST /ecms/download

    • PUT /ecms/archive

    • PUT /ecms/unarchive

    • GET /ecms/{id}

    • PUT /ecms/{id}

    • PUT /ecms/{id}/control

  • Lookup

    • GET /climate-zones

    • GET /building-types

    • GET /structure-types

    • GET /fuel-types

    • GET /end-users

    • GET /measure-types

    • GET /technologies

    • GET /ecm-market-affected-range: please return fake data for now

  • Task

    • GET /tasks

  • File

    • POST /files

  • Notification

    • GET /notifications

    • PUT /notifications/{id}/read

  • Analysis

    • GET /analyses

    • POST /analyses

    • GET /analyses/{id}

    • PUT /analyses/{id}

    • DELETE /analyses/{id}

    • GET /analyses/{id}/views: please return fake data for now

    • GET /analyses/{id}/download

    • PUT /analyses/{id}/control

  • Calculator

    • POST /calculator: please return some fake data for now



Final Submission Guidelines

  • Full code that covers all the requirements.
  • Please include a sql script for your database schema.
  • Postman collection file to properly test the API (covering positive and negative cases).
  • A detailed README file including information on how to configure, run and verify your application.

ELIGIBLE EVENTS:

2020 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30124568