Giter VIP home page Giter VIP logo

jumpingminds-django's Introduction

Elevator problem

APIs

  1. Initialize elevator system
  2. Request elevator for floor
  3. Get elevator by Id
  4. Get all elevators
  5. Close elevator door (open by default)

About this repo

  • Every PR sent to main branch and rest framework branch will run tests on pull requests.
  • I have set up pre-commit-hooks which would stop the commit if the tests fail.
  • Every PR is double verified via pre-commit-hooks and github workflows.
  • The pre-commit hooks also consist of text formatting via black

Interactions with the project

  • To install all the requirements run
pip install -r requirements.txt
  • To run tests use:
python manage.py test
  • To run the server use:
python manage.py runserver

Assumptions (Mentioned in requirements)

  1. Number of elevators in the system will be defined by the API to initialize the elevator system
  2. Elevator System has got only one button per floor.
  3. So if there are a total of 5 floors, there will be 5 buttons per floor.
  4. Note that, this doesn't not mimic real world, when you would have a total of 10 buttons for 5 floors ( one for up and one for down)
  5. Once the elevator reaches its called point, then based on what floor is requested, it moves either up or down.
  6. Assume the API calls which makes elevator go up/down or stop will reflect immediately. When the API to go up is called, you can assume that the elevator has already reached above floor.
  7. The system has to assign the most optimal elevator to the user according to their request.

I have assumed infinite number of floors, It can be limited if required

Available schema

Available routes:

Interpretations

  • Initialize the elevator system to create โ€˜nโ€™ elevators in the system

    • Create an api that takes in a number n and generates n lifts
  • Fetch all requests for a given elevator

    • create an api that accepts a number and returns all the requests sent to the specified lift
  • Fetch the next destination floor for a given elevator

    • based on the assumption number 6 this is handled by the move api
  • Fetch if the elevator is moving up or down currently

    • based on the assumption number 6 this is handled by the move api by changing move_up flag in the lift schema
  • Saves user request to the list of requests for a elevator

    • Save all the user interactions coming to all the api's
  • Mark a elevator as not working or in maintenance

    • Create an api that accepts a lift number and marks that lift in maintenance and thus this lift will become non functional.
  • Open/close the door

    • Create an api that accepts the lift number as parameter and toggles the door_open flag of the lift schema

jumpingminds-django's People

Contributors

ritik1903 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.