Skip to content

riikkayoki/Wolt-FastAPI-delivery-fee-calculator

Repository files navigation

Wolt Summer 2023 Engineering Intern Assignment

About the project 💻

This is my solution for Wolt Summer 2023 Engineering Intern assignment. The purpose of this app is to determine the delivery price for customer.

  • This solution was built using Python.
  • Calculations for delivery fee run in O(1) time complexity.

Libraries 📚

  • Poetry for managing dependencies and packaging.
  • Invoke for automating tasks on command line.
  • FastAPI library to construct an HTTP API.
  • NumPy and datetime to calculate the delivery fees.
  • Mypy for checking typing.
  • Flake8 for code analyzing
  • Black for auto-formatting.
  • Unittest for testing.

Other things to note ✏️

  • Continuous integration is enabled by Github Actions.
  • Additional validations have been implemented:
    • The values for cart_value, delivery_distance, and amount_of_items must be positive numbers (greater than 0) and the input data must be in a proper format for all variables. → If the input data is of an incorrect type, an error message will be displayed.

Usage 🔧

Prerequisites
  • Python 3.9 or later
  • Poetry

Install dependencies & Run the app

Install the dependencies:

poetry install

Activate the poetry environment:

poetry shell

Run the server:

poetry run invoke start

The API documentation is available at http://127.0.0.1:8000/docs.

Testing 🔭

100% of the code has been tested. Below is a screenshot of the coverage report and commands to run and view the tests.

coverage_report

Test the app:

poetry run invoke test

Create coverage html:

poetry run invoke coverage

Get coverage report:

poetry run invoke coverage-report

View report on Firefox browser:

poetry run invoke coverage-view

Other useful commands 💙

Check typing:

poetry run invoke mypy

Generate a code analysis:

poetry run invoke flake

Auto-format the code

poetry run invoke black

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages