Git Product home page Git Product logo

queue_management_python's Introduction

alt text Queue Management System CLI

Lets create a Queue System: Queue system are heavily used in Goverment institutions, airports, banks and many other venues looking to organize the incoming traffic. Queue systems can also be used to load balancing for different applications like:

  • Establishing priorities in web servers incoming requests.
  • Immigration and visa applicantions that need to be prioritized.
  • Network packages.
  • etc.

A queue is just a list of elements that must be processed in a particular order: FIFO and FILO.

Today we are going to build a Queue system with FIFO approach for restaurants: If a new clients arrives to the restaurant their phone number is added into a queue, when it is his time to eat, he gets notified by email.

๐Ÿ“ Instructions

  1. Clone the following boilerplate
  2. Install dependency packages $ pipenv install
  3. Get inside the environment by typing $ pipenv shell
  4. You can run the current project by typing $ python src/app.py
  5. Start coding! Update the app.py file to allow the user to manage a simple Queue: Add a person, Remove person, get current line (queue).
  6. The application also needs to be able to export the queue to a file named queue.json.
  7. The application must integrate with the twilio API to send an SMS every time a phone number is dequeued.
  8. Use the following data-structure to implement the queue:
class Queue:

    def __init__(self, mode, current_queue=[]):
        self.queue = current_queue
        # depending on the _mode, the queue has to behave like a FIFO or LIFO
        if mode is None:
            raise "Please specify a queue mode FIFO or LIFO"
        else:
            self.mode = mode
    
    def enqueue(self, item):
        pass
    def dequeue(self):
        pass
    def get_queue(self):
        pass
    def size(self):
        return len(self.queue) 

Example worlflow

  1. The CLI show the menu, and the user selects the option to add "Bob" into the queue.
  2. The application ads Bob and notifies confirmation on the console and must say how many people are in front of him on the line.
  3. The system now shows the menu (starts again) awaiting for the user to pick another option.
  4. If the user picks the option to remove from the Queue, the next person on the queue gets eliminated and confirmation message shows.
  5. The user must receive an SMS when it is his/her time to eat.
  6. If the user picks to see the entire queue state, a list of everyone gets printed with their respective position in the queue.
  7. If the user picks to export entire queue, a JSON file with a list of everyone gets created.

๐Ÿ“– Fundamentals

This exercise will make you practice the following fundamentals:

  1. Executing python files from the command line.
  2. Get user input from the command line.
  3. Loops, conditionals and functions.
  4. Using plain-text files to store data.
  5. Complex Data Structures.
  6. Queue (FIFO vs FILO)
  7. SMS.

queue_management_python's People

Contributors

alesanchezr avatar gmihov001 avatar hernanjkd avatar nailakaliyeva avatar

Watchers

 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.