A local webapp made with VueJs and NodeJs to easily export the telemetry data of @eagleTRT.
This project was made for @eagleTRT. The telemetry data are saved as a MongoDB in a Raspberry inside the car. The purpose of this project is giving a fast way to export the data as json or csv. The project is a NodeJs server running in the raspberry and serving a VueJs webapp. It should be used with desktop devices, in that mobile support was not needed.
To see a demo, scroll up to the top of this README.
Usage:
- The user types in a browser
https://IP:PORT
, whereIP
is the ip of the raspberry andPORT
is the port of the server. - The webapp asks the server for the database schema and shows it.
- Three columns are shown. The first shows the collections. When the user select a collectoin, in the second column appear the sessions of that collection. The user can select or unselect sessions by clicking on them. All the selected sessions appear in the third column, organized by collection. The selected sessions can be unselected also by clicking them in the third column.
- Once selected the sessions to export, the user clicks the JSON or the CSV button, depending on the desidered format.
- The webapp sends the request to the server and wait for a zipped file of the exported sessions.
- After the server answers to the webapp, the zip file named with a human-readable timestamp is downloaded. Then the webapp comes back to point
2
.
Note: It is possible that the browser shows an alert because the site is unsercure. You can just ignore it.
To put the exporter in the raspberry:
- Connect the raspberry to the internet.
- Install NodeJs if it is not installed.
- Clone the repository.
- Open the terminal in the root directory of the repository.
- Execute
npm i
. - Execute
npm run start
.
To change the server port or the mongodb uri:
- Open the file
config.json
. - Set the property
PORT
as needed. - Set the property of the object
MONGO
as needed.
To change something in the frontend:
- Open the terminal in the directory
vuejs
of the repository. - Execute
npm i
. - Make changes to the frontend source code.
- See changes by executing
npm run serve
and open a browser inhttps://IP:8080
. Start the server if backend api are needed. - Open the terminal in the root directory of the repository.
- Execute
npm run build:frontend
. - Execute
npm run start
to start the server.
To change the api hostname of the frontend:
- Open the file
vuejs/src/config.json
of this repository. - Change the
host
and theport
properties as needed. - Open the terminal in the root directory of this repository.
- Execute
npm run build:frontend
. - Execute
npm run start
to start the server.
Note: If you can not modify vuejs/src/config.json
, you can pass url parameters to the webapp, such as https://IP:PORT?hostname=localhost:2323
or https://IP:PORT?host=localhost&port=2323
.
On the Raspberry runs Linux Ubuntu. This means that systemctl is available.
To make the exporter run on boot:
- Open a terminal.
- Go to the
/etc/systemd/system
folder. - Create a file by executing
touch exporter.service
. - Copy this code into that file.
[Unit]
Description=Eagle-TRT telemetry exporter webapp
Wants=mongodb.service
After=mongodb.service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=5
User=ubuntu
ExecStart=/usr/bin/node /home/ubuntu/eagletrt-telemetria-exporter/main.js
WorkingDirectory=/home/ubuntu/eagletrt-telemetria-exporter
[Install]
WantedBy=multi-user.target
- Execute
sudo systemctl daemon-reload
to make the changes effective. - Execute
sudo systemctl start exporter
. The exporter should start running at this step. - Execute
sudo systemctl enable exporter
to make the exporter start on boot.
All the gif and images refers to the 1.0 version. Currently, on master, there is the 2.1 version. The difference between the 1.0 and the 2.0 is that the new versions support the new database structure, but the usage and the ui is still the same.
The webapp is now served via https, with a self-signed certificate. This was introduced after in the new version of most browsers all non-https requests worked only with localhost. The webapp could be warned as unsafe, but it is possible to simply skip the warning and use it.
The structure is organized in databases, collections and sessions:
- The database is always the same:
eagletrt
- The collection can be arbitrarily chosen. It can be for instance the name of the car (
chimera
orfenice
) ortest
- The session is determined by the telemetry of the car. It is a document inside a collection, containing the fields representing the timestamp when the session was created, the pilot who was driving the car and the type of race he was performing. The combination of the three is the sessionName. A collection can contain several session documents, along with their record documents, that have have the same sessionName value of the session in which they were saved
When exporting:
- as json: For each database will be create a folder. Each database folder will contain a json file for each exported collection. Each of these json files will contain both the session documents and the record documents of the exported session. This is because the main usage of the json export is to import the data in another mongodb and to achive this all the sessions of a collection need to stay in an unique json file
- as csv: For each database will be create a folder. Each database folder will contain a folder for each exported collection. Each collection folder will contain a folder for each exported session. Each session folder will contain the organized-per-property csv files.
The structure is organized in databases and collections:
- The database can be for instance the name of the car whose data has been saved, such as
chimera
orfenice
. - The collection is the combination of the timestamp when the telemetry created that collection, the pilot who drove the car and the type of race. All the documents in the collection represents the data saved in 500ms.
When exporting:
- as json: For each database will be create a folder. Each database folder will contain a json file for each exported collection.
- as csv: For each database will be create a folder. Each database folder will contain a folder for each exported collection. Each collection folder will contain the organized-per-property csv files.