Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.
/ emeal-server Public archive

🌯 Scraping Dresden's canteens for juicy meal data

License

Notifications You must be signed in to change notification settings

kiliankoe/emeal-server

Repository files navigation

🌯 emeal-server

Travis Docker Build Status Docker Pulls

This is a minimal webapp to function as a proxy between anything requiring meal data (e.g. your app, chatbot, etc.) and the canteen menu of the Studentwerk Dresden. It's powered by Vapor and runs on Swift.

🍲✌️

Usage

/canteens

List out all known canteens. This information is however bundled with the app itself. Don't consider it dynamic. The canteens' IDs are based on their order in the linked config file.

[
  {
    "name": "Mensa Reichenbachstraße",
    "city": "Dresden",
    "coordinates": {
      "latitude": 51.0342255,
      "longitude": 13.7323254
    },
    "id": 1,
    "address": "Reichenbachstr. 1, 01069 Dresden"
  },
  {
    "name": "Zeltschlösschen",
    "city": "Dresden",
    "coordinates": {
      "latitude": 51.031458,
      "longitude": 13.7264826
    },
    "id": 2,
    "address": "Nürnberger Straße 55, 01187 Dresden"
  },
  ...
]

/meals

List all meals for the current day. The query parameters date and canteen can be used with example values 2018-01-08 or 4 (canteen id) respectively to query for specific dates or canteens.

Use a canteen's id as a URL parameter, e.g. /meals/4 to list all known meals for a given canteen. At maximum this can include the next three weeks worth of data.

The corresponding values for the information can be found here. Info on listed allergens and additives is provided by the Studentenwerk.

[
  {
    "canteen": "Alte Mensa",
    "detailURL": "https://www.studentenwerk-dresden.de/mensen/speiseplan/details-198200.html?pni=20",
    "information": [
      "pork",
      "garlic"
    ],
    "image": null,
    "isSoldOut": false,
    "date": "2018-01-08",
    "title": "Hausgemachte frische Pasta, heute Amori in Pastasoße all'amatriciana mit Tomaten und Bauchspeck, dazu italienischer Hartkäse Grana Padano",
    "studentPrice": 2.3,
    "employeePrice": 4.05,
    "additives": [
      "2",
      "3",
      "8"
    ],
    "allergens": [
      "A",
      "A1",
      "C",
      "G"
    ]
  },
  {
    "canteen": "Alte Mensa",
    "detailURL": "https://www.studentenwerk-dresden.de/mensen/speiseplan/details-198216.html?pni=18",
    "information": [
      "vegetarian"
    ],
    "image": null,
    "isSoldOut": false,
    "date": "2018-01-08",
    "title": "Paprikaschote mit Soja-Gemüsefüllung mit Tomatensoße, dazu Bohnen- Maisgemüse und Reis",
    "studentPrice": 2.4,
    "employeePrice": 4.15,
    "additives": [],
    "allergens": [
      "A",
      "A1",
      "I"
    ]
  },
  ...
]

/search

Search for a given keyword in all known meal titles. The keyword is supplied with the query parameter query, e.g. http://server_url/search?query=burrito. The response is a list of meals matching the query.

/update

Queue an update for the application's data for a given week and day. Using this shouldn't be necessary in most cases, since the application updates everything itself at regular intervals, but sometimes it very well might be. In that case send a POST request to /update with a week and day identifier as form url-encoded body params.

To prevent external misuse of this endpoint, the server requires the request to come from 0.0.0.0, e.g. localhost. An update script is provided for convenience. It is supplied with the week and day identifiers, e.g. ./update current monday and basically just curls the running server with the given commands.

Installation

The recommended way of installation is via docker, just run $ docker pull htwdd/emeal-server or build locally. Otherwise it can be built and deployed like any other Vapor application.

Packages

No packages published

Languages