Coder Social home page Coder Social logo

nirvana-challenge's Introduction

Nirvana Take Home Project

Repository for Nirvana challenge

๐Ÿ“„ Introduction

The purpose of this project is to solve the take-home challenge for Nirvana in order to be part of its engineering team and be awesome together.

๐Ÿž Instructions

Suppose you have 3 different APIs you can call with member_id as a parameter.

So example API calls would be:

https://api1.com?member_id=1

https://api2.com?member_id=1

https://api3.com?member_id=1

and you'll get responses from these apis with similar responses:

API1: {deductible: 1000, stop_loss: 10000, oop_max: 5000}

API2: {deductible: 1200, stop_loss: 13000, oop_max: 6000}

API3: {deductible: 1000, stop_loss: 10000, oop_max: 6000}

As you can see above the API's don't always agree. The task is to build an API that calls these APIs and coalesces the responses with a strategy.

An example strategy could be the average of the response fields. With the average strategy, your coalesce API would respond with:

{deductible: 1066, stop_loss: 11000, oop_max: 5666}

Your API should:

Take in the member_id as a parameter Make the calls to the different APIs Coalesce the data returned by the APIs As a bonus challenge: allow for the coalescing strategy to be configurable

โš™๏ธ Setup and Run

To run these project is necessary following the next steps.

Local environment

Requirements

  • python 3.8+
  • pipenv
  • make

Active the pipenv environment

$ pipenv shell

Clone the project

$ git clone https://github.com/ChrisVidal10/nirvana-challenge.git

Install dependencies

  • To install all the requirements pleas run the next command with make.
$ make install_deps

Local execution

  • Run Flask to start the server
$ flask run

Testing the code

  • Run pytest to run all the tests
$  python -m pytest -v

Strategies

  • Mean: Arithmetic mean ("average")
  • Mode: Most common value
  • Median: Middle value
  • Max: Maximum value
  • Min: Minimum value

Endpoints

  • GET /coalesce-api?member_id={REQUIRED}&coalescing_strategy={OPTIONAL}

The default strategy is arithmetic mean ("average").

Users

  • In order to have users for testing, I've created the next ones.
    • member_id: 1
    • member_id: 2
    • member_id: 3
    • member_id: 4

Example

  • GET /coalesce-api?member_id=1&coalescing_strategy=max
{
  "deductible": 1200,
  "oop_max": 6000,
  "stop_loss": 13000
}
  • If the member_id is invalid the API returns a 404 Error and the following text. /coalesce-api?member_id=t3st
{
  "error": "Member Id #t3st Not found"
}

nirvana-challenge's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.