Code Monkey home page Code Monkey logo

soil_backend's Introduction

Spaghetti API

This API is built on Flask and connects to a mongoDB storage attached to this app. The purpose is receiving HTML POST messages from Actility every time a LoRaWAN packet has been received. Spaghetti API stores all the relevant data and prepares them to be fetched with other apps connecting with REST API.

Run locally

  1. Install Python
  2. Install Setuptools and pip (see guide above)
  3. Install Virtualenv (acconplish this by running pip install virtualenv)
  4. Run virtualenv venv
  5. Run source venv/bin/activate on Mac OS X/Linux orvenv\Scripts\activate.bat on windows
  6. Run pip install -r requirements.txt
  7. Run python app.py
  8. Visit http://localhost:3000

Run in the cloud

  1. Install the cf CLI
  2. Run cf push my-python-app -m 128M --random-route
  3. Visit the given URL

##Description of the API
###Data input
The app route /sc_lpn handles the data input from Actility Thingpark with HTTP POST in the format given by Actility.

App route /gateway can handle the input of new gateways to be stored in the database, when used with HTTP POST.
Arguments:
id: gateway EUI as a string
lat: latitude of the gateway
lon: longitude of the gateway

App route /import can import from a backup point-by-point. All the point information has to be given as arguments. The function is not tested yet, for this purpose, a script needs to be written that transforms the .json backup into a series of POST requests.

##Data output

App route /gateway with HTTP GET returns all the gateways within a certain radius around the center point. Arguments:
lat: latitude of the center point
lon: longitude of the center point
radius: radius in km, output will contain all gtws within this radius.

App route /json returns a .json file for download, containing the current point database. Might take some CPU...

App route /query is filtering the database for certain criteria and only returns the points of interest.
Arguments:
delpoint+timestamp deletes a specific point
track: returns only a specific track number. Default: 20
start: String with start time. Default: 1 year ago
end: String with end time. Default: now
hdop: maximum GPS HDOP. Default: 500
sf: Spreading factor. Default: 7
txpow: Transmission power. Default: 0
device: Filter for transmissions of a specific device EUI only. Default: All devices

The additional app routes /freeboard/devices and /freeboard/dbmonitorwere created to push statistics to a Freeboard.

soil_backend's People

Contributors

crushedy avatar

Watchers

James Cloos 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.