Skip to main content

OrderSystem to take customer orders

Project description

Order System

This project is an OrderSystem that takes an an order and returns the correct order.

Installation with PyPI

pip install ordersystem

Extras

Clone and follow the ReadMe in this repository to see the Flask and Docker version of this application.

Usage

Ensure these environment variables are set:

MENU, COMPLIMENTARY, SINGLE_ITEM, MEAL_CATEGORY_MAPPING COURSE_CATEGORY_MAPPING, MANDATORY_COURSE

Example as below:

MENU="{\"breakfast\":{\"1\":\"Eggs\",\"2\":\"Toast\",\"3\":\"Coffee\"},\"lunch\":{\"1\":\"Sandwich\",\"2\":\"Chips\",\"3\":\"Soda\"},\"dinner\":{\"1\":\"Steak\",\"2\":\"Potatoes\",\"3\":\"Wine\",\"4\":\"Cake\"}}"

COMPLIMENTARY="{\"breakfast\":{\"main\":\"\",\"side\":\"\",\"drink\":\"\"},\"lunch\":{\"main\":\"\",\"side\":\"\",\"drink\":\"\"},\"dinner\":{\"main\":\"\",\"side\":\"\",\"drink\":\"Water\",\"dessert\":\"\"}}"

SINGLE_ITEM="{\"breakfast\":[\"1\",\"2\"],\"lunch\":[\"1\",\"3\"],\"dinner\":[\"1\",\"2\",\"3\"]}"

COURSE_CATEGORY_MAPPING="{\"main\":\"1\",\"side\":\"2\",\"drink\":\"3\",\"dessert\":\"4\"}"

MANDATORY_COURSE="{\"breakfast\":[\"main\",\"side\"],\"lunch\":[\"main\",\"side\"],\"dinner\":[\"main\",\"side\",\"dessert\"]}"

MENU references the actual menu of your ordering system. It maps the COURSE_CATEGORY_MAPPING to the actual food. COMPLIMENTARY is food items that is always included in the order such as this restaurant always want water to be included in dinner orders. SINGLE_ITEM are list of courses that could be ordered only once. In this restaurant, a Breakfast order cannot have more than 1 order of Eggs or Toast COURSE_CATEGORY_MAPPING maps the courses to the number category used by the other environment variables. Orders will be returned in the same placement as it is set in the course category. In this restaurant, the order will be returned with the main as first, the side as second and the drink as third MANDATORY_COURSE is a dictionary where the keys is the meal you want and the value is a list of the course that must be ordered with the meal. In this restaraunt, every meal must have a main and side course ordered.

To add the to the menu, first create a mapping in the COURSE_CATEGORY_MAPPING for the specific course. The set the number mapping to a food item in the Menu dictionary. Feel free to add to COMPLIMENTARY and SINGLE_ITEM if you need to make adjustments. For example, this restaurant now wants to add Crab Cakes as an appetizer to its list of options for dessert. The following environment variables will be set:

MENU="{\"breakfast\":{\"1\":\"Eggs\",\"2\":\"Toast\",\"3\":\"Coffee\"},\"lunch\":{\"1\":\"Sandwich\",\"2\":\"Chips\",\"3\":\"Soda\"},\"dinner\":{\"1\":\"Steak\",\"2\":\"Potatoes\",\"3\":\"Wine\",\"4\":\"Cake\", \"5\":\"CrabCakes\"}}"

COMPLIMENTARY="{\"breakfast\":{\"main\":\"\",\"side\":\"\",\"drink\":\"\"},\"lunch\":{\"main\":\"\",\"side\":\"\",\"drink\":\"\"},\"dinner\":{\"main\":\"\",\"side\":\"\",\"drink\":\"Water\",\"dessert\":\"\"}}"

SINGLE_ITEM="{\"breakfast\":[\"1\",\"2\"],\"lunch\":[\"1\",\"3\"],\"dinner\":[\"1\",\"2\",\"3\"]}"

COURSE_CATEGORY_MAPPING="{\"main\":\"1\",\"side\":\"2\",\"drink\":\"3\",\"dessert\":\"4\", \"appetizers\":\"5\"}"

MANDATORY_COURSE="{\"breakfast\":[\"main\",\"side\"],\"lunch\":[\"main\",\"side\"],\"dinner\":[\"main\",\"side\",\"dessert\"]}"

In your code, you can do the following.

from ordersystem.order_system import OrderSystem

ordersystem = OrderSystem()
ordersystem.get_order("Breakfast", "1,2,3")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ordersystem-1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ordersystem-1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ordersystem-1.1.tar.gz.

File metadata

  • Download URL: ordersystem-1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for ordersystem-1.1.tar.gz
Algorithm Hash digest
SHA256 caf3f1fa39266c77602ac08a4b172cc8543644e53fcd7d3cc5d9f87919d286f3
MD5 6497fd74bd0b67fbee5247af28359fdf
BLAKE2b-256 93c42f97f670928033779723e82ecd829ebab88d7ea7e361d9f7499685ce35f9

See more details on using hashes here.

File details

Details for the file ordersystem-1.1-py3-none-any.whl.

File metadata

  • Download URL: ordersystem-1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for ordersystem-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f05c3e36d9d3d72f434bd7c2859cba44a6e86d62ce3316fcc1183034559ff570
MD5 bdf42cfd2196b3c0fa643d6314a735ab
BLAKE2b-256 53dbc8d8bd43aa087b0267503f94048a6d832d67f09aa8c507cb6c142b44861a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page