Overview

Cédric, on mange où à midi?

Presentation

If you don't know where to lunch, you can:

Just create a pull request if you want to add a restaurant. Available restaurants are specified in the file restaurants.json.

Usage

Deployment

This application can be deployed both on Heroku and Google App Engine.

Deploying the application on Heroku

See the documentation on Heroku, really easy.

In brief:

$ git clone https://bitbucket.org/cedricbonhomme/c-dric-on-mange-o-midi.git
$ cd c-dric-on-mange-o-midi
$ heroku create
$ heroku config:set JCDecauxAPIKEY=<your-api-key>
$ git push heroku master
$ heroku ps:scale web=1
$ heroku open

The JCDecaux API key is not mandatory.

Heroku demo instance.

Deploying the application on Google App Engine

You need the Google App Engine SDK for Python.

$ pip install -r requirements.txt -t lib
$ appcfg.py --env_variable=<your-api-key> --oauth2 -A <your-project-id> update .

You will also need to provide your "project id" in the file app.yaml.

App Engine demo instance.

Querying the application

Basic usage

$ GET http://127.0.0.1:5000/json/

Result:

{
    "comment": "Conseil: prendre le gateau chocolat.",
    "coordinates": {
        "lat": 49.63261,
        "long": 6.170671
    },
    "distance": 1478.4010831814312,
    "name": "EXKi",
    "shortest_path": [
        {
            "lat": 49.6279382,
            "long": 6.1614269
        },
        {
            "lat": 49.6279709,
            "long": 6.1614813
        },
        {
            "lat": 49.6281754,
            "long": 6.1618217
        }
        .
        .
        .
        {
            "lat": 49.6323226,
            "long": 6.1712102
        }
    ],
    "url": "http://www.exki.com/lu-lu/home"
}

HTML rendering

Simply remove the string json from the URL (http://127.0.0.1:5000/).

Speech synthesis

$ sudo apt-get install espeak
$ GET http://127.0.0.1:5000/json/key/name | espeak -v fr-fr --stdin
$ GET http://127.0.0.1:5000/json/key/comment | espeak -v fr-fr --stdin

User preferences

The possibility to send its preferences is offered to the user. This can be achieved by sending a JSON file which contains weights associated to the restaurants.

$ curl -X POST -d @preferences.json http://127.0.0.1:5000/json/ --header "Content-Type:application/json"

Result:

{
"coordinates": "",
"name": "La Perla",
"url": "http://www.coque.lu/en/page/la-perla"
}

Here is an example of preferences.json file:

  [
  {
    "name": "Vapiano",
    "weight": 2
  },
  {
    "name": "Quick",
    "weight": 1
  },
  {
    "name": "Chambre de commerce",
    "weight": 1
  },
  {
    "name": "EXKi",
    "weight": 3
  },
  {
    "name": "L'Antica-Roma",
    "weight": 1
  },
  {
    "name": "La Perla",
    "weight": 2
  },
  {
    "name": "Coyote",
    "weight": 2
  },
  {
    "name": "Aujourd'hui c'est Sushi",
    "weight": 0
  },
  {
    "name": "Mercedes",
    "weight": 1
  },
  {
    "name": "repas tire du sac alias 'gamelle'",
    "weight": 0
  },
  {
    "name": "Chillers",
    "weight": 4
  },
  {
    "name": "Asie Gourmande",
    "weight": 1
  },
  {
    "name": "Tie Break",
    "weight": 4
  }
]

A restaurant with a weight set to 0 won't be proposed to the user.

Get the list of all available restaurants

$ GET http://127.0.0.1:5000/list/json

To view all restaurants on a map point your browser to http://127.0.0.1:5000/list/.

Donation

If you wish and if you like Cédric, on mange où à midi?, you can donate via bitcoin 1GVmhR9fbBeEh7rP1qNq76jWArDdDQ3otZ. Thank you!

License

Cédric, on mange où à midi? is under GPLv3 license.

Contact

My home page.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.