Giter Club home page Giter Club logo

bloodtests's Introduction

LiveSmart Backend Test

Details of the technical test for potential Backend engineers.

Objective

We have provided a partially complete django instance, missing some key elements such as models and views.

We would like you to add the necessary components to implement a REST API to get and set details of a blood test.

These details should include a name, unique code, unit of measurement, lower range and upper range of expected results.

On the API response, there should also be a read only field called "ideal_range" that uses the values of upper and lower to build a human readable string.

We have included a testing file in bloodtests/tests/test_bloodtests.py, this will test for some of the functionality outlined in this document and we'd like to see the tests pass once you have completed the implementation. In addition the testing file should provide some information about expected status codes/formats/model names etc, that you can use in addition to the spec below.

Installation

  1. Please use Python 3.6 so make sure that is installed, we have provided a requirements.txt file to use with pip install to install all the necessary python packages for this task, please don't change the versions of any packages used.
  2. Create a virtual environment, and activate it.
  3. Install the necessary packages with:
pip install -r requirements.txt
  1. Make your changes.

  2. Django can then be run with:

python manage.py runserver

This will make available the API by default on 127.0.0.1:8000

  1. Django can then be tested with:
pytest bloodtests/tests/test_bloodtests.py

Note that steps 6 and 7 will only work after you have made changes. If you run them before making changes you'll likely see errors or failed tests.

Field requirements

code - varchar up to 4 characters in length name - varchar up to 100 characters in length unit - varchar up to 10 characters in length lower - positive float upper - positive float lower or upper can be null but not both. If both are non null then require upper > lower.

Spec of the API

  1. The API has GET and POST methods.
  2. It is to be requested with a code parameter on the url e.g. api/bloodtests/test/CHO where CHO is the code.
  3. The API supports JSON.
  4. The JSON output looks as follows:
{
  "ideal_range": "21.0 <= value <= 45.0",
  "code": "CHO",
  "name": "Cholesterol",
  "unit": "mmol/L",
  "lower": 21,
  "upper": 45
}

Approach

We would like you to ...

  1. Implement the neccessary missing components to create this API.
  2. Ensure that the testing file in bloodtests/tests/test_bloodtests.py, when run, passes all tests. Note that if you run the test file before implementing your changes it will either fail the tests or raise errors, but once you've implemented your changes the tests should alll pass.
  3. Please create a repo on a hosting service like github, bitbucket and commit and push the whole project there. Including the files we provide and the ones you create/update. Please do this as you'd normally work, committing as often as you normally would etc.
  4. Share this link with us so we can see what you've done and pull it down and run it.

bloodtests's People

Contributors

mikazz avatar

Watchers

 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.