Giter Site home page Giter Site logo

catfish-backend's Introduction

Catfish Backend

This project is a backend server for the Catfish project. It receives organizes and stores the data sent by the Catfish in MQTT to a MySQL database and provides an API to access it.

Usage

Setup

Install docker and docker-compose. Create a .env file in the root of the project based on the .env.example file.

Run

Run docker-compose up to start the server.

Development

The MQTT broker, database and python server run in docker containers that can be configured in the docker-compose.yml file.

MQTT Broker

The MQTT broker configuration is stored in the moquitto/config folder.

Database

The server interracts with a CouchDB database thanks to the couchdb python library. The file src/db.py contains the DB class that handles the connection and queries. The tables are created in the class constructor at the first run of the server.

API

The server exposes an API to access the data stored in the database thanks to the Flask library. The API routes are defined in the src/api.py file.

Routes

GET /reports

Returns a list of all the reports in the database between the start and end dates with matching client_ids.

Parameters
  • start: UTC start date and time of your search in ISO 8601 format
  • end: UTC end date and time of your search in ISO 8601 format
  • client_ids: List of client ids to filter the results
Response
[
  {
    "CDOM": 3.0,
    "PH": 26.0,
    "CLIENT_ID": "CATFISH_PROTOTYPE",
    "TIME": "2023-04-27T04:20:00Z",
    "DEPTH": 7.0,
    "DISSOLVED_OXYGEN": 59.0,
    "FISH_DEPTH": 8.0,
    "INDUCTION": 535.0,
    "NITRATE": 141.0,
    "PRESSURE": 9.0
  },
  {
    "CDOM": 3.0,
    "PH": 26.0,
    "CLIENT_ID": "CATFISH_PROTOTYPE",
    "TIME": "2023-04-27T04:20:00Z",
    "DEPTH": 7.0,
    "DISSOLVED_OXYGEN": 59.0,
    "FISH_DEPTH": 8.0,
    "INDUCTION": 535.0,
    "NITRATE": 141.0,
    "PRESSURE": 9.0
  },
]

License

This work is licensed under a CreativeCreative Commons Attribution-NonCommercial 4.0 International License.

Made with ๐Ÿ’– by Valentin Sene.

Creative Commons License

catfish-backend's People

Contributors

valentinpx avatar

Watchers

 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.