Skip to content

Modules

koldou98 edited this page Jun 21, 2021 · 2 revisions

Modules

The modules of the system are the ones that appear in the following diagram:

Architecture

st_web

This is not a logical module, but the website where all the collected data is displayed to the end user. Despite not being a logical module, it is important because users will get tips on how to improve their consumption.

The website has been developed using the ReactJS Framework.

st_main_server

This module is a REST HTTP API gateway between the website (st_web) and all other microservices. In addition, this module is responsible for collecting most of the information that will be shown to the user on the website, as well as managing signup, login and logout.

All the user authentication process has been done using a cookie with a JWT inside of it. The JWT will be created when the user logs in or when the signup process ends with no errors.

To obtain consumption information it is compulsory to be connected to IoToad external module.

st_equivalencias

This module is a HTTP REST API responsible for calculating a random equivalence for the consumption done by a certain user in the last 24 hours. The equivalence table (sqlite3 database file) is downloaded from an external GitHub repository. Database file can be found here.

This module only has one POST endpoint /equivalencia, where the SmartPlug location has to be specified in the request body. For example:

/equivalencia

{
    "ubicacion": "sp_w.r1.c3"
}

As mentioned before, the response would a JSON with the equivalence. For example:

{
    "msg": "In the las 24h consumption has been equal to 167.5530 km driving an electric car"
}

Note

The "ubicacion" atribute is the location of the SmartPlug stored in ETCD.

Clone this wiki locally