Coder Social home page Coder Social logo

kiliankoe / emeal-server Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 224 KB

🌯 Scraping Dresden's canteens for juicy meal data

License: MIT License

Swift 99.78% Makefile 0.16% Shell 0.06%
dresden studentenwerk-dresden mensa canteen emeal tu-dresden htw-dresden

emeal-server's Introduction

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

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.