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.
Install docker and docker-compose.
Create a .env
file in the root of the project based on the .env.example
file.
Run docker-compose up
to start the server.
The MQTT broker, database and python server run in docker containers that can be configured in the docker-compose.yml
file.
The MQTT broker configuration is stored in the moquitto/config
folder.
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.
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.
Returns a list of all the reports in the database between the start
and end
dates with matching client_ids
.
start
: UTC start date and time of your search in ISO 8601 formatend
: UTC end date and time of your search in ISO 8601 formatclient_ids
: List of client ids to filter the results
[
{
"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
},
]
This work is licensed under a CreativeCreative Commons Attribution-NonCommercial 4.0 International License.
Made with ๐ by Valentin Sene.