GithubHelp home page GithubHelp logo

foodtruck's Introduction

Food truck project

Link to to the hosted application

Description of the problem and solution.

The objective is to provide a service that allows to get the food trucks that are close to a specific location in San Francisco.

Proposed solution

architecture.png

The proposed solution focuses on back-end and provides the following features:

  • Ability to get food trucks in a radius around a specific target point
  • Ability to search for food trucks with a specific cuisine (e.g asian food)

It is based on :

  • Python hug framework (REST API framework)
  • REDIS for the database
  • NGINX/GUNICORN to serve the users
  • Cron job to update the database daily

The choice of REDIS was motivated by the fact that the number of entry is small (less than 1000 food trucks, which fit in memory). Moreover REDIS provides an efficient GEORADIUS method which is particularly usefull here. The introduction of specific indexes (e.g status index, cuisines index) allows to speedup lookup of food trucks.

To develop the REST API I choose to use the hug framework as it seems to be a light and simple framework.

To update the local database I choose to use a simple cron job. It is run once a day: it downloads new registred food truck information and updated schedules. The source datasets are:

In order to associate cuisine types to each food truck we build a simple classifier that match fooditems with fooditems usually associated to a specific cuisine (see cuisine_classifier.py).

Tests

To validate that the service behaves correctly the following tests were defined:

  • Unit tests: using python unittest and a mock redis
  • Integration tests: using pyresttest
  • Stress tests: I choose to use locustio to validate that the API is able to handle simple scenario with numerous users (e.g 100 users with 1 requests per second)

The tests run on the proposed solutions tends to confirm that the technical choices were relevant: handling more than 500 requests per seconds on a desktop computers.

Installation

Docker containers are used to facilitate the deployment of the system (see docker-compose file):

  • clone the repository
  • docker-compose build
  • docker-compose up

What could be improved ?

foodtruck's People

Contributors

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