fighter3005 / IoT_course_competition_leaderboard

0 stars 0 forks source link

IoT_challenge_leaderboard

Info:

The code is a quick and dirty implementation of a leaderboard and an api to visualize the progress of the running experiment from Lab2 - Part 4, of the 2024 iteration of the IoT course at the CAU Kiel. Feel free to modify the code as you wish.

Note: The code is not very clean. (For example style & className props are used, and the code could be split into separate components). Security is also a factor, that is outside of the scope of this repo. The username and password are not secure, and the login is also not intended to be secure.

Deployment

How to start up the Leaderboard

Then use the provided leaderboard.py to capture, save and send the data generated by the sink node to the leaderboard api. Start the script and as soon as you are ready, start your protocol and hit enter to start the 5 minute timer and capture serial output. The script terminates after 5 minutes.

For local testing and development:

IMPORTANT NOTE

Please kick the node_module folders before building the docker image, since they will be copied over and make the express server fail to start.

Configuration:

Frontend: You need to specify the url of the express-server api in App.js. You also need to adjust the maximum amount of packages max_packages that can be received per competitor. You may also adjust the scoreFn for individual weighting of the statistics.

Backend: You need to configure the port, username, and password in server.js and also the max_measurement_counter in database.js. If needed, you can also adjust the constrains for the format of a valid string by modifying the if statement in the function saveCompetitorData or the regex, like in the leaderboard.py script. Additionally there is an option to save the database between restarts by setting persistance to true.

leaderboard.py: You need to set the server_url, competitorName, serial_port, and baud_rate. Setting a color is optional for each group.