Files
MSE-PI-E2EEDA-Plein-de-eeee…/report/main/database/interface.typ

46 lines
2.0 KiB
Typst

#import "/metadata.typ": *
No @llm has been used for the design of deposal and retrievals interfaces.
The database is used to store data, we need so to be able to push data and retrieve in several form the stored data.
#let mqtt-json-payload = [
#figure(
table(
columns: (1fr, 1fr),
align: horizon+left,
[*timestamp*], [D/T (RFC3339)],
[*temp*],[float],
[*humidity*],[float],
[*co2_ppm*],[integer],
[*window_open*],[boolean],
[*battery*],[integer]
),
caption: [@mqtt:short Json payload]
) <mqtt-json-payload>
]
#grid(
columns: (1fr, 1fr),
column-gutter: 2em,
[
To put data in the Database, we use an @mqtt source of data. The @mqtt payload is a list of key-value as follow defined in @mqtt-json-payload. All of this key are translated as `Fields` in influx DB. Topic of the @mqtt are translated in `Tags` in Influx.
So, all data arrive in the database trough the an @mqtt message
],
mqtt-json-payload
)
To get data out of the database, we have several @rest @api all available at: #link("https://doc.db.e.kb28.ch/")[doc.db.e.kb28.ch].
The main route is for the user interface with the following endpoint:
- `/rooms`: Return the list of rooms available on the database
- `/rooms/{room-id}/current`: Return the last values for the select room
- `/rooms/{room-id}/history`: Return the history (default last 24h) of the selected room
- `/rooms/high-co2`: Return the list of room with high value of @co2
It's also possible to get all the data in a @csv:short file trough a dedicated @rest endpoint. This is specially usefull for validate model by Alison.
- `/export/csv?node=<node>&from=<start-RFC3339>&to=<end-RFC3330>`: \
Return a @csv with all the measurement point of the selected node between the start and stop date-time.
A another special endpoint was added during the project to monitor the battery level of each node:
- `/battery`: Return the list of node with the corresponding battery level. If message was present in the last 30min, the node is declared offline