Giter Site home page Giter Site logo

acruve15 / pyro-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pyronear/pyro-api

0.0 0.0 0.0 857 KB

Alert Management API for wildfire prevention, detection & monitoring

Home Page: http://pyronear-api.herokuapp.com/docs

License: Apache License 2.0

Python 98.62% CSS 0.04% Makefile 0.74% Mako 0.16% Batchfile 0.26% Dockerfile 0.19%

pyro-api's Introduction

Pyronear API

CI Status Documentation Status Test coverage percentage black

PyPi Status Anaconda Docker Image Version pyversions license

The building blocks of our wildfire detection & monitoring API.

Quick Tour

Running/stopping the service

You can run the API containers using this command:

make run

You can now navigate to http://localhost:8080/docs to interact with the API (or do it through HTTP requests) and explore the documentation.

Swagger

In order to stop the service, run:

make stop

How is the database organized

The back-end core feature is to interact with the metadata tables. For the service to be useful for wildfire detection, multiple tables/object types are introduced and described as follows:

Access-related tables

  • Groups: defines collections of credentials that share a similar scope (e.g. you won't be able to access the same data as the local firefighters).
  • Accesses: stores the hashed credentials and access level for users & devices.
  • Users: actual humans registered in the database.
  • Devices: the registered cameras.

Setup-specific tables

  • Sites: specific locations (firefighter watchtowers, fire stations, etc.).
  • Installations: association linking a device & a site over a given timespan.

Core detection worklow tables

  • Events: wildfire events.
  • Media: metadata of a picture and its storage bucket key.
  • Alerts: association of a picture, a device, and an event.

Advanced tables

  • Webhooks: advanced mechanisms to introduce callbacks on specific routes.

UML diagram

What is the full detection workflow through the API

The API has been designed to provide, for each wildfire detection, the alert metadata:

  • timestamp
  • the picture that was used for detection
  • the location is was taken at, and the direction it was taken from

With the previously described tables, here are all the steps to send a wildfire alert:

  • Prerequisites (ask the instance administrator): register user
  • Register a device: declare your device on the API, using your new user credentials.
  • Create a media object & upload content: using the device credentials, save the picture metadata and upload the image content.
  • Create an alert: using the device credentials, send all the wildfire metadata.

Installation

Prerequisites

The project was designed so that everything runs with Docker orchestration (standalone virtual environment), so you won't need to install any additional libraries.

Configuration

In order to run the project, you will need to specific some information, which can be done using a .env file. This file will have to hold the following information:

  • QARNOT_TOKEN: this will enable the back-end access to the storage service of Qarnot Computing
  • BUCKET_NAME: the name of the storage bucket
  • BUCKET_MEDIA_FOLDER: the folder to place media content in

Optionally, the following information can be added:

  • SENTRY_DSN: the URL of the Sentry project, which monitors back-end errors and report them back.
  • SENTRY_SERVER_NAME: the server tag to apply to events.

So your .env file should look like something similar to:

QARNOT_TOKEN=my_very_secret_token
BUCKET_NAME=my_storage_bucket_name
BUCKET_MEDIA_FOLDER=my/media/subfolder
SENTRY_DSN='https://replace.with.you.sentry.dsn/'
SENTRY_SERVER_NAME=my_storage_bucket_name

The file should be placed at the root folder of your local copy of the project.

More goodies

Documentation

The full package documentation is available here for detailed specifications.

Python client

This project is a REST-API, and you can interact with the service through HTTP requests. However, if you want to ease the integration into a Python project, take a look at our Python client.

Contributing

Any sort of contribution is greatly appreciated!

You can find a short guide in CONTRIBUTING to help grow this project!

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

pyro-api's People

Contributors

frgfm avatar florianriche avatar fe51 avatar jean-pasquier avatar blenzi avatar martin1tab 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.