If you are reading this you are prolly pretty cool. I likely saved you from doing firmware or you were extra cool and asked to be on the database team to begin with. Do not fret those firmware losers aren't having fun anyways.
Please excuse my inablity to create something that isn't laced with immense quantities of sarcasm, I hope that it only makes it more fun to get through this readme.
This is the repository for the Telemetry Database project for EVT. A little backstory, we previously stored all of our data in MF4 files(Don't worry if you don't know what that is, neither did I). These files were then converted to .mat files (Eww; Matlab bad) for parsing. From there we would pretend that we used the data stored in those files but in reality they would sit and we would eventually lose them.
This database has a few goals:
- Data Retention
- As a "small" team we CANNOT afford to lose what little data we get.
- We want to build a backlog of data so we can look back and compare, learn, and ✨grow✨!
- Also, I have pipe dreams of automated fault detection and that requires a lot of past data.
- Data Analysis
- Data is a beautiful thing and can point us to problems and new ideas otherwise invisible to us.
- Running diagnostics on our data can help find mechanical issues with our bikes.
- Again, pipe dream, I want to have data streamed live from the bike to the database so we have a live feed of the state of the bike.
- Ease of Access
- Prior to any database set up, you had to give away your right arm and first born to get any of our data.
- Providing the database will give the MechEs and the Integration team greater access to data which (allegedly) they need.
The documentation for this system will be provided anywhere I can put it but I would like for this readme to have everything we could ever want or need.
This should at minimum include the Entity Relationship(ER) Diagram, Data Definition Language(DDL) Diagram, and the Reduction to Tables document.
To the poor soul who takes my place; I beg of you, keep this up to date. It will be so much cooler when I put it on my resume and show it to future employers.
Entity Relationship Diagram:
I want to move this off of Lucid Chart but for now there it shall lie.
Entity Relationship Diagram
The script which is responsible for streaming the raw CAN data into the database.
Currently to use the script run main and when prompted input the path to the .mf4 file you want to have uploaded.
As we do not have means to collect context data yet, we use a dummy context with an id of 1. This is gross and bad. We will be removing that as soon as we have a way to query the user for context data.
This react-strap-based website allows users to input context and configuration information and to upload CAN data files.
Ideally, MECE's will just download the files and run it on their computer. This includes running both the website and backend api that goes along with it.
In the future, I hope to host at least the backend restful api, and eventually the website itself, on a web server, but that is not going to happen for a long time. To anyone that works on this in the future, if this message is still here, that means I never went back and fixed the mess I made, and for that I sincerely apologize for. This was meant to be quick and dirty, but I attempted to follow best practices and self document the code where I could.
The RESTful API is built with Python using Flask.
Someday, this will be hosted on a central server, but for now it runs locally. To run this application, see directions below under Running the Server.
For any future developers, standard practices should be followed when building this API. This includes separating calls into different classes and using the GET
, PUT
, POST
, and DELETE
calls correctly. Additionally, any changes to the url path for a call should be updated in the ServerPath.json file.
The first step is to install Node JS if you do not already have it installed.
For Windows computers, execute the following commands:
winget install Schniz.fnm
You will need to close and reopen your terminal before executing the rest
fnm env --use-on-cd | Out-String | Invoke-Expression
fnm use --install-if-missing 20
For Mac and Linux, execute the following commands:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
You will need to close and reopen your terminal before executing the rest
nvm install 20
Verify your install on any platform by running:
node -v
npm -v
After Node JS has been installed, the next step is to clone the repo and all needed components.
Open your command terminal and 'cd' into the desired folder location and run the following commands
git clone https://github.com/RIT-EVT/telemetry-database.git
npm install react
npm install reactstrap
If you have it installed, you can use VS Code to open the project. If you don't have it installed, just follow along in the command window.
In the terminal, cd
into the ~...\Telemetry-Database\TelemetrySite\client
folder. Once there, run the following commands:
npm install
npm start
If your website didn't start, check that you are in the correct folder and you installed Node JS.
After your sever is online, make sure you keep that terminal open. Closing that terminal for any reason will kill your website.
Open a new terminal and cd
into the ~...\Telemetry-Database
folder.
Run the command pip install -r requirements.txt
.
If pip
isn't being recognized, run python -V
. If python isn't recognized, download the installer here Python. Python should add itself as environmental variable automatically, but you may need to click Add As Environmental Variable on the last page before you close the installer.
In your terminal cd
into the ~...\Telemetry-Database\TelemetrySite\server
folder and run python .\server.py
In order to connect to the database, you must contact one of the database leads for the .env file.
Once they have sent it to you, place it in the ~...\Telemetry-Database
folder in a file names credentials.env.
WARNING
.env files should never be shared or the contents sent anywhere without the Firmware Team's permission
DO NOT ADD credentials.env TO GIT