Code Monkey home page Code Monkey logo

linka's Introduction

LINKA CI

LINKA is an open source service to record air quality data from community sensors.

Install

$ sudo dnf install python3-virtualenv python-devel libpq-devel
$ virtualenv env
$ source ./env/bin/activate
$ pip install -r requirements.txt

Setup

$ export LINKA_MASTER_KEY="YOUR_MADE_UP_AND_SECURE_API_KEY"
$ export DATABASE_URL=postgresql://USER:PASSWORD@localhost:5432/linka
$ alembic upgrade head

Run

$ source ./env/bin/activate
$ gunicorn --bind 0.0.0.0:5000 --graceful-timeout 300 --timeout 300 --worker-class=uvicorn.workers.UvicornWorker --worker-connections=10 --workers=3 wsgi-service:app

Docs

Run the service and check http://localhost:5000/docs Use the same LINKA_MASTER_KEY value for X-API-Key value of Authorize section

You can also check if everything is working fine with curl

curl --request GET \
  --url http://localhost:5000/api/v1/providers \
  --header 'X-API-Key: YOUR_MADE_UP_AND_SECURE_API_KEY'

At first should return a http status 200 with an empty array []

Disclaimer

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

linka's People

Contributors

alefq avatar dariopy avatar garyservin avatar jreypy avatar juaning avatar martinezjavier avatar melizeche avatar pablo avatar scanterog avatar snyk-bot avatar sofiab97 avatar tchx84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linka's Issues

RFC Introduce the Station concept

We should implement the concept of Station in which we define a Station and relate to it Name, Location and credentials, so we can send readings from several sensors even using different devices, or just from one, depending on how we can implement each sensor.

We can also reduce the amount of data sent, as we wouldn't need to send the name and the location for each reading.

Also, we can send readings at different time windows.

stats endpoint

An endpoint with classic stats:

  • N-days averages.
  • N-days maximum.
  • N-days minimum.
  • etc.

Support for pressure, humidity and temperature readings

The backend should be able to receive and store values for:

  • Humidity: range from 0% to 100% (unsigned 3 digits)
  • Temperature: -10 to 100 degree Celcius (estimated, signed float(3.2))
  • Pressure: range 980 to 1030 hPa (unsigned 4 digits)

Validate sensors types

We should (?) maintain a table (not necessarily a DB one) with the list of sensors we "support". Only so that we keep that list healthy (e.g. no different names for the exact same model), for later (e.g. queries).

The best way to do this would be to do it at schema level (see Measurement.sensor definition in app/schemas.py):

  1. It will enforce the list at the API level, even before it reaches the DB, and it will give meaningful error to the client, basically for free because that is how FastAPI/Pydantic works.

  2. It will automatically include that information in the autogenerated docs.

We could maintain a json file in data with the list of sensors, so we don't mix it with code, and simply load the list from schemas.py.

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.